getfsent(3x)
Name
getfsent, getfsspec, getfsfile, getfstype, setfsent, endfsent − get file system descriptor file entry
Syntax
#include <fstab.h>
#include /usr/include/sys/fs_types.h
struct fstab *getfsent()
struct fstab *getfsspec(spec)
char *spec;
struct fstab *getfsfile(file)
char *file;
struct fstab *getfstype(type)
char *type;
int setfsent()
int endfsent()
Description
All routines operate on the file /etc/fstab, which contains descriptions of the known file systems. The routine setfsent opens this file. The routine getfsent reads the next file system description within /etc/fstab opening the file if necessary. The endfsent routine closes the file.
The getfsspec, getfsfile, and getfstype routines sequentially scan the file /etc/fstab for specific file system descriptions. The getfsspec routine searches for a description with a matching special file name field. The routine getfsfile searches for a description with a matching file system path prefix field. The routine getfstype searches for a description with a matching file system type field.
The getfsent, getfsspec, getfstype, and getfsfile each return a pointer to a representation of the description they have matched or read. Representations are in the format of the following structure:
#defineFSTAB_RW"rw"/* read-write device */
#defineFSTAB_RO"ro"/* read-only device */
#defineFSTAB_RQ"rq"/* read-write with quotas */
#defineFSTAB_SW"sw"/* swap device */
#defineFSTAB_XX"xx"/* ignore totally */
struct fstab {
char*fs_spec;/* block special device name */
char*fs_file;/* file system path prefix */
char*fs_type;/* rw,ro,sw or xx */
intfs_freq;/* dump frequency, in days */
intfs_passno;/* pass number on parallel dump */
char*fs_name;/* name of the file system type */
char*fs_opts/* arbitrary options field */
};
Return Values
A NULL or 0 is returned, but errno is not set on detection of errors.
Restrictions
All descriptions are contained in static areas, which should be copied.
Files
/etc/fstab File system information file.