linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ernesto A. Fernández" <ernesto.mnd.fernandez@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] hfsplus: return file attributes on statx
Date: Sat, 10 Nov 2018 00:26:34 -0300	[thread overview]
Message-ID: <20181110032634.kg4cgqee72wjzceo@eaf> (raw)
In-Reply-To: <20181109142630.33f18bf16f7d4d1684c1795d@linux-foundation.org>

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@gmail.com> 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;
> > +}
> 
> 

      parent reply	other threads:[~2018-11-10 13:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-14 16:35 [PATCH] hfsplus: return file attributes on statx Ernesto A. Fernández
2018-10-16  0:26 ` Viacheslav Dubeyko
2018-10-16 23:38   ` Ernesto A. Fernández
2018-10-17  0:07     ` Viacheslav Dubeyko
2018-10-17  1:02       ` Ernesto A. Fernández
     [not found] ` <20181109142630.33f18bf16f7d4d1684c1795d@linux-foundation.org>
2018-11-10  3:26   ` Ernesto A. Fernández [this message]

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=20181110032634.kg4cgqee72wjzceo@eaf \
    --to=ernesto.mnd.fernandez@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).