All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.7-mm1] dirent merge
@ 2004-06-24 18:03 FabF
  0 siblings, 0 replies; only message in thread
From: FabF @ 2004-06-24 18:03 UTC (permalink / raw)
  To: lkml

[-- Attachment #1: Type: text/plain, Size: 134 bytes --]

Hi,

	Here's a dirent struct merge to dirent.h.
btw, I don't see any diff. between old_linux_dirent & linux_dirent (?)

Regards,
FabF

[-- Attachment #2: dirent1.diff --]
[-- Type: text/x-patch, Size: 4996 bytes --]

diff -Naur orig~dirent/arch/ppc64/kernel/sys_ppc32.c edited~dirent/arch/ppc64/kernel/sys_ppc32.c
--- orig~dirent/arch/ppc64/kernel/sys_ppc32.c	2004-06-16 07:19:42.000000000 +0200
+++ edited~dirent/arch/ppc64/kernel/sys_ppc32.c	2004-06-24 19:21:53.000000000 +0200
@@ -18,6 +18,7 @@
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/fs.h> 
+#include <linux/dirent.h>
 #include <linux/mm.h> 
 #include <linux/file.h> 
 #include <linux/signal.h>
@@ -77,17 +78,6 @@
 
 #include "pci.h"
 
-/* readdir & getdents */
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
-#define ROUND_UP(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
-
-struct old_linux_dirent32 {
-	u32		d_ino;
-	u32		d_offset;
-	unsigned short	d_namlen;
-	char		d_name[1];
-};
-
 struct readdir_callback32 {
 	struct old_linux_dirent32 __user * dirent;
 	int count;
diff -Naur orig~dirent/arch/s390/kernel/compat_linux.c edited~dirent/arch/s390/kernel/compat_linux.c
--- orig~dirent/arch/s390/kernel/compat_linux.c	2004-06-16 07:19:51.000000000 +0200
+++ edited~dirent/arch/s390/kernel/compat_linux.c	2004-06-24 19:25:59.000000000 +0200
@@ -20,6 +20,7 @@
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/fs.h> 
+#include <linux/dirent.h>
 #include <linux/mm.h> 
 #include <linux/file.h> 
 #include <linux/signal.h>
@@ -355,18 +356,6 @@
 		return sys_ftruncate(fd, (high << 32) | low);
 }
 
-/* readdir & getdents */
-
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
-#define ROUND_UP(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
-
-struct old_linux_dirent32 {
-	u32		d_ino;
-	u32		d_offset;
-	unsigned short	d_namlen;
-	char		d_name[1];
-};
-
 struct readdir_callback32 {
 	struct old_linux_dirent32 * dirent;
 	int count;
@@ -414,13 +403,6 @@
 	return error;
 }
 
-struct linux_dirent32 {
-	u32		d_ino;
-	u32		d_off;
-	unsigned short	d_reclen;
-	char		d_name[1];
-};
-
 struct getdents_callback32 {
 	struct linux_dirent32 * current_dir;
 	struct linux_dirent32 * previous;
diff -Naur orig~dirent/fs/readdir.c edited~dirent/fs/readdir.c
--- orig~dirent/fs/readdir.c	2004-06-16 07:19:22.000000000 +0200
+++ edited~dirent/fs/readdir.c	2004-06-24 19:29:49.000000000 +0200
@@ -50,18 +50,9 @@
  * anyway. Thus the special "fillonedir()" function for that
  * case (the low-level handlers don't need to care about this).
  */
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
-#define ROUND_UP(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
 
 #ifdef __ARCH_WANT_OLD_READDIR
 
-struct old_linux_dirent {
-	unsigned long	d_ino;
-	unsigned long	d_offset;
-	unsigned short	d_namlen;
-	char		d_name[1];
-};
-
 struct readdir_callback {
 	struct old_linux_dirent __user * dirent;
 	int result;
@@ -122,12 +113,6 @@
  * New, all-improved, singing, dancing, iBCS2-compliant getdents()
  * interface. 
  */
-struct linux_dirent {
-	unsigned long	d_ino;
-	unsigned long	d_off;
-	unsigned short	d_reclen;
-	char		d_name[1];
-};
 
 struct getdents_callback {
 	struct linux_dirent __user * current_dir;
@@ -141,7 +126,7 @@
 {
 	struct linux_dirent __user * dirent;
 	struct getdents_callback * buf = (struct getdents_callback *) __buf;
-	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 2);
+	int reclen = ROUND_UPL(NAME_OFFSET(dirent) + namlen + 2);
 
 	buf->error = -EINVAL;	/* only used if we fail.. */
 	if (reclen > buf->count)
@@ -211,8 +196,6 @@
 	return error;
 }
 
-#define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1))
-
 struct getdents_callback64 {
 	struct linux_dirent64 __user * current_dir;
 	struct linux_dirent64 __user * previous;
diff -Naur orig~dirent/include/linux/dirent.h edited~dirent/include/linux/dirent.h
--- orig~dirent/include/linux/dirent.h	2004-06-16 07:19:44.000000000 +0200
+++ edited~dirent/include/linux/dirent.h	2004-06-24 19:32:51.000000000 +0200
@@ -1,11 +1,17 @@
 #ifndef _LINUX_DIRENT_H
 #define _LINUX_DIRENT_H
 
+/* readdir & getdents */
+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
+#define ROUND_UP(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
+#define ROUND_UPL(x) (((x)+sizeof(long)-1) & ~(sizeof(long)-1))
+#define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1))
+
 struct dirent {
 	long		d_ino;
 	__kernel_off_t	d_off;
 	unsigned short	d_reclen;
-	char		d_name[256]; /* We must not include limits.h! */
+	char		d_name[256];
 };
 
 struct dirent64 {
@@ -16,6 +22,34 @@
 	char		d_name[256];
 };
 
+struct old_linux_dirent {
+	unsigned long	d_ino;
+	unsigned long	d_offset;
+	unsigned short	d_namlen;
+	char		d_name[1];
+};
+
+struct old_linux_dirent32 {
+	u32		d_ino;
+	u32		d_offset;
+	unsigned short	d_namlen;
+	char		d_name[1];
+};
+
+struct linux_dirent {
+	unsigned long	d_ino;
+	unsigned long	d_off;
+	unsigned short	d_reclen;
+	char		d_name[1];
+};
+
+struct linux_dirent32 {
+	u32		d_ino;
+	u32		d_off;
+	unsigned short	d_reclen;
+	char		d_name[1];
+};
+
 #ifdef __KERNEL__
 
 struct linux_dirent64 {
@@ -28,5 +62,4 @@
 
 #endif	/* __KERNEL__ */
 
-
 #endif

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-06-24 16:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-24 18:03 [PATCH 2.6.7-mm1] dirent merge FabF

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.