Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ addmntent(3X) — HP-UX 9.10

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

checklist(4)

getfsent(3X)

mnttab(4)

getmntent(3X)

NAME

getmntent(), setmntent(), addmntent(), endmntent(), hasmntopt() − get file system descriptor file entry

SYNOPSIS

#include <mntent.h>

FILE ∗setmntent(const char ∗path, char ∗type);

struct mntent ∗getmntent(FILE ∗stream);

int addmntent(FILE ∗stream, struct mntent ∗mnt);

char ∗hasmntopt(struct mntent ∗mnt, const char ∗opt);

int endmntent(FILE ∗stream);

DESCRIPTION

These routines replace the obsolete getfsent() routines (see getfsent(3X)) for accessing the file system description file /etc/checklist.  They are also used to access the mounted file system description file /etc/mnttab. 

setmntent() Opens a file system description file and returns a file pointer which can then be used with getmntent(), addmntent(), or endmntent().  The type argument is the same as in fopen(3C).

getmntent() Reads the next line from stream and returns a pointer to an object with the following structure containing the broken-out fields of a line in the file-system description file, <mntent.h>.  The fields have meanings described in checklist(4).

struct mntent {
    char    *mnt_fsname; /* file system name */
    char    *mnt_dir;    /* file system path prefix */
    char    *mnt_type;   /* hfs, nfs, swap, or xx */
    char    *mnt_opts;   /* ro, suid, etc. */
    int     mnt_freq;    /* dump frequency, in days */
    int     mnt_passno;  /* pass number on parallel fsck */
    long    mnt_time;    /* When file system was mounted; */
                         /* see mnttab(4). */
    cnode_t mnt_cnode;   /* Cnode id from stat of mnt_fsname */
                         /* (0 for NFS) */
};

In the HP Clustered environment, the mnt_cnode field contains the cnode ID associated with the file system name named in the mnt_fsname field unless the specified file system is of NFS type in which case the mnt_cnode field is set to 0.  getmntent() obtains the mnt_cnode field for non- NFS type file systems by executing the stat() system call and using the st_rcnode field of the stat structure (see stat(2)).

addmntent() Adds the mntent structure mnt to the end of the open file stream. Note that stream must be opened for writing. 

hasmntopt() Scans the mnt_opts field of the mntent structure mnt for a substring that matches opt. It returns the address of the substring if a match is found; 0 otherwise. 

endmntent() Closes the file. 

The following definitions are provided in <mntent.h>:

#define MNT_CHECKLIST   "/etc/checklist"
#define MNT_MNTTAB      "/etc/mnttab"
 #define MNTMAXSTR       128        /* Max size string in mntent */
 #define MNTTYPE_HFS     "hfs"      /* HFS file system */
#define MNTTYPE_CDFS    "hfs"      /* CD-ROM file system */
#define MNTTYPE_NFS     "nfs"      /* Network file system */
#define MNTTYPE_SWAP    "swap"     /* Swap device */
#define MNTTYPE_SWAPFS  "swapfs"   /* File system swap */
#define MNTTYPE_IGNORE  "ignore"   /* Ignore this entry */
 #define MNTOPT_DEFAULTS "defaults" /* Use all default options */
#define MNTOPT_RO       "ro"       /* Read only */
#define MNTOPT_RW       "rw"       /* Read/write */
#define MNTOPT_SUID     "suid"     /* Set uid allowed */
#define MNTOPT_NOSUID   "nosuid"   /* No set uid allowed */
#define MNTOPT_QUOTA    "quota"    /* Enable disk quotas */
#define MNTOPT_NOQUOTA  "noquota"  /* Disable disk quotas */

The following definition is provided for device swap in <mntent.h>:

#define MNTOPT_END    "end"     /* swap after end of file system,
                                   Series 300/400/700 only */

The following definitions are provided for file system swap in <mntent.h>:

#define MNTOPT_MIN   "min"     /* minimum file system swap */
#define MNTOPT_LIM   "lim"     /* maximum file system swap */
#define MNTOPT_RES   "res"     /* reserve space for file system */
#define MNTOPT_PRI   "pri"     /* file system swap priority */

NETWORKING FEATURES

NFS

The following definitions are provided in <mntent.h>:

#define MNTOPT_BG       "bg"       /* Retry mount in background */
#define MNTOPT_FG       "fg"       /* Retry mount in foreground */
#define MNTOPT_RETRY    "retry"    /* Number of retries allowed */
#define MNTOPT_RSIZE    "rsize"    /* Read buffer size in bytes */
#define MNTOPT_WSIZE    "wsize"    /* Write buffer size in bytes*/
#define MNTOPT_TIMEO    "timeo"    /* Timeout in 1/10 seconds */
#define MNTOPT_RETRANS  "retrans"  /* Number of retransmissions */
#define MNTOPT_PORT     "port"     /* Server’s IP NFS port */
#define MNTOPT_SOFT     "soft"     /* Soft mount */
#define MNTOPT_HARD     "hard"     /* Hard mount */
#define MNTOPT_INTR     "intr"     /* Interruptable hard mounts */
#define MNTOPT_NOINTR   "nointr"   /* Uninterruptable hard mounts*/
#define MNTOPT_DEVS     "devs"     /* Device file access allowed */
#define MNTOPT_NODEVS   "nodevs"   /* No device file access allowed */

RETURN VALUE

setmntent() Returns a null pointer on error. 

getmntent() Returns a null pointer on error or EOF.  Otherwise, getmntent() returns a pointer to a mntent structure.  Some of the fields comprising a mntent structure are optional in /etc/checklist and /etc/mnttab.  In the supplied structure, such missing character pointer fields are set to NULL and missing integer fields are set to −1. 

addmntent() Returns 1 on error. 

endmntent() Returns 1. 

WARNINGS

The returned mntent structure points to static information that is overwritten in each call. 

AUTHOR

addmntent(), endmntent(), getmntent(), hasmntopt(), and setmntent() were developed by The University of California, Berkeley, Sun Microsystems, Inc., and HP. 

FILES

/etc/checklist
/etc/mnttab

SEE ALSO

checklist(4), getfsent(3X), mnttab(4). 

Hewlett-Packard Company  —  HP-UX Release 9.10: April 1995

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026