|
|
cc [flag . . . ] file . . . -lgen [library] . . .#include <stdio.h> #include <sys/vfstab.h>
int getvfsent (FILE fp, struct vfstab vp);
int getvfsfile (FILE fp, struct vfstab vp, const char file);
int getvfsspec (FILE fp, struct vfstab vp, const char spec);
int getvfsany (FILE fp, struct vfstab vp, const struct vfstab vref);
getvfsspec- search vfstab file
getvfsany- search vfstab file for matching pattern
getvfsent, getvfsfile, getvfsspec, and getvfsany each fill in the structure pointed to by vp with the broken-out fields of a line in the /etc/vfstab file. Each line in the file contains a vfstab structure, declared in the sys/vfstab.h header file:
char vfs_special; char vfs_fsckdev; char vfs_mountp; char vfs_fstype; char vfs_fsckpass; char vfs_automnt; char vfs_mntopts; char vfs_macceiling;
If the fields have meaning, the meanings are described in vfstab(4). Fields with no valid information are set to point at the null string.
getvfsent returns a pointer to the next vfstab structure in the file; so successive calls can be used to search the entire file. getvfsfile searches the file referenced by fp until a mount point matching file is found and fills vp with the fields from the line in the file. getvfsspec searches the file referenced by fp until a special device matching spec is found and fills vp with the fields from the line in the file. spec will try to match on device type (block or character special) and major and minor device numbers. If it cannot match in this manner, then it compares the strings. getvfsany searches the file referenced by fp until a match is found between a line in the file and vref. vref matches the line if all non-null entries in vref match the corresponding fields in the file.
Note that these routines do not open, close, or rewind the file.