getfsent()

Get the next entry from the filesystem table (/etc/fstab) file

Synopsis:

#include <fstab.h>

struct fstab * getfsent(void);

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.


Note: This function is in libc.a, but not in libc.so (in order to save space).

Description:

The getfsent() function gets the next entry from the filesystem table file, /etc/fstab.

The fstab structure

The getfsent(), getfsfile(), and getfsspec() functions return pointers to a fstab structure, which is defined as follows:

struct fstab {
        char    *fs_spec;
        char    *fs_file;
        char    *fs_vfstype;
        char    *fs_mntops;
        char    *fs_type;
        int     init_flags;
        int     init_mask;
};

The members include:

fs_spec
The block special device name (e.g. /dev/hd0t177).
fs_file
The filesystem path prefix.
fs_vfstype
The type of filesystem; for a list of types, see the entry for mount in the Utilities Reference.
fs_mntops
A comma-separated list of mount options, which can include:
String Constant Meaning
implied FSTAB_IMPLIED The root entry was implied, not specified.
allservers FSTAB_OCB Send the mount request to all servers.
ro FSTAB_RO Read-only device.
rw FSTAB_RW Read-write device.
xx FSTAB_XX Completely ignore the entry.
fs_type
The type of filesystem; one of the following:
String Constant Meaning
ro FSTAB_RO Read-only device.
rw FSTAB_RW Read-write device.
xx FSTAB_XX Completely ignore the entry.
init_flags
Flags to OR in:
init_mask
Flags to AND out.

Returns:

A pointer to the fstab structure for the next entry in the file, or NULL if the function reached the end of the file.

Classification:

NetBSD

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

Caveats:

The functions that work with /etc/fstab use static data storage; if you need the data for future use, copy it before any subsequent calls overwrite it.

See also:

endfsent(), getfsfile(), getfsspec(), mount(), setfsent()

/etc/fstab, mount in the Utilities Reference