__mount() — Make a file system available

Standards

Standards / Extensions C or C++ Dependencies
z/OS® UNIX both OS/390® V2R9

Format

#define _OPEN_SYS
#include <sys/stat.h>
#include <sys/mntent.h>

int __mount(struct mnte2 *mnte, char *sysname);

General description

Adds a file system to the hierarchical file system. The same file system cannot be mounted at more than one place in the hierarchical file system.

In order to mount a file system, the caller must be an authorized program or must be running for a user with appropriate privileges.

Element descriptions

To mount or change the mount of an HFS file in a sysplex, the application should set values in mnte as follows:

mnt2h_cbid
The mnte2 control block ID. Initialize it to "MNT2".
mnt2h_cblen
The mnte2 size. Initialize it to the size of struct mnte2.
mh2_cursor
Contains the internal cursor. This should be set to 0 initially, and must be left unchanged for subsequent calls.
mnth_devno
This element contains the device number, if needed.
mh_bodylen
The mnte2 size of w_mntent2. Must be initialized to the sizeof the w_mntent2 body.
rsvd
This field must be set to all zeros.
mnt2_fstype
The file system type.
mnt2_mode
File system mount mode. A flag field that specifies the mount mode and additional mount options:
mntentfsaunmount
If it is 1 after the file system is mounted, the file system will be unmounted when a system leaves the sysplex. If it is 0, then the setting of mntentfsnoautomove will be used. See mntentfsnoautomove below. This option can be changed after the file is mounted by changing this bit and setting the request bit, mntentnewauto, to 1 before calling __mount(). If changed to 0, also set mntentfsnoautomove to indicate automove or no move.
mntentfsclient
If it is 0, then the file system is a sysplex client. If it is 1, then the file system is not a sysplex client.
Note: Note that mntentfsclient is not an input parameter.
mntentfsnoautomove
If it is 0 after the file system is mounted, it can be moved automatically. If it is 1 after the file system is mounted, it will not be moved automatically. The mode can be reversed after the file is mounted (when mntentfsaunmount is 0) by changing this bit and setting the request bit, mnte2ntnewauto, to 1 before calling __mount().
Note: The setting of this bit only applies if mntentfsaunmount is 0.
mntentfsmodenosec
If it is 1, then the file system will not enforce security checks. If it is 0, then the file system will enforce security checks.
mntentfsmodeexport
If it is 0, then the file system has not been exported by DFS. If it is 1, then the file system has been exported by DFS.
mntentfsmoderdonly
If it is 0,then the file system is mounted as read/write. If it is 1, then the file system is mounted as read-only.
mntentfsmodenosuid
If it is 1, then the SETUID and SETGID mode flags will be ignored for programs that reside in this file system. If it is 0 then the SETUID and SETGID mode flags will be enforced for programs that reside in this file system. This information is returned by the function but should not be changed.
mnt2_dev
Device # which stat will return for all files in this file system. Not set on input to __mount().
mnt2_parentdev
st_dev of parent file system. Not set on input to __mount().
mnt2_rootino
The ino of the mount point. Not set on input to __mount().
mnt2_status
status of the file system. The field is not an input parameter. It can be tested on output after a successful request.
mnt2_ddname
The ddname specified on mount. 1 to 8 characters are allowed.
mnt2_fstname
The name of the file system type specified by the FILESYS statement. The name for the file system that will perform the mount. This 8-character name must match the TYPE operand on a FILESYSTYPE statement in the BPXPRMxx parmlib member for the file system. 1 to 8 characters are allowed.
mnt2_fsname
The name of the file system to be mounted; it must be unique within the system. For a hierarchical file system (HFS) data set, this is a 1-to-44-character MVS™ data set name specified as all uppercase letters. This name is terminated with NULL characters.
mnt2_pathlen
The length of mount point path.
mnt2_mountpoint
The name of the directory where the file system is mounted. 1 to 1023 characters are allowed. Also refers to the mount point directory where the file system will be mounted.
mnt2_parmoffset
Offset of mount parameter mnt2_parmreturn from mnt2_fstype. Also refers to a parameter passed to the physical file system that performs the mount. This parameter may not be required. The form and content of the parameter are determined by the physical file system. A hierarchical file system (HFS) data set does not require a parameter.
mnt2_parmlen
The length of the mount parameter with size mnt2_parmreturn. Also refers to the length of the parameter argument. The maximum length is 1024 characters. A hierarchical file system data set does not require a parameter.
mnt2_sysname
The name of the target system. 1 to 8 characters are allowed. Changing the target system is always supplied as sysname. For all other calls, sysname must be supplied as NULL or the target name will be changed. When sysname is supplied, the mnte2ntchange flag must be set off for a mount function call, or the mnte2ntchange flag must be set on for a change mount function call. When you specify system on a mount it means mount this file on this system or when you specify system on a change mount it means move the file system from where it is currently mounted to this system.
mnt2_qsystem
The name of the quiesce system. 1 to 8 characters are allowed but the character(s) are padded with blanks and do not contain a NULL terminator. This field is an output only field from getmntent().
mnt2_fromsys
The name of the system from which the file system has moved.
mnt2_flags
The field containing the request flags. A flag field that specifies the change for existing mounted file system:
mnte2ntnewauto
This flag instigates a change of mode which will effect the automove state depending on the value that is set for mnte2ntfsnoautomove. See the explanation under mnte2ntfsnoautomove.
mnte2ntchange
The request in this w_mntent is a change to existing status or mode. This flag must be set on for all change mount requests. The w_mntent structure needs to modify either the mnte2ntfsname field or the mnte2ntmountpoint and mnte2ndpathlen fields. When the request is to mount a directory, then this flag must be set to off.
mnt2_status2
The file system status extensions.
mnt2_success
This field is used to return the number of successfully moved file systems when moving a collection of file systems. It is not used in other cases.
parm_point
This field contains the mountpoint parameters to be used when mounting a file system. It is a separate field in the mnte2 structure but contiguiously allocated following the w_mnte2 body. The mnt2_parmoffset field contains the offset to the start of parm_point.
mnt2_syslistlength
Length of system list.
mnt2_syslistoffset
Offset of system list.
mnt2_aggnamelength
Length of the aggregate name in mnt2_aggname. The length does not include the NULL terminating character, and is only valid if mnt2_aggnameoffset has a non-zero value.
mnt2_aggnameoffset
The offset of mnt2_aggname from w_mntent. If the value is zero, then no aggregate name is returned.

The mnte3 structure can also be used in place of the mnte2 structure. The following mnte3 fields are equivalent to their mnte2 counterparts, with appropriate changes to the header fields to specify the usage of the mnte3 structure:

mnt3h_cbid
The mnte3 control block ID. Initialize it to "MNT3".
mnt3h_cblen
The mnte3 size. Initialize to the size of struct mnte3.
mh3_cursor
mh3_devno
mh_bodylen
The mnte3 size of w_mntent3. Must be initialized to the sizeof the w_mntent3 body.
rsvd
mnt3_fstype
mnt3_mode
mnt3_dev
mnt3_parentdev
mnt3_rootino
mnt3_status
mnt3_ddname
mnt3_fstname
mnt3_fsname
mnt3_pathlen
mnt3_mountpoint
mnt3_parmoffset
mnt3_parmlen
mnt3_sysname
mnt3_qsysname
mnt3_fromsys
mnt3_flags
mnt3_status2
mnt3_success

Returned value

If successful, __mount() returns 0.

If the __mount() is proceeding asynchronously, it returns 1.

If unsuccessful, __mount() returns -1 and sets errno to one of the following values:
Error Code
Description
EBUSY
The specified file system is unavailable.
EINVAL
A parameter was incorrectly specified. Verify filesystype and mtm. Another possible reason for this error is that the mount point is the root of a file system or that the file system is already mounted.
EIO
An I/O error occurred.
ELOOP
A loop exists in symbolic links. This error is issued if more than POSIX_SYMLOOP (defined in the limits.h header file) symbolic links are detected in the resolution of pathname.
ENOENT
The mount point does not exist.
ENOMEM
There is not enough storage available to save the information required for this file system.
ENOTDIR
The mount point is not a directory.
EPERM
Appropriate authority is required to issue a mount.

Related information