Re: [PATCH] hfsplus: return file attributes on statx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 09, 2018 at 02:26:30PM -0800, Andrew Morton wrote:
> On Sun, 14 Oct 2018 13:35:58 -0300 Ernesto A. Fernández <ernesto.mnd.fernandez@xxxxxxxxx> wrote:
> 
> > The immutable, append-only and no-dump attributes can only be retrieved
> > with an ioctl; implement the ->getattr() method to return them on statx.
> > Do not return the inode birthtime yet, because the issue of how best to
> > handle the post-2038 timestamps is still under discussion.
> > 
> > This patch is needed to pass xfstests generic/424.
> 
> It's been a while since I looked into such things...
> 
> > --- a/fs/hfsplus/inode.c
> > +++ b/fs/hfsplus/inode.c
> > @@ -270,6 +270,26 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr)
> >  	return 0;
> >  }
> >  
> > +int hfsplus_getattr(const struct path *path, struct kstat *stat,
> > +		    u32 request_mask, unsigned int query_flags)
> > +{
> > +	struct inode *inode = d_inode(path->dentry);
> > +	struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
> > +
> > +	if (inode->i_flags & S_APPEND)
> > +		stat->attributes |= STATX_ATTR_APPEND;
> > +	if (inode->i_flags & S_IMMUTABLE)
> > +		stat->attributes |= STATX_ATTR_IMMUTABLE;
> 
> ext4_getattr() inspects the underlying ext4_inode's flags to determine
> the above.  But here hfs is looking at the vfs-level inode.  Which is
> correct, which is best, do we know why they differ, etc?

ext4 is not reading the flags from the ext4_inode directly, it reads them
from ext4_inode_info.  hfsplus_inode_info doesn't have that information
anymore, since 722c55d13e72 ("hfsplus: remove superflous rootflags field in
hfsplus_inode_info").

My intention here was to follow what the FS_IOC_GETFLAGS ioctl is doing, so
I just copied the checks from hfsplus_ioctl_getflags() at ioctl.c.

> 
> > +	if (hip->userflags & HFSPLUS_FLG_NODUMP)
> > +		stat->attributes |= STATX_ATTR_NODUMP;
> > +
> > +	stat->attributes_mask |= STATX_ATTR_APPEND | STATX_ATTR_IMMUTABLE |
> > +				 STATX_ATTR_NODUMP;
> > +
> > +	generic_fillattr(inode, stat);
> > +	return 0;
> > +}
> 
> 



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux