RE: [PATCH v6 05/10] fs/ntfs3: Add attrib operations

From: Konstantin Komarov
Date: Fri Sep 25 2020 - 12:12:13 EST


From: Mark Harmstone <mark.harmstone@xxxxxxxxx> On Behalf Of Mark Harmstone
Sent: Friday, September 18, 2020 9:28 PM
>
> Could I suggest that system.ntfs_security be renamed to security.NTACL? That's
> what WinBtrfs uses, and it means you'd be able to create a working Btrfs copy
> of a Windows installation just by using rsync. IIRC Samba also understands
> xattrs called security.NTACL, when you've put it in the right mode.
>
> Quite apart from anything else, it's an NT security descriptor, not specifically
> NTFS - I'm fairly sure ReFS uses the same format (for what it's worth).
>

Hi Mark! Seems reasonable. Will be changed in V8.

> On 18/9/20 5:21 pm, Konstantin Komarov wrote:
> > This adds attrib operations
> >
> > Signed-off-by: Konstantin Komarov <almaz.alexandrovich@xxxxxxxxxxxxxxxxxxxx>
> > ---
> > fs/ntfs3/attrib.c | 1312 +++++++++++++++++++++++++++++++++++++++++++
> > fs/ntfs3/attrlist.c | 462 +++++++++++++++
> > fs/ntfs3/xattr.c | 1041 ++++++++++++++++++++++++++++++++++
> > 3 files changed, 2815 insertions(+)
> > create mode 100644 fs/ntfs3/attrib.c
> > create mode 100644 fs/ntfs3/attrlist.c
> > create mode 100644 fs/ntfs3/xattr.c
[]
> > + if (err < 0)
> > + goto out1;
> > + if (!err) {
> > + posix_acl_release(acl);
> > + acl = NULL;
> > + }
> > +
> > + if (!S_ISDIR(inode->i_mode)) {
> > + posix_acl_release(default_acl);
> > + default_acl = NULL;
> > + }
> > +
> > + if (default_acl)
> > + err = ntfs_set_acl_ex(inode, default_acl, ACL_TYPE_DEFAULT, 1);
> > +
> > + if (!acl)
> > + inode->i_acl = NULL;
> > + else if (!err)
> > + err = ntfs_set_acl_ex(inode, acl, ACL_TYPE_ACCESS, 1);
> > +
> > + posix_acl_release(acl);
> > +out1:
> > + posix_acl_release(default_acl);
> > +
> > +out:
> > + return err;
> > +}
> > +
> > +static bool ntfs_xattr_user_list(struct dentry *dentry)
> > +{
> > + return 1;
> > +}
> > +
> > +static const struct xattr_handler ntfs_xattr_handler = {
> > + .prefix = "",
> > + .get = ntfs_getxattr,
> > + .set = ntfs_setxattr,
> > + .list = ntfs_xattr_user_list,
> > +};
> > +
> > +const struct xattr_handler *ntfs_xattr_handlers[] = { &ntfs_xattr_handler,
> > + NULL };
>

Thanks.