*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> exportfs (2)              
Title
Content
Arch
Section
 

exportfs(2)

Contents


NAME    [Toc]    [Back]

       exportfs - Export an NFS file system

SYNOPSIS    [Toc]    [Back]

       #include <nfs/nfs.h>

       exportfs(
               int access,
               int *cookie,
               struct exportfsdata *exdata );

DESCRIPTION    [Toc]    [Back]

       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 database.  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 export record */

       Each entry in the export database has the following structure:


       union exportaddrlist {
               struct exportfsaddrlist eau_avector;
               struct exaddrlist eau_alist; } struct exportfsdata
       {
               dev_t   e_dev;     /* ID of device containing  the
       directory */
               ino_t   e_ino;     /* File serial number */
               uint_t  e_gen;     /* File generation number */
               char  e_path[MAXPATHLEN];   /* Name of the path to
       export */
               int  e_flags;             /* Export flags */
               uid_t e_rootmap;   /* Map root to this uid (either
       0 or -2) */
               uid_t  e_anon;      /* Map anonymous users to this
       uid */
               union exportaddrlist eu_rootaddrs;
                                  /* List of hosts where root can
       be mapped
                                   * to uid 0 */
               union exportaddrlist eu_writeaddrs;
                                  /*  List of hosts allowed write
       access to
                                   * read mostly export */
               #define e_rootaddrs eu_rootaddrs.eau_avector
               #define e_writeaddrs eu_writeaddrs.eau_avector
               int     e_more;    /* Used in EXPORTFS_READ */ };

       struct exportfsaddrlist {
               unsigned naddrs;
               struct sockaddr addrvec[EXMAXADDRS]; };

       The e_path argument is  a  pointer  to  a  null-terminated
       string  containing  the  path  name  of the file system or
       directory 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.

       Security on the exported file systems can be  improved  by
       setting  the  root  mapped  user  ID in, e_rootmap and the
       anonymous user id in e_anon to user  id  -2.  Setting  the
       rootmap  field  to  0 specifies that all client superusers
       will be mapped to 0 and thus will have the same rights  as
       the  local  superuser.   Anonymous  remote users are those
       without UNIX credentials and superusers on client systems.
       Setting  anon  to  a  user  id  other than -2 will map all
       anonymous users to that uid.  Use  of  the  rootmap  field
       overrides values in e_anon for client superusers. Finally,
       to grant superuser privileges to only a  select  group  of
       clients,  set rootmap to -2 and use the e_rootaddrs structure
 to specify the list of privileged systems.

       The export permissions flags are set in  e_flags  for  the
       local  file  system path. The following flags are the only
       possible flags accepted by exportfs():

       #define  M_EXRDONLY     /*  export  read-only  */  #define
       M_EXRDMOSTLY   /* export read-write to hosts in e_writeaddrs
 */ #define M_EXPUBLIC    /* exported for WebNFS public
       access  */  #define  M_EXPUBINDEX   /*  WebNFS access with
       index */

       By default, exports are read-write.  To export a  filesystem
  or  directory read-only, set the M_EXRDONLY flag.  To
       export a filesystem or directory read-only to most clients
       and  read-write  to  a  select group, set the M_EXRDMOSTLY
       flag and include the list of clients in e_writeaddrs.

       To export a filesystem  or  directory  for  WebNFS  public
       access,  set  the  M_EXPUBLIC  flag.  Note  that  only one
       exported filesystem can have this flag set.   By  default,
       the filesystem is exported read-write.

       The  M_EXPUBINDEX  flag  enables the WebNFS server to look
       for an index.html file when given a directory  name.  This
       flag is used in conjunction with the M_EXPUBLIC flag.

       The  e_more  field  is used in conjunction with the cookie
       parameter  to  sequentially  read  the   kernel's   export
       database  using  EXPORTFS_READ.  The  contents  of  cookie
       should be set to zero to  read  the  first  record.  After
       reading  the  record into exdata, the system call will set
       e_more to a non-zero value if there are  more  records  to
       read  and will update the value of cookie. If there are no
       more records in the database, e_more will  be  zero  after
       the system call completes.

       To  specify and retrieve more than EXMAXADDRS hosts in the
       root or write  address  lists,  use  the  EXPORTFS_LISTPTR
       access   modifier.   This  is  or'd  in  with  either  the
       EXPORTFS_CREATE or EXPORTFS_READ access flag.  When creating
  an  export,  the  host  list is read from the address
       pointed to by eau_alist.addrvec.  Similarly, when  reading
       an  export,  the  host list is written to an already allocated
 array pointed to by eau_alist.addrvec; the number of
       elements  allocated  is indicated by eau_alist.naddrs.  If
       there are more hosts to read than are allocated, the allocated
  array is filled with as many addresses as will fit,
       but the returned count  will  reflect  the  actual  number
       available.  You can then extend the allocated array to the
       returned number of addresses, and retry the read.

       The exportfs system call returns a value of  0  upon  successful
 completion of an operation, and -1 upon failure.

ERRORS    [Toc]    [Back]

       Not superuser.  Not enough memory in the system to service
       the request.  Bad address for exdata or cookie.  Access is
       EXPORTFS_CREATE  or  EXPORTFS_REMOVE  and  e_path does not
       exist, or access is EXPORTFS_REMOVE and e_path is  not  an
       exported path, or access is EXPORTFS_READ and there are no
       exportfsdata records to read.  Access  is  EXPORTFS_CREATE
       and e_path is an NFS mounted directory.  Only local directories
 can be exported.  The exdata pointer is  NULL,  the
       cookie value is negative, or the access flag is invalid.

SEE ALSO    [Toc]    [Back]

      
      
       Files:  exports(4)

       Daemons:  mountd(8)



                                                      exportfs(2)
[ Back ]
 Similar pages
Name OS Title
mvExportFlattenedFile IRIX export a movie to a given file format
pfs_xtab HP-UX directories to export to PFS clients
pfs_exports HP-UX directories to export to PFS clients
xtab HP-UX directories to export to NFS clients
exports HP-UX directories to export to NFS clients
exportfs HP-UX export and unexport directories to NFS clients
exportfs IRIX export and unexport directories to NFS clients
pfs_exportfs HP-UX export and unexport directories to PFS clients
vgexport HP-UX export an LVM volume group and its associated logical volumes
mount_nullfs FreeBSD mount a loopback file system sub-tree; demonstrate the use of a null file system layer
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service