[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YG4QymNCjgGR/cPk@localhost.localdomain>
Date: Wed, 7 Apr 2021 23:06:34 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] proc: smoke test lseek()
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.
Powered by blists - more mailing lists