NAME
exportent(), getexportent(), setexportent(), addexportent(), remexportent(), endexportent(), getexportopt() — access exported file system information
SYNOPSIS
#include <stdio.h>
#include <exportent.h>
FILE *setexportent();
struct exportent *getexportent(FILE *fildep);
int addexportent(FILE *filep, char *dirname, char *options);
int remexportent(FILE *filep, char *dirname);
char *getexportopt(struct exportent *xent, char *opt);
void endexportent(FILE *filep);
DESCRIPTION
These routines access the exported filesystem information in
/etc/xtab.
- setexportent()
Open the export information file
and return a file pointer to use with
getexportent(),
addexportent(),
remexportent(),
and
endexportent().
Returns
NULL
if the file is locked
or if an error is encountered in opening the file.
- getexportent()
Read the next line from
filep
and return a pointer to an object with the following structure
containing the broken-out fields of a line in file
/etc/xtab.
The fields have meanings described in
exports(4).
#define ACCESS_OPT "access" /* machines that can mount fs */
#define ROOT_OPT "root" /* machines with root access to fs */
#define RO_OPT "ro" /* export read-only */
#define ANON_OPT "anon" /* uid for anonymous requests */
#define ASYNC_OPT "async" /* all mounts will be aynchronous */
struct exportent {
char *xent_dirname; /* directory (or file) to export */
char *xent_options; /* options, as above */
};
getexportent()
returns
NULL
if it encounters end of file.
- addexportent()
Add the
exportent
to the end of the open file
filep.
It returns 0 if successful and -1 on failure.
- remexportent()
Remove the indicated entry from the list.
Returns 0 on success and -1 on failure.
- getexportopt()
Scans the
xent_options
field of the
exportent
structure for a substring that matches
opt.
Returns the string value of
opt,
or
NULL
if the option is not found.
- endexportent()
Close the file.
RETURN VALUE
setexportent(),
getexportent(),
and
getexportopt()
return a
NULL
pointer on
EOF
or error.
addexportent()
and
remexportent()
return -1 if they fail.
WARNINGS
The returned
exportent
structure points to static information
that is overwritten in each call.
AUTHOR
exportent,
getexportent(),
setexportent(),
addexportent(),
remexportent(),
endexportent(),
and
getexportopt()
were developed by Sun Microsystems, Inc.