LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/2] fs: move struct linux_dirent into headers
@ 2021-09-20 9:56 Gaelan Steele
2021-09-20 9:56 ` [PATCH 2/2] fs: move dirent.h into uapi Gaelan Steele
2021-09-20 10:06 ` [PATCH 1/2] fs: move struct linux_dirent into headers Greg KH
0 siblings, 2 replies; 3+ messages in thread
From: Gaelan Steele @ 2021-09-20 9:56 UTC (permalink / raw)
To: Alexander Viro
Cc: linux-man, Michael Kerrisk, linux-fsdevel, linux-kernel,
linux-api, Gaelan Steele
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 <gbs@canishe.com>
---
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];
+};
+
struct linux_dirent64 {
u64 d_ino;
s64 d_off;
--
2.30.1 (Apple Git-130)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] fs: move dirent.h into uapi
2021-09-20 9:56 [PATCH 1/2] fs: move struct linux_dirent into headers Gaelan Steele
@ 2021-09-20 9:56 ` Gaelan Steele
2021-09-20 10:06 ` [PATCH 1/2] fs: move struct linux_dirent into headers Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Gaelan Steele @ 2021-09-20 9:56 UTC (permalink / raw)
To: Alexander Viro
Cc: linux-man, Michael Kerrisk, linux-fsdevel, linux-kernel,
linux-api, Gaelan Steele
The structures defined in dirent.h are part of Linux's uAPI, but
it was previously necessary for user code to duplicate the struct
definitions themselves. Let's make them public.
Signed-off-by: Gaelan Steele <gbs@canishe.com>
---
include/{ => uapi}/linux/dirent.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
rename include/{ => uapi}/linux/dirent.h (66%)
diff --git a/include/linux/dirent.h b/include/uapi/linux/dirent.h
similarity index 66%
rename from include/linux/dirent.h
rename to include/uapi/linux/dirent.h
index 48e119dd3694..99293c651612 100644
--- a/include/linux/dirent.h
+++ b/include/uapi/linux/dirent.h
@@ -1,6 +1,6 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _LINUX_DIRENT_H
-#define _LINUX_DIRENT_H
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _UAPI_LINUX_DIRENT_H
+#define _UAPI_LINUX_DIRENT_H
struct linux_dirent {
unsigned long d_ino;
--
2.30.1 (Apple Git-130)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] fs: move struct linux_dirent into headers
2021-09-20 9:56 [PATCH 1/2] fs: move struct linux_dirent into headers Gaelan Steele
2021-09-20 9:56 ` [PATCH 2/2] fs: move dirent.h into uapi Gaelan Steele
@ 2021-09-20 10:06 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2021-09-20 10:06 UTC (permalink / raw)
To: Gaelan Steele
Cc: Alexander Viro, linux-man, Michael Kerrisk, linux-fsdevel,
linux-kernel, linux-api
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 <gbs@canishe.com>
> ---
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-20 10:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-20 9:56 [PATCH 1/2] fs: move struct linux_dirent into headers Gaelan Steele
2021-09-20 9:56 ` [PATCH 2/2] fs: move dirent.h into uapi Gaelan Steele
2021-09-20 10:06 ` [PATCH 1/2] fs: move struct linux_dirent into headers Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).