|
Kmods SIG |
8b815c |
From 15b2ae776044ac52cddda8a3e6c9fecd15226b8c Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
8b815c |
From: Kari Argillander <kari.argillander@gmail.com>
|
|
Kmods SIG |
8b815c |
Date: Tue, 7 Sep 2021 18:35:57 +0300
|
|
Kmods SIG |
8b815c |
Subject: [Backport 15b2ae776044] src: Show uid/gid always in
|
|
Kmods SIG |
8b815c |
show_options()
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
Show options should show option according documentation when some value
|
|
Kmods SIG |
8b815c |
is not default or when ever coder wants. Uid/gid are problematic because
|
|
Kmods SIG |
8b815c |
it is hard to know which are defaults. In file system there is many
|
|
Kmods SIG |
8b815c |
different implementation for this problem.
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
Some file systems show uid/gid when they are different than root, some
|
|
Kmods SIG |
8b815c |
when user has set them and some show them always. There is also problem
|
|
Kmods SIG |
8b815c |
that what if root uid/gid change. This code just choose to show them
|
|
Kmods SIG |
8b815c |
always. This way we do not need to think this any more.
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
|
|
Kmods SIG |
8b815c |
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
|
|
Kmods SIG |
8b815c |
---
|
|
Kmods SIG |
8b815c |
src/ntfs_fs.h | 23 ++++++++++-------------
|
|
Kmods SIG |
8b815c |
src/super.c | 12 ++++--------
|
|
Kmods SIG |
8b815c |
2 files changed, 14 insertions(+), 21 deletions(-)
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
diff --git a/src/ntfs_fs.h b/src/ntfs_fs.h
|
|
Kmods SIG |
8b815c |
index 15bab48bc1ad13a9bc93d365ce92c8978635ec2b..372cda697dd4c587a82ed6381a1dd512b700d5c1 100644
|
|
Kmods SIG |
8b815c |
--- a/src/ntfs_fs.h
|
|
Kmods SIG |
8b815c |
+++ b/src/ntfs_fs.h
|
|
Kmods SIG |
8b815c |
@@ -60,19 +60,16 @@ struct ntfs_mount_options {
|
|
Kmods SIG |
8b815c |
u16 fs_fmask_inv;
|
|
Kmods SIG |
8b815c |
u16 fs_dmask_inv;
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
- unsigned uid : 1, /* uid was set. */
|
|
Kmods SIG |
8b815c |
- gid : 1, /* gid was set. */
|
|
Kmods SIG |
8b815c |
- fmask : 1, /* fmask was set. */
|
|
Kmods SIG |
8b815c |
- dmask : 1, /* dmask was set. */
|
|
Kmods SIG |
8b815c |
- sys_immutable : 1, /* Immutable system files. */
|
|
Kmods SIG |
8b815c |
- discard : 1, /* Issue discard requests on deletions. */
|
|
Kmods SIG |
8b815c |
- sparse : 1, /* Create sparse files. */
|
|
Kmods SIG |
8b815c |
- showmeta : 1, /* Show meta files. */
|
|
Kmods SIG |
8b815c |
- nohidden : 1, /* Do not show hidden files. */
|
|
Kmods SIG |
8b815c |
- force : 1, /* Rw mount dirty volume. */
|
|
Kmods SIG |
8b815c |
- noacsrules : 1, /*Exclude acs rules. */
|
|
Kmods SIG |
8b815c |
- prealloc : 1 /* Preallocate space when file is growing. */
|
|
Kmods SIG |
8b815c |
- ;
|
|
Kmods SIG |
8b815c |
+ unsigned fmask : 1; /* fmask was set. */
|
|
Kmods SIG |
8b815c |
+ unsigned dmask : 1; /*dmask was set. */
|
|
Kmods SIG |
8b815c |
+ unsigned sys_immutable : 1; /* Immutable system files. */
|
|
Kmods SIG |
8b815c |
+ unsigned discard : 1; /* Issue discard requests on deletions. */
|
|
Kmods SIG |
8b815c |
+ unsigned sparse : 1; /* Create sparse files. */
|
|
Kmods SIG |
8b815c |
+ unsigned showmeta : 1; /* Show meta files. */
|
|
Kmods SIG |
8b815c |
+ unsigned nohidden : 1; /* Do not show hidden files. */
|
|
Kmods SIG |
8b815c |
+ unsigned force : 1; /* RW mount dirty volume. */
|
|
Kmods SIG |
8b815c |
+ unsigned noacsrules : 1; /* Exclude acs rules. */
|
|
Kmods SIG |
8b815c |
+ unsigned prealloc : 1; /* Preallocate space when file is growing. */
|
|
Kmods SIG |
8b815c |
};
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
/* Special value to unpack and deallocate. */
|
|
Kmods SIG |
8b815c |
diff --git a/src/super.c b/src/super.c
|
|
Kmods SIG |
8b815c |
index 0690e7e4f00de4e6c89cacebdb4862bbb8f00bc6..3cba0b5e7ac72c444a55de38b791faa87732049f 100644
|
|
Kmods SIG |
8b815c |
--- a/src/super.c
|
|
Kmods SIG |
8b815c |
+++ b/src/super.c
|
|
Kmods SIG |
8b815c |
@@ -294,13 +294,11 @@ static int ntfs_fs_parse_param(struct fs_context *fc,
|
|
Kmods SIG |
8b815c |
opts->fs_uid = make_kuid(current_user_ns(), result.uint_32);
|
|
Kmods SIG |
8b815c |
if (!uid_valid(opts->fs_uid))
|
|
Kmods SIG |
8b815c |
return invalf(fc, "ntfs3: Invalid value for uid.");
|
|
Kmods SIG |
8b815c |
- opts->uid = 1;
|
|
Kmods SIG |
8b815c |
break;
|
|
Kmods SIG |
8b815c |
case Opt_gid:
|
|
Kmods SIG |
8b815c |
opts->fs_gid = make_kgid(current_user_ns(), result.uint_32);
|
|
Kmods SIG |
8b815c |
if (!gid_valid(opts->fs_gid))
|
|
Kmods SIG |
8b815c |
return invalf(fc, "ntfs3: Invalid value for gid.");
|
|
Kmods SIG |
8b815c |
- opts->gid = 1;
|
|
Kmods SIG |
8b815c |
break;
|
|
Kmods SIG |
8b815c |
case Opt_umask:
|
|
Kmods SIG |
8b815c |
if (result.uint_32 & ~07777)
|
|
Kmods SIG |
8b815c |
@@ -521,12 +519,10 @@ static int ntfs_show_options(struct seq_file *m, struct dentry *root)
|
|
Kmods SIG |
8b815c |
struct ntfs_mount_options *opts = sbi->options;
|
|
Kmods SIG |
8b815c |
struct user_namespace *user_ns = seq_user_ns(m);
|
|
Kmods SIG |
8b815c |
|
|
Kmods SIG |
8b815c |
- if (opts->uid)
|
|
Kmods SIG |
8b815c |
- seq_printf(m, ",uid=%u",
|
|
Kmods SIG |
8b815c |
- from_kuid_munged(user_ns, opts->fs_uid));
|
|
Kmods SIG |
8b815c |
- if (opts->gid)
|
|
Kmods SIG |
8b815c |
- seq_printf(m, ",gid=%u",
|
|
Kmods SIG |
8b815c |
- from_kgid_munged(user_ns, opts->fs_gid));
|
|
Kmods SIG |
8b815c |
+ seq_printf(m, ",uid=%u",
|
|
Kmods SIG |
8b815c |
+ from_kuid_munged(user_ns, opts->fs_uid));
|
|
Kmods SIG |
8b815c |
+ seq_printf(m, ",gid=%u",
|
|
Kmods SIG |
8b815c |
+ from_kgid_munged(user_ns, opts->fs_gid));
|
|
Kmods SIG |
8b815c |
if (opts->fmask)
|
|
Kmods SIG |
8b815c |
seq_printf(m, ",fmask=%04o", ~opts->fs_fmask_inv);
|
|
Kmods SIG |
8b815c |
if (opts->dmask)
|
|
Kmods SIG |
8b815c |
--
|
|
Kmods SIG |
8b815c |
2.31.1
|
|
Kmods SIG |
8b815c |
|