MOUNTCTL(2)

NAME
mountctl - execute a mount control operation

LIBRARY
libc

SYNOPSIS
#include <sys/mountctl.h>
int
mountctl(const char *path, int op, int fd, void *ctl, int ctllen, void *buf, int buflen);

DESCRIPTION
The mountctl() system call executes the mount control operation op on the mount point path. An optional file descriptor fd can be passed, or set to -1 if unneeded. The ctl argument is for passing operation specific data and usually points to some struct (see CONTROL OPERATIONS for further information). The data's size is specified by ctllen. The buf and buflen arguments are used if the operation needs to return data to the caller or set to NULL and 0 if unused.

CONTROL OPERATIONS
The following operations are defined in <sys/mountctl.h>:

MOUNTCTL_SET_EXPORT
    Set export control of a filesystem. This operation needs a struct export_args passed in ctl. Note that export control for numerous filesystems may still only be settable with mount(2). New software should attempt to use mountctl() before using the old mount(2) method.

MOUNTCTL_INSTALL_VFS_JOURNAL
    Install a journal on a mount point. This operation needs a struct mountctl_install_journal passed in ctl. The journal file must be specified via fd. A mount point may have multiple journals attached to it.

MOUNTCTL_REMOVE_VFS_JOURNAL
    Disassociate a journal from a mount point. This operation needs a struct mountctl_remove_journal passed in ctl.

MOUNTCTL_RESTART_VFS_JOURNAL
    Restart a journal with a new descriptor. This operation needs a struct mountctl_restart_journal passed in ctl. The journal file must be specified via fd.

MOUNTCTL_STATUS_VFS_JOURNAL
    Return a journal's status. This operation needs a struct mountctl_status_journal passed in ctl and an array of struct mountctl_journal_ret_status in buf.

MOUNTCTL_MOUNTFLAGS
    It will store a comma separated string buffer in the buf parameter with the name list of the currently set user mount flags. The buf will be sized at most buflen bytes.

RETURN VALUES
Upon successful completion, the number of copied bytes is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

ERRORS
The mountctl() function will fail when one of the following occurs:

[EBADF]
    Fd is not an active descriptor.

[EINVAL]
    The specified ctllen is not 0-1024, buflen is not 0-16384, or path is NULL.

[EPERM]
    The caller is not the super-user.

SEE ALSO
mount(2), mountctl(8)

HISTORY
The mountctl() system call first appeared in DragonFly 1.1.

AUTHORS
-nosplit The mountctl() system call was written by Matthew Dillon and this manual page was written by Sascha Wildner.