Linux filesystem development
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] proc: smoke test lseek()
Date: Wed, 7 Apr 2021 23:06:34 +0300	[thread overview]
Message-ID: <YG4QymNCjgGR/cPk@localhost.localdomain> (raw)
In-Reply-To: <20210407195809.GG2531743@casper.infradead.org>

On Wed, Apr 07, 2021 at 08:58:09PM +0100, Matthew Wilcox wrote:
> On Wed, Apr 07, 2021 at 10:55:14PM +0300, Alexey Dobriyan wrote:
> > Now that ->proc_lseek has been made mandatory it would be nice to test
> > that nothing has been forgotten.
> 
> > @@ -45,6 +45,8 @@ static void f_reg(DIR *d, const char *filename)
> >  	fd = openat(dirfd(d), filename, O_RDONLY|O_NONBLOCK);
> >  	if (fd == -1)
> >  		return;
> > +	/* struct proc_ops::proc_lseek is mandatory if file is seekable. */
> > +	(void)lseek(fd, 0, SEEK_SET);
> >  	rv = read(fd, buf, sizeof(buf));
> >  	assert((0 <= rv && rv <= sizeof(buf)) || rv == -1);
> >  	close(fd);
> 
> why throw away the return value?  if it returns an error seeking to
> offset 0, something is terribly wrong.

Some files may use nonseekable_open().
This smoke test doesn't verify that seeking is done correctly anyway.

      reply	other threads:[~2021-04-07 20:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210328221524.ukfuztGsl%akpm@linux-foundation.org>
2021-04-07 19:55 ` [PATCH] proc: smoke test lseek() Alexey Dobriyan
2021-04-07 19:58   ` Matthew Wilcox
2021-04-07 20:06     ` Alexey Dobriyan [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=YG4QymNCjgGR/cPk@localhost.localdomain \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=willy@infradead.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