/* Header file for mounting/unmount Linux filesystems. Copyright (C) 1996-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see . */ /* This is taken from /usr/include/linux/fs.h. */ #ifndef _SYS_MOUNT_H #define _SYS_MOUNT_H 1 #include #include #include #include #include #ifdef __has_include # if __has_include ("linux/mount.h") # include "linux/mount.h" # endif #endif #define BLOCK_SIZE_BITS 10 #define BLOCK_SIZE (1<= 36) || __GLIBC__ > 2 #ifndef FSOPEN_CLOEXEC /* The type of fsconfig call made. */ enum fsconfig_command { FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */ # define FSCONFIG_SET_FLAG FSCONFIG_SET_FLAG FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */ # define FSCONFIG_SET_STRING FSCONFIG_SET_STRING FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */ # define FSCONFIG_SET_BINARY FSCONFIG_SET_BINARY FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */ # define FSCONFIG_SET_PATH FSCONFIG_SET_PATH FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */ # define FSCONFIG_SET_PATH_EMPTY FSCONFIG_SET_PATH_EMPTY FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */ # define FSCONFIG_SET_FD FSCONFIG_SET_FD FSCONFIG_CMD_CREATE = 6, /* Invoke superblock creation */ # define FSCONFIG_CMD_CREATE FSCONFIG_CMD_CREATE FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */ # define FSCONFIG_CMD_RECONFIGURE FSCONFIG_CMD_RECONFIGURE FSCONFIG_CMD_CREATE_EXCL = 8, /* Create new superblock, fail if reusing existing superblock */ # define FSCONFIG_CMD_CREATE_EXCL FSCONFIG_CMD_CREATE_EXCL }; #endif /* fsopen flags. */ #define FSOPEN_CLOEXEC 0x00000001 /* open_tree flags. */ #define OPEN_TREE_CLONE 1 /* Clone the target tree and attach the clone */ #define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */ #endif __BEGIN_DECLS /* Mount a filesystem. */ extern int mount (const char *__special_file, const char *__dir, const char *__fstype, unsigned long int __rwflag, const void *__data) __THROW; /* Unmount a filesystem. */ extern int umount (const char *__special_file) __THROW; /* Unmount a filesystem. Force unmounting if FLAGS is set to MNT_FORCE. */ extern int umount2 (const char *__special_file, int __flags) __THROW; // zig patch: check target glibc version #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 36) || __GLIBC__ > 2 /* Open the filesystem referenced by FS_NAME so it can be configured for mouting. */ extern int fsopen (const char *__fs_name, unsigned int __flags) __THROW; /* Create a mount representation for the FD created by fsopen using FLAGS with ATTR_FLAGS describing how the mount is to be performed. */ extern int fsmount (int __fd, unsigned int __flags, unsigned int __ms_flags) __THROW; /* Add the mounted FROM_DFD referenced by FROM_PATHNAME filesystem returned by fsmount in the hierarchy in the place TO_DFD reference by TO_PATHNAME using FLAGS. */ extern int move_mount (int __from_dfd, const char *__from_pathname, int __to_dfd, const char *__to_pathname, unsigned int flags) __THROW; /* Set parameters and trigger CMD action on the FD context. KEY, VALUE, and AUX are used depending ng of the CMD. */ extern int fsconfig (int __fd, unsigned int __cmd, const char *__key, const void *__value, int __aux) __THROW; /* Equivalent of fopen for an existing mount point. */ extern int fspick (int __dfd, const char *__path, unsigned int __flags) __THROW; /* Open the mount point FILENAME in directory DFD using FLAGS. */ extern int open_tree (int __dfd, const char *__filename, unsigned int __flags) __THROW; /* Change the mount properties of the mount or an entire mount tree. If PATH is a relative pathname, then it is interpreted relative to the directory referred to by the file descriptor dirfd. Otherwise if DFD is the special value AT_FDCWD then PATH is interpreted relative to the current working directory of the calling process. */ extern int mount_setattr (int __dfd, const char *__path, unsigned int __flags, struct mount_attr *__uattr, size_t __usize) __THROW; #endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 36) || __GLIBC__ > 2 */ __END_DECLS #endif /* _SYS_MOUNT_H */