From: FabF <fabian.frederick@skynet.be>
To: lkml <linux-kernel@vger.kernel.org>
Subject: [PATCH 2.6.7-mm1] dirent merge
Date: Thu, 24 Jun 2004 20:03:20 +0200 [thread overview]
Message-ID: <1088100200.2211.20.camel@localhost.localdomain> (raw)
[-- 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
reply other threads:[~2004-06-24 16:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1088100200.2211.20.camel@localhost.localdomain \
--to=fabian.frederick@skynet.be \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.