mount, umount - mount or umount a file system

     #include <unistd.h>
     #include <sys/mount.h>

     int mount(char *special, char *name, int flags)
     int umount(char *name)

     Mount() tells the system that the file system special is to be mounted on
     the file name, effectively overlaying name with the file tree on special.
     Name may of any type, except that if the root of special is a  directory,
     then  name  must  also  be  a directory.  Special must be a block special
     file, except for loopback mounts.  For loopback mounts a normal  file  or
     directory  is  used  for  special,  which  must  be seen as the root of a
     virtual device.

     Umount() removes the connection between a device and a mount point,  name
     may  refer  to either of them.  If more than one device is mounted on the
     same mount point then unmounting at the  mount  point  removes  the  last
     mounted  device,  unmounting a device removes precisely that device.  The
     unmount will only succeed if none of the files on the device are in use.

     A loopback mount places one part of the file system  on  top  of  another
     part.   To  avoid  problems  with  aliasing the old name is replaced by a
     symlink pointing to the mount point.  This symlink is created on the  fly
     when the old name is accessed.

     Both calls may only be executed by the super-user.

     Flags must be a combination of these macros defined by <sys/mount.h>:

     /* Mount type flags: */
     #define M_RDONLY    0x0001  /* Read only */
     #define M_NOSUID    0x0002  /* Set-uid execution inhibited */
     #define M_REMOUNT   0x0004  /* Remount with new options */
     #define M_GRPID     0x0008  /* Inherit group id from directory */
     #define M_NF        0x0010  /* Use next-fit block/inode allocation */
     #define M_FLAGS     0x00FF  /* Select mount flags */

     /* Device type flags: */
     #define M_DEV       0x0100  /* Mount a block device of unknown type */
     #define M_V1        0x0200  /* Version 1 FS */
     #define M_V2        0x0300  /* Version 2 FS */
     #define M_V1F       0x0400  /* V1 FS, flex dirs */
     #define M_V2F       0x0500  /* V2 FS, flex dirs */
     #define M_LO        0x0600  /* Loopback */
     #define M_TYPE      0xFF00  /* Select device type */

     The mount type flags may be or-ed together with one of  the  device  type
     flags  for the third argument of mount().  The M_DEV type allows mounting
     of a file system of an unknown type.  FS will figure it out by inspecting
     the superblock.  The other device type flags will only mount file systems
     of the given type.  The return value of the new  style  mount  echos  the
     flags, but with M_DEV changed to the proper device type.

     With M_REMOUNT one can change the way a device is mounted, except that  a
     device  mounted  read-write can not be made read-only.  For a remount the
     name argument is ignored (as yet), only special is used.

     Flags may be just 0 or 1 for backwards compatibility,  the  return  value
     will then be 0 on succes.


     Kees J. Bot (