exportfs(2) — System Calls
Digital
NAME
exportfs − exports an NFS file system
SYNOPSIS
#include <sys/mount.h>
#include <nfs/nfs.h>
exportfs(access, record, exdata)
int access;
int ∗record;
struct exportfsdata, ∗exdata;
DESCRIPTION
The exportfs system call allows the specified local file system to be mounted remotely by an NFS client. This system call is usually called from mountd. The system call allows access to the kernels export data base. The method of access is specified by the access flag as follows:
#define EXPORTFS_CREATE 0x01 /∗ create a new export record ∗/
#define EXPORTFS_REMOVE 0x02 /∗ remove an old export record ∗/
#define EXPORTFS_READ 0x03 /∗ read an old export record ∗/
Each entry in the export data base has the following structure:
struct exportfsdata {
int e_flags; /∗ export flags ∗/
char e_path[MAXPATHLEN]; /∗ name of the path to export ∗/
short e_rootmap; /∗ map root to this id ∗/
int e_more; /∗ next entry in database ∗/
dev_t e_dev; /∗ ID of device containing a directory ∗/
ino_t e_ino; /∗ File serial number ∗/
ulong_t e_gen; /∗ file generation number ∗/
};
Security on the exported file systems can be improved by setting the root mapped user ID in, rootuid. By default, root maps to user id −2. Also, the export permissions flags can be set in e_flags for the local file system path. The following flags are the only possible flags accepted by exportfs:
#define M_EXRONLY /∗ export read-only ∗/
The e_path argument is a pointer to a null-terminated string containing the path name of the file system being exported.
The e_dev, e_ino, and e_gen fields are inputs to the system call for creating an entry. They are returned when an entry is read.
e_more is used to sequentially read the kernels export data base. e_more should be set to zero to read the first record. After reading the record, the system call will set e_more to a non-zero value if there are more records to read. If there are no more records in the data base, e_more will be zero after the system call completes.
The exportfs system call returns a value of 0 upon successful completion of a operation, and −1 upon failure.
ERRORS
[EPERM] Not superuser.
[EIO] Not enough memory in the system to service the request.
[EFAULT] Bad address or bad length of e_path.
[ENOENT] The e_path cannot be found.