From: "Namjae Jeon" <namjae.jeon@samsung.com>
To: "'Nikolay Borisov'" <nborisov@suse.com>
Cc: <gregkh@linuxfoundation.org>, <valdis.kletnieks@vt.edu>,
<hch@lst.de>, <linkinjeon@gmail.com>, <Markus.Elfring@web.de>,
<sj1557.seo@samsung.com>, <linux-kernel@vger.kernel.org>,
<linux-fsdevel@vger.kernel.org>
Subject: RE: [PATCH v2 05/13] exfat: add file operations
Date: Thu, 21 Nov 2019 10:42:13 +0900 [thread overview]
Message-ID: <00d201d5a00c$e6273ac0$b275b040$@samsung.com> (raw)
In-Reply-To: <398eeca9-e59f-385b-791d-561e56567026@suse.com>
> > +static int exfat_allow_set_time(struct exfat_sb_info *sbi, struct inode
> *inode)
> > +{
> > + mode_t allow_utime = sbi->options.allow_utime;
> > +
> > + if (!uid_eq(current_fsuid(), inode->i_uid)) {
> > + if (in_group_p(inode->i_gid))
> > + allow_utime >>= 3;
> > + if (allow_utime & MAY_WRITE)
> > + return 1;
> > + }
> > +
> > + /* use a default check */
> > + return 0;
>
> this function can be made to return bool.
Okay.
>
> > +}
> > +
>
> <snip>
>
> > +/* resize the file length */
> > +int __exfat_truncate(struct inode *inode, loff_t new_size)
> > +{
> > + unsigned int num_clusters_new, num_clusters_phys;
> > + unsigned int last_clu = FREE_CLUSTER;
> > + struct exfat_chain clu;
> > + struct exfat_timestamp tm;
> > + struct exfat_dentry *ep, *ep2;
> > + struct super_block *sb = inode->i_sb;
> > + struct exfat_sb_info *sbi = EXFAT_SB(sb);
> > + struct exfat_inode_info *ei = EXFAT_I(inode);
> > + struct exfat_entry_set_cache *es = NULL;
> > + int evict = (ei->dir.dir == DIR_DELETED) ? 1 : 0;
> > +
> > + /* check if the given file ID is opened */
> > + if (ei->type != TYPE_FILE && ei->type != TYPE_DIR)
> > + return -EPERM;
> > +
> > + exfat_set_vol_flags(sb, VOL_DIRTY);
> > +
> > + num_clusters_new = EXFAT_B_TO_CLU_ROUND_UP(i_size_read(inode), sbi);
> > + num_clusters_phys =
> > + EXFAT_B_TO_CLU_ROUND_UP(EXFAT_I(inode)->i_size_ondisk, sbi);
> > +
> > + exfat_chain_set(&clu, ei->start_clu, num_clusters_phys, ei->flags);
> > +
> > + if (new_size > 0) {
> > + /*
> > + * Truncate FAT chain num_clusters after the first cluster
> > + * num_clusters = min(new, phys);
> > + */
> > + unsigned int num_clusters =
> > + min(num_clusters_new, num_clusters_phys);
> > +
> > + /*
> > + * Follow FAT chain
> > + * (defensive coding - works fine even with corrupted FAT table
> > + */
> > + if (clu.flags == 0x03) {
>
> That 0x03 is magic constant, better define actual flags and check
> clu.flag == (FLAG1|FLAG2)
Okay, Will fix it on v4.
Thanks for your review!
next prev parent reply other threads:[~2019-11-21 1:42 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20191119071401epcas1p4a42c781276e89928a24d53379fe13d64@epcas1p4.samsung.com>
2019-11-19 7:10 ` [PATCH v2 00/13] add the latest exfat driver Namjae Jeon
2019-11-19 7:10 ` [PATCH v2 01/13] exfat: add in-memory and on-disk structures and headers Namjae Jeon
2019-11-20 9:22 ` Nikolay Borisov
2019-11-19 7:10 ` [PATCH v2 02/13] exfat: add super block operations Namjae Jeon
2019-11-19 8:56 ` Daniel Wagner
2019-11-19 9:22 ` Namjae Jeon
2019-11-19 17:17 ` Christoph Hellwig
2019-11-20 4:33 ` Namjae Jeon
2019-11-19 7:10 ` [PATCH v2 03/13] exfat: add inode operations Namjae Jeon
2019-11-19 7:10 ` [PATCH v2 04/13] exfat: add directory operations Namjae Jeon
2019-11-19 7:10 ` [PATCH v2 05/13] exfat: add file operations Namjae Jeon
2019-11-20 9:14 ` Nikolay Borisov
2019-11-21 1:42 ` Namjae Jeon [this message]
2019-11-21 3:18 ` Valdis Klētnieks
2019-11-21 3:39 ` Namjae Jeon
2019-11-19 7:11 ` [PATCH v2 06/13] exfat: add exfat entry operations Namjae Jeon
2019-11-20 9:19 ` Nikolay Borisov
2019-11-19 7:11 ` [PATCH v2 07/13] exfat: add bitmap operations Namjae Jeon
2019-11-20 9:24 ` Nikolay Borisov
2019-11-19 7:11 ` [PATCH v2 08/13] exfat: add exfat cache Namjae Jeon
2019-11-19 7:11 ` [PATCH v2 09/13] exfat: add misc operations Namjae Jeon
2020-01-08 19:53 ` Arnd Bergmann
2020-01-09 23:35 ` Namjae Jeon
2019-11-19 7:11 ` [PATCH v2 10/13] exfat: add nls operations Namjae Jeon
2019-11-19 7:11 ` [PATCH v2 11/13] exfat: add Kconfig and Makefile Namjae Jeon
2019-11-19 7:11 ` [PATCH v2 12/13] exfat: add exfat in fs/Kconfig and fs/Makefile Namjae Jeon
2019-11-19 7:11 ` [PATCH v2 13/13] MAINTAINERS: add exfat filesystem Namjae Jeon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='00d201d5a00c$e6273ac0$b275b040$@samsung.com' \
--to=namjae.jeon@samsung.com \
--cc=Markus.Elfring@web.de \
--cc=gregkh@linuxfoundation.org \
--cc=hch@lst.de \
--cc=linkinjeon@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nborisov@suse.com \
--cc=sj1557.seo@samsung.com \
--cc=valdis.kletnieks@vt.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.