mirror of
https://git.FreeBSD.org/src.git
synced 2025-02-07 18:54:21 +00:00
linux(4): Convert mount exported flags for statfs system calls.
MFC after: 1 week
This commit is contained in:
parent
953688e823
commit
9922bccbc9
@ -264,6 +264,21 @@ struct l_statx {
|
||||
uint64_t __spare2[13];
|
||||
};
|
||||
|
||||
/*
|
||||
* statfs f_flags
|
||||
*/
|
||||
#define LINUX_ST_RDONLY 0x0001
|
||||
#define LINUX_ST_NOSUID 0x0002
|
||||
#define LINUX_ST_NODEV 0x0004 /* No native analogue */
|
||||
#define LINUX_ST_NOEXEC 0x0008
|
||||
#define LINUX_ST_SYNCHRONOUS 0x0010
|
||||
#define LINUX_ST_VALID 0x0020
|
||||
#define LINUX_ST_MANDLOCK 0x0040 /* No native analogue */
|
||||
#define LINUX_ST_NOATIME 0x0400
|
||||
#define LINUX_ST_NODIRATIME 0x0800 /* No native analogue */
|
||||
#define LINUX_ST_RELATIME 0x1000 /* No native analogue */
|
||||
#define LINUX_ST_NOSYMFOLLOW 0x2000
|
||||
|
||||
#define lower_32_bits(n) ((uint32_t)((n) & 0xffffffff))
|
||||
|
||||
#ifdef KTRACE
|
||||
|
@ -410,6 +410,27 @@ bsd_to_linux_ftype(const char *fstypename)
|
||||
return (0L);
|
||||
}
|
||||
|
||||
static int
|
||||
bsd_to_linux_mnt_flags(int f_flags)
|
||||
{
|
||||
int flags = LINUX_ST_VALID;
|
||||
|
||||
if (f_flags & MNT_RDONLY)
|
||||
flags |= LINUX_ST_RDONLY;
|
||||
if (f_flags & MNT_NOEXEC)
|
||||
flags |= LINUX_ST_NOEXEC;
|
||||
if (f_flags & MNT_NOSUID)
|
||||
flags |= LINUX_ST_NOSUID;
|
||||
if (f_flags & MNT_NOATIME)
|
||||
flags |= LINUX_ST_NOATIME;
|
||||
if (f_flags & MNT_NOSYMFOLLOW)
|
||||
flags |= LINUX_ST_NOSYMFOLLOW;
|
||||
if (f_flags & MNT_SYNCHRONOUS)
|
||||
flags |= LINUX_ST_SYNCHRONOUS;
|
||||
|
||||
return (flags);
|
||||
}
|
||||
|
||||
static int
|
||||
bsd_to_linux_statfs(struct statfs *bsd_statfs, struct l_statfs *linux_statfs)
|
||||
{
|
||||
@ -433,7 +454,7 @@ bsd_to_linux_statfs(struct statfs *bsd_statfs, struct l_statfs *linux_statfs)
|
||||
linux_statfs->f_fsid.val[1] = bsd_statfs->f_fsid.val[1];
|
||||
linux_statfs->f_namelen = MAXNAMLEN;
|
||||
linux_statfs->f_frsize = bsd_statfs->f_bsize;
|
||||
linux_statfs->f_flags = 0;
|
||||
linux_statfs->f_flags = bsd_to_linux_mnt_flags(bsd_statfs->f_flags);
|
||||
memset(linux_statfs->f_spare, 0, sizeof(linux_statfs->f_spare));
|
||||
|
||||
return (0);
|
||||
@ -480,7 +501,7 @@ bsd_to_linux_statfs64(struct statfs *bsd_statfs, struct l_statfs64 *linux_statfs
|
||||
linux_statfs->f_fsid.val[1] = bsd_statfs->f_fsid.val[1];
|
||||
linux_statfs->f_namelen = MAXNAMLEN;
|
||||
linux_statfs->f_frsize = bsd_statfs->f_bsize;
|
||||
linux_statfs->f_flags = 0;
|
||||
linux_statfs->f_flags = bsd_to_linux_mnt_flags(bsd_statfs->f_flags);
|
||||
memset(linux_statfs->f_spare, 0, sizeof(linux_statfs->f_spare));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user