[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y74gRx6jLf2RHgdq@ZenIV>
Date: Wed, 11 Jan 2023 02:34:47 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: "Fabio M. De Francesco" <fmdefrancesco@...il.com>
Cc: Christoph Hellwig <hch@...radead.org>,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Ira Weiny <ira.weiny@...el.com>,
Dan Carpenter <error27@...il.com>
Subject: Re: [PATCH v2 2/4] fs/sysv: Change the signature of dir_get_page()
On Mon, Jan 09, 2023 at 06:06:37PM +0100, Fabio M. De Francesco wrote:
>
> -struct sysv_dir_entry * sysv_dotdot (struct inode *dir, struct page **p)
> +struct sysv_dir_entry *sysv_dotdot(struct inode *dir, struct page **p)
> {
> - struct page *page = dir_get_page(dir, 0);
> - struct sysv_dir_entry *de = NULL;
> + struct page *page = NULL;
> + struct sysv_dir_entry *de = dir_get_page(dir, 0, &page);
>
> - if (!IS_ERR(page)) {
> - de = (struct sysv_dir_entry*) page_address(page) + 1;
> + if (!IS_ERR(de)) {
> *p = page;
> + return (struct sysv_dir_entry *)page_address(page) + 1;
> }
> - return de;
> + return NULL;
> }
Would be better off with
struct sysv_dir_entry *de = dir_get_page(dir, 0, p);
if (!IS_ERR(de))
return de + 1; // ".." is the second directory entry
return NULL;
IMO...
Powered by blists - more mailing lists