All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: "Jürgen Groß" <jgross@suse.com>
Cc: minios-devel@lists.xenproject.org,
	xen-devel@lists.xenproject.org,
	Jason Andryuk <jason.andryuk@amd.com>
Subject: Re: [MINI-OS PATCH v2 1/2] 9pfs: add fstat file operation hook
Date: Sun, 23 Mar 2025 15:58:16 +0100	[thread overview]
Message-ID: <Z-AhiCM8j--cbLBV@begin> (raw)
In-Reply-To: <79a51a80-7723-4f58-b0ea-25f73d4fd796@suse.com>

Jürgen Groß, le dim. 23 mars 2025 15:57:16 +0100, a ecrit:
> On 23.03.25 01:01, Samuel Thibault wrote:
> > Juergen Gross, le ven. 21 mars 2025 10:31:44 +0100, a ecrit:
> > > Add a file operations fstat hook to the 9pfs frontend.
> > > 
> > > Signed-off-by: Juergen Gross <jgross@suse.com>
> > > Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
> > > ---
> > > V2:
> > > - or file access mode into st_mode (Jason Andryuk)
> > > ---
> > >   9pfront.c | 29 +++++++++++++++++++++++++++++
> > >   1 file changed, 29 insertions(+)
> > > 
> > > diff --git a/9pfront.c b/9pfront.c
> > > index 1741d600..7257a07e 100644
> > > --- a/9pfront.c
> > > +++ b/9pfront.c
> > > @@ -85,6 +85,8 @@ struct file_9pfs {
> > >   #define P9_QID_SIZE    13
> > > +#define QID_TYPE_DIR   0x80     /* Applies to qid[0]. */
> > > +
> > >   struct p9_header {
> > >       uint32_t size;
> > >       uint8_t cmd;
> > > @@ -950,6 +952,32 @@ static int write_9pfs(struct file *file, const void *buf, size_t nbytes)
> > >       return ret;
> > >   }
> > > +static int fstat_9pfs(struct file *file, struct stat *buf)
> > > +{
> > > +    struct file_9pfs *f9pfs = file->filedata;
> > > +    struct p9_stat stat;
> > > +    int ret;
> > > +
> > > +    ret = p9_stat(f9pfs->dev, f9pfs->fid, &stat);
> > > +    if ( ret )
> > > +    {
> > > +        errno = EIO;
> > > +        return -1;
> > > +    }
> > > +
> > > +    buf->st_mode = (stat.qid[0] == QID_TYPE_DIR) ? S_IFDIR : S_IFREG;
> > > +    buf->st_mode |= stat.mode & 0777;
> > > +    buf->st_atime = stat.atime;
> > > +    buf->st_mtime = stat.mtime;
> > 
> > Should we perhaps also fill st_ctime? Leaving it at 0 could surprise
> > other software layers.
> 
> I can set it to the same value as st_mtime.

That'd be preferrable, yes.

With that,

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Thanks!
Samuel


  reply	other threads:[~2025-03-23 14:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-21  9:31 [MINI-OS PATCH v2 0/2] 9pfs: add some file operation hooks Juergen Gross
2025-03-21  9:31 ` [MINI-OS PATCH v2 1/2] 9pfs: add fstat file operation hook Juergen Gross
2025-03-23  0:01   ` Samuel Thibault
2025-03-23 14:57     ` Jürgen Groß
2025-03-23 14:58       ` Samuel Thibault [this message]
2025-03-24 10:21       ` Jan Beulich
2025-03-24 10:30         ` Samuel Thibault
2025-03-24 11:18           ` Jürgen Groß
2025-03-24 11:26             ` Jan Beulich
2025-03-21  9:31 ` [MINI-OS PATCH v2 2/2] 9pfs: add lseek " Juergen Gross
2025-03-23  0:02   ` Samuel Thibault

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=Z-AhiCM8j--cbLBV@begin \
    --to=samuel.thibault@ens-lyon.org \
    --cc=jason.andryuk@amd.com \
    --cc=jgross@suse.com \
    --cc=minios-devel@lists.xenproject.org \
    --cc=xen-devel@lists.xenproject.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 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.