Home > Veritas Storage Foundation™ File System Manual Pages
VXFS_INOTOPATH (3) |
Library Functions |
-l vxfsutil -ldl
int vxfs_inotopath(char *mount_point, uint64_t inode_number,
int all, char ***bufp int *inentries)
int vxfs_inotopath_gen(char *mnt_pt, uint64_t inode_number, unint32_t inode_generation, int all, char ***bufp, int *nentries)
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/VRTSfssdk/4.0/lib directory for 32-bit executables, or the /opt/VRTSfssdk/4.0/lib/64 directory for 64-bit executables.
If the LIBVXFSUTIL_DLL_PATH environment variable is defined, it should be set to the name of the vxfsutil.so file, such as ~/mylib/vxfsutil.so. If undefined, this variable is assumed to point to the 32-bit and 64-bit vxfsutil.so files, /opt/VRTSvxfs/lib/vxfsutil.so and /opt/VRTSvxfs/lib/64/vxfsutil.so, respectively.
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.
- mount_point is not a valid VxFS file system
- mount_point is not a root inode
- The inode number is larger than a 32-bit integer
- File system stat information was unavailable
/* * (c) VERITAS Software 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) VERITAS Software 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); }
Last updated: 01 April 2006
Copyright ©2009 Symantec Corporation
All rights reserved.