From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1508C433EF for ; Mon, 20 Sep 2021 10:06:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A34CD60E9C for ; Mon, 20 Sep 2021 10:06:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230159AbhITKIE (ORCPT ); Mon, 20 Sep 2021 06:08:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:46718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229574AbhITKIC (ORCPT ); Mon, 20 Sep 2021 06:08:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DF671600D4; Mon, 20 Sep 2021 10:06:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632132396; bh=Y9K2peoP+053qe709BSIBNv+PSkuEnDu9beMJCEm1kc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dkZ2epxCWQxx9jGPfmKG17yir0Al78Bj8bxw0HJyH1jiDCtaQSMGtqhObnPzzvMpK 4V+BJYy+XemFXhVNC06d9O/SNjIZ99+fHu16NpYET3vJuvOZi3DtwYPiXrrP7JT8pA ZevrqQ1u94LO2H51eSLSYqKePMLKurQCKfR3vxKI= Date: Mon, 20 Sep 2021 12:06:33 +0200 From: Greg KH To: Gaelan Steele Cc: Alexander Viro , linux-man@vger.kernel.org, Michael Kerrisk , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Subject: Re: [PATCH 1/2] fs: move struct linux_dirent into headers Message-ID: References: <20210920095649.28600-1-gbs@canishe.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210920095649.28600-1-gbs@canishe.com> Precedence: bulk List-ID: X-Mailing-List: linux-man@vger.kernel.org On Mon, Sep 20, 2021 at 10:56:48AM +0100, Gaelan Steele wrote: > Move the definition of linux_dirent to include/linux/dirent.h, > where the newer linux_dirent64 already lives. This is done in > preparation for moving both of these struct definitions into uapi/ > so userspace code doesn't need to duplicate them. > > Signed-off-by: Gaelan Steele > --- > fs/readdir.c | 8 +------- > include/linux/dirent.h | 7 +++++++ > 2 files changed, 8 insertions(+), 7 deletions(-) > > diff --git a/fs/readdir.c b/fs/readdir.c > index 09e8ed7d4161..51890aeafc53 100644 > --- a/fs/readdir.c > +++ b/fs/readdir.c > @@ -202,14 +202,8 @@ SYSCALL_DEFINE3(old_readdir, unsigned int, fd, > > /* > * New, all-improved, singing, dancing, iBCS2-compliant getdents() > - * interface. > + * interface. > */ > -struct linux_dirent { > - unsigned long d_ino; > - unsigned long d_off; > - unsigned short d_reclen; > - char d_name[1]; > -}; > > struct getdents_callback { > struct dir_context ctx; > diff --git a/include/linux/dirent.h b/include/linux/dirent.h > index 99002220cd45..48e119dd3694 100644 > --- a/include/linux/dirent.h > +++ b/include/linux/dirent.h > @@ -2,6 +2,13 @@ > #ifndef _LINUX_DIRENT_H > #define _LINUX_DIRENT_H > > +struct linux_dirent { > + unsigned long d_ino; > + unsigned long d_off; > + unsigned short d_reclen; > + char d_name[1]; These are not valid user/kernel api types. If you want them in userspace, please use the correct ones (__u64, __u16, __u8, etc.) thanks, greg k-h