mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ernesto A. Fernández" <ernesto.mnd.fernandez@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	Andrew Morton <akpm@linux-foundation.org>,
	y2038@lists.linaro.org, Vyacheslav Dubeyko <slava@dubeyko.com>,
	Deepa Dinamani <deepa.kernel@gmail.com>, Jan Kara <jack@suse.cz>,
	Jeff Layton <jlayton@redhat.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Ernesto A. Fernandez" <ernesto.mnd.fernandez@gmail.com>
Subject: Re: [PATCH 3/3] hfsplus: return inode birthtime for statx
Date: Wed, 20 Jun 2018 19:45:54 -0300	[thread overview]
Message-ID: <20180620224553.wfz6abuvvz4ul42d@eaf> (raw)
In-Reply-To: <20180619160223.4108556-3-arnd@arndb.de>

Hi:

On Tue, Jun 19, 2018 at 06:02:09PM +0200, Arnd Bergmann wrote:
> We have the data in the kernel, so we might just as well provide it to
> user space.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  fs/hfsplus/dir.c        |  1 +
>  fs/hfsplus/hfsplus_fs.h |  2 ++
>  fs/hfsplus/inode.c      | 14 ++++++++++++++
>  3 files changed, 17 insertions(+)
> 
> diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
> index b5254378f011..df14b6dd5b5a 100644
> --- a/fs/hfsplus/dir.c
> +++ b/fs/hfsplus/dir.c
> @@ -566,6 +566,7 @@ const struct inode_operations hfsplus_dir_inode_operations = {
>  	.symlink		= hfsplus_symlink,
>  	.mknod			= hfsplus_mknod,
>  	.rename			= hfsplus_rename,
> +	.getattr		= hfsplus_getattr,
>  	.listxattr		= hfsplus_listxattr,
>  #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL
>  	.get_acl		= hfsplus_get_posix_acl,
> diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
> index 646c207be38d..1a6b469f8d22 100644
> --- a/fs/hfsplus/hfsplus_fs.h
> +++ b/fs/hfsplus/hfsplus_fs.h
> @@ -489,6 +489,8 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd);
>  int hfsplus_cat_write_inode(struct inode *inode);
>  int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
>  		       int datasync);
> +int hfsplus_getattr(const struct path *path, struct kstat *stat,
> +		    u32 request_mask, unsigned int query_flags);
>  
>  /* ioctl.c */
>  long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
> diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
> index c0c8d433864f..f9bb568f9479 100644
> --- a/fs/hfsplus/inode.c
> +++ b/fs/hfsplus/inode.c
> @@ -276,6 +276,19 @@ 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_backing_inode(path->dentry);

I think d_inode() is better. They work the same, but "normal filesystems
should not use this", according to the d_backing_inode() documentation.

> +
> +	generic_fillattr(inode, stat);
> +
> +	stat->btime = hfsp_mt2ut(HFSPLUS_I(inode)->create_date);
> +	stat->result_mask |= STATX_BTIME;
> +
> +	return 0;
> +}
> +
>  int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
>  		       int datasync)
>  {
> @@ -335,6 +348,7 @@ int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end,
>  
>  static const struct inode_operations hfsplus_file_inode_operations = {
>  	.setattr	= hfsplus_setattr,
> +	.getattr	= hfsplus_getattr,
>  	.listxattr	= hfsplus_listxattr,
>  #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL
>  	.get_acl	= hfsplus_get_posix_acl,
> -- 
> 2.9.0
> 

What about symlinks and special files?

Thanks,
Ernest

  reply	other threads:[~2018-06-20 22:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-19 16:02 [PATCH 1/3] hfs: stop using timespec based interfaces Arnd Bergmann
2018-06-19 16:02 ` [PATCH 2/3] hfsplus: " Arnd Bergmann
2018-06-24  3:11   ` Ernesto A. Fernández
2018-06-19 16:02 ` [PATCH 3/3] hfsplus: return inode birthtime for statx Arnd Bergmann
2018-06-20 22:45   ` Ernesto A. Fernández [this message]
2018-06-22 14:32     ` Arnd Bergmann
2018-06-19 17:03 ` [PATCH 1/3] hfs: stop using timespec based interfaces Viacheslav Dubeyko
2018-06-19 19:42   ` Arnd Bergmann
2018-06-20 16:55     ` Viacheslav Dubeyko
2018-06-20 19:55       ` Arnd Bergmann
2018-06-22 14:19         ` Arnd Bergmann
2018-07-31 23:37 ` Ernesto A. Fernández

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=20180620224553.wfz6abuvvz4ul42d@eaf \
    --to=ernesto.mnd.fernandez@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=deepa.kernel@gmail.com \
    --cc=jack@suse.cz \
    --cc=jlayton@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=slava@dubeyko.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=y2038@lists.linaro.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

all inboxes | Powered by JetHome®