Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mntctl(2) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mount

vmount

master

mntctl

Purpose

     Returns  information about  a node's  mounts or  unmounts
     virtual file systems.

Syntax

     #include <sys/mntctl.h>

     int mntctl (cmd, size, buf)
     int cmd, size;
     char *buf;

Description

     The mntctl system call:

     o   returns information about a node's mounts.

     o   unmounts one or more virtual file systems.

     The size  parameter defines the  number of bytes  in buf.
     The cmd parameter specifies how mntctl acts and specifies
     the meaning of buf.  The  available cmds and the informa-
     tion in the buf parameter for each cmd are:

     MC_MOUNTS   Queries a  node to  learn what that  node has
                 mounted.  This  can be the local  node or, if
                 Distributed  Services  is installed  on  your
                 system, a remote node.

                 The buf parameter points  to a bheader struc-
                 ture that  contains, among other  things, the
                 node ID of  the node to query  and, after the
                 system call  completes, a description  of the
                 first mount issued by  that node.  The mntctl
                 system  call updates  the size  parameter and
                 first  minfo   structure  in   bheader,  then
                 appends descriptions of  additional mounts in
                 separate  minfo  structures.   In  this  way,
                 bheader.minfo becomes the first element in an
                 array  of  minfo   structures.   The  strings
                 pointed to by the  m_object and m_stub fields
                 of each  minfo structure are appended  to the
                 buffer after the array of minfo structures.

                 m_object   Defines the path  to the object to
                            be mounted.  For  the root device,
                            this field contains a pointer to a
                            null string.

                 m_flag     Defines various characteristics of
                            the  object to  be mounted.   Pos-
                            sible  values for  this field  are
                            defined in  the sys/vmount.h file,
                            which    is   included    by   the
                            sys/mntctl.h  file.  These  values
                            are:

                            MNT_READONLY    Indicates that the
                                            object was mounted
                                            with  a  read-only
                                            mount,  and  write
                                            access    is   not
                                            allowed.

                            MNT_REMOVABLE   Indicates that the
                                            object is a remov-
                                            able file system.

                            MNT_REMOTE      Indicates that the
                                            mounted     object
                                            resides on  a node
                                            other   than   the
                                            queried node.

                            MNT_DEVICE      Indicates that the
                                            mounted  object is
                                            a device.

                 The values  returned for m_object  and m_stub
                 are  the paths  used when  a mount  or vmount
                 system call was issued  to mount that object.
                 The size of buf must  be large enough to hold
                 all of the requested data.

     MC_UNMOUNT  Unmounts  the virtual  file  system which  is
                 mounted   over  a   specific  stubpath.    If
                 stubpath cannot be resolved, then unmount all
                 of the file systems  in the subtree under the
                 last resolved component in stubpath.

     The  buf parameter  points to  a null  terminated string.
     This  string contains  the stubpath  of the  virtual file
     system to be unmounted.   When mntctl returns, buf points
     to a bheader structure that contains, among other things,
     the node ID for the local node or 0, and after the system
     call completes,  a description of the  first virtual file
     system  unmounted  (if  any).   The  mntctl  system  call
     updates the size parameter  and the first minfo structure
     in bheader,  and then appends descriptions  of additional
     unmounted virtual  file systems in separate  minfo struc-
     tures.   In this  way,  bheader.minfo  becomes the  first
     element in an array of minfo structures.

     The bheader structure pointed to  by the buf parameter is
     defined in the sys/mntctl.h  header file, and it contains
     the following members:

       unsigned long nid;    /* the node ID of the node that is being */
                             /* queried with the MC_MOUNTS cmd. */
                             /* (zero indicates the local node.) */
                             /* nid is always zero for the MC_UNMOUNT */
                             /* cmd. */
       unsigned short fsp;   /* Used file system protocol.  Currently, */
                             /* the defined file system protocols     */
                             /* are DS and NFS.                       */
       unsigned short tm;    /* Transport media used:  Currently ,    */
                             /* SNA.                                  */
       unsigned int size;    /* the number of minfo structures in the */
                             /* buffer, including the one below in */
                             /* bheader, or the size of buf (in bytes) */
                             /* that would be required to hold the */
                             /* requested info */
       struct minfo[1|;       /* first structure of mount info    */

     The minfo structure is  defined in the sys/mntctl.h file,
     and it contains the following members:

       unsigned long m_nid;  /* the node ID of the node that holds the */
                             /* mounted object if cmd is     */
                             /* MC_MOUNTS, or the root inode for the*/
                             /* unmounted VFS for the MC_UNMOUNT    */
                             /* cmd.  In both cases,           */
                             /* zero indicates the local node. */
       char *m_object;       /* path to the mounted object */
                                 /* or root of unmounted VFS.   */
       char *m_stub;         /* path to the mounted-over object */
       unsigned int m_flag;  /* flag bits to define characteristics of the */
                             /*  mounted object    */
       time_t m_date         /* date that the virtual file system */
                             /* was created */

     When the  mntctl system call completes  successfully, the
     size field  in the  bheader structure contains  the total
     number of minfo structures, including the one in bheader.
     If buf is not big enough  to hold all of the minfo struc-
     tures  and all  of the  strings, the  mntctl system  call
     fails and bheader.size contains the size (in bytes) that

Return Value

     Upon  successful  completion,   the  mntctl  system  call
     returns a value of 0.  If the mntctl system call fails, a
     value of -1 is returned, and errno is set to indicate the
     error.

Diagnostics

     The mntctl  system call fails and  the requested informa-
     tion is not returned if one  or more of the following are
     true:

     E2BIG      The  requested information  will not  fit into
                size.

     If  Distributed Services  is  installed  on your  system,
     mntctl can also fail if one  or more of the following are
     true:

     EDIST         The   server   has  blocked   new   inbound
                   requests.

     EDIST         Outbound requests are currently blocked.

     EDIST         The server has a  release level of Distrib-
                   uted Services that  cannot communicate with
                   this node.

     EAGAIN        The  server  is  too  busy  to  accept  the
                   request.

     ENOMEM        Either  this node  or the  server does  not
                   have enough memory available to service the
                   request.

     ENOCONNECT    An attempt to establish  a new network con-
                   nection with a remote node failed.

     EBADCONNECT   An attempt to use  an existing network con-
                   nection with a remote node failed.

Related Information

     In this book:  "mount,"  "vmount," and "master."

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