Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Commit

Permalink
exfat: implement "quiet" option for setattr
Browse files Browse the repository at this point in the history
Signed-off-by: Park Ju Hyung <[email protected]>
  • Loading branch information
arter97 committed Jun 26, 2020
1 parent 53500c7 commit 0db4ba7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions exfat_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ struct exfat_mount_options {
unsigned short allow_utime;
/* charset for filename input/display */
char *iocharset;
/* fake return success on setattr(e.g. chmods/chowns) */
unsigned char quiet;
/* on error: continue, panic, remount-ro */
enum exfat_error_mode errors;
unsigned utf8:1, /* Use of UTF-8 character set */
Expand Down
13 changes: 11 additions & 2 deletions file.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ int exfat_setattr(struct dentry *dentry, struct iattr *attr)
attr->ia_size > i_size_read(inode)) {
error = exfat_cont_expand(inode, attr->ia_size);
if (error || attr->ia_valid == ATTR_SIZE)
return error;
goto out;
attr->ia_valid &= ~ATTR_SIZE;
}

Expand All @@ -317,8 +317,11 @@ int exfat_setattr(struct dentry *dentry, struct iattr *attr)

error = setattr_prepare(dentry, attr);
attr->ia_valid = ia_valid;
if (error)
if (error) {
if (sbi->options.quiet)
error = 0;
goto out;
}

if (((attr->ia_valid & ATTR_UID) &&
!uid_eq(attr->ia_uid, sbi->options.fs_uid)) ||
Expand All @@ -330,6 +333,12 @@ int exfat_setattr(struct dentry *dentry, struct iattr *attr)
goto out;
}

if (error) {
if (sbi->options.quiet)
error = 0;
goto out;
}

/*
* We don't return -EPERM here. Yes, strange, but this is too
* old behavior.
Expand Down
7 changes: 7 additions & 0 deletions super.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ static int exfat_show_options(struct seq_file *m, struct dentry *root)
seq_printf(m, ",fmask=%04o,dmask=%04o", opts->fs_fmask, opts->fs_dmask);
if (opts->allow_utime)
seq_printf(m, ",allow_utime=%04o", opts->allow_utime);
if (opts->quiet)
seq_puts(m, ",quiet");
if (opts->utf8)
seq_puts(m, ",iocharset=utf8");
else if (sbi->nls_io)
Expand Down Expand Up @@ -203,6 +205,7 @@ enum {
Opt_fmask,
Opt_allow_utime,
Opt_charset,
Opt_quiet,
Opt_err_cont,
Opt_err_panic,
Opt_err_ro,
Expand All @@ -224,6 +227,7 @@ static const match_table_t exfat_tokens = {
{Opt_fmask, "fmask=%o"},
{Opt_allow_utime, "allow_utime=%o"},
{Opt_charset, "iocharset=%s"},
{Opt_quiet, "quiet"},
{Opt_err_cont, "errors=continue"},
{Opt_err_panic, "errors=panic"},
{Opt_err_ro, "errors=remount-ro"},
Expand Down Expand Up @@ -277,6 +281,9 @@ static int __exfat_parse_option(struct super_block *sb, char *p, substring_t *ar
return -ENOMEM;
opts->iocharset = tmpstr;
break;
case Opt_quiet:
opts->quiet = 1;
break;
case Opt_err_cont:
opts->errors = EXFAT_ERRORS_CONT;
break;
Expand Down

0 comments on commit 0db4ba7

Please sign in to comment.