Symantec logo

vxfs_inotopath

NAME

vxfs_inotopath, vxfs_inotopath_gen - return path names for a given inode number

SYNOPSIS

cc -I /opt/VRTSvxfs/include -L /opt/VRTSvxfs/lib
-l vxfsutil -ldl

cc -I /opt/VRTSvxfs/include -L /opt/VRTSvxfs/lib/sparcv9
-l vxfsutil -ldl

int vxfs_inotopath(char *mount_point, uint64_t inode_number,
int all, char ***bufp int *nentries)

int vxfs_inotopath_gen(char *mnt_pt, uint64_t inode_number, unint32_t inode_generation, int all, char ***bufp, int *nentries)

AVAILABILITY

VRTSvxfs

DESCRIPTION

vxfs_inotopath() returns one or all path names associated with the given inode number of a specified VxFS file system. The all argument must be 0 to obtain a single path name or 1 to obtain all path names.

mount_point specifies the file system mount point. Upon successful return, bufp points to a two-dimensional character pointer containing the path names and nentries contains the number of entries. Each entry of the returned two-dimensional array is MAXPATHLEN in size and must be freed by the calling application.

To use this function, specify -l vxfsutil while linking. Specify the /opt/VRTSvxfs/lib directory for 32-bit executables, or the /opt/VRTSvxfs/lib/sparcv9 directory for 64-bit executables.

The vxfs_inotopath_gen() function is identical to the vxfs_inotopath() function, except that it uses an additional parameter, inode_generation. The vxfs_inotopath_gen() function returns one or more path names associated with the given inode number, if the inode_generation passed matches the current generation of the inode number. If the generations differ, it returns with an error.

NOTES

This function is supported only on Version 6 and later disk layouts.

RETURN VALUES

vxfs_inotopath() returns zero on success, non-zero on failure.

ERRORS

EFAULT

One or more of the specified pointer arguments points to an illegal address.

EINTR

A signal was caught during the execution of the operation.

EINVAL

The function is being used incorrectly or the arguments to the function could not be validated. This can occur for any of the following reasons:

EXAMPLES

The following C source code is similar to the vxlsino command that uses vxfs_inotopath() to obtain path names.

/*

* (c) Symantec Corporation. All rights reserved.

*/

#include <stdio.h>

#include <errno.h>

#include <string.h>

#include <inttypes.h>

static void usage(void);

char *cmd;

extern int optind;

extern char *optarg;

int

main(

int argc,

char **argv)

{

uint64_t inode;

int c;

int error, nentries, all = 0, i;

char **bufp, *mountpath;

cmd = argv[0];

while ((c = getopt(argc, argv, "a")) != -1) {

switch (c) {

case 'a':

all = 1;

break;

default:

break;

}

}

if ((argc - optind) != 2) {

usage();

}

argc -= optind;

argv = &argv[optind];

sscanf(argv[0], "%lld", &inode);

mountpath = argv[1];

if (error = vxfs_inotopath(mountpath, inode, all, &bufp, &nentries)) {

fprintf(stderr, "vxfs_inotopath: %s\n", strerror(error));

exit(1);

}

for (i = 0; i < nentries; i++) {

printf("%s\n", bufp[i]);

}

for (i = 0; i < nentries; i++) {

free(bufp[i]);

}

free(bufp);

exit(0);

}

void

usage(

void)

{

fprintf(stderr, "usage: %s [-a] <inode#> <mountpoint>\n", cmd);

exit(1);

}

The following C source checks to see if the generation count matches with the generation of the inode number. If it does match, it returns a path name of the inode. If there are no matches, it returns with an error.

/*

* (c) Symantec Corporation. All rights reserved.

*/

#include <stdio.h>

#include <errno.h>

#include <string.h>

#include <inttypes.h>

int main(

int argc,

char **argv)

{

vx_u64_t ino64;

vx_u32_t gen;

int ret, nentries;

char **bufp;

gen = atoi(argv[3]);

sscanf(argv[2], "%lld", &ino64);

ret = vxfs_inotopath_gen(argv[1], ino64, gen, 0, &bufp, &nentries);

if (ret == 0) {

printf("%s\n", bufp[0]);

}

exit(ret);

}

SEE ALSO

vxlsino(1M)