* [PATCH] mknod64 with major,minor
@ 2003-04-21 1:39 Andries.Brouwer
2003-04-21 18:49 ` H. Peter Anvin
0 siblings, 1 reply; 2+ messages in thread
From: Andries.Brouwer @ 2003-04-21 1:39 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel
A second version of mknod64 for i386.
There are no assumptions on the size of dev_t.
sys_mknod takes unsigned int (instead of dev_t)
sys_mknod64 takes two unsigned ints.
Andries
--------------------------------------------------
diff -u --recursive --new-file -X /linux/dontdiff a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
--- a/arch/i386/kernel/entry.S Tue Mar 25 04:54:29 2003
+++ b/arch/i386/kernel/entry.S Mon Apr 21 01:00:56 2003
@@ -852,6 +852,7 @@
.long sys_clock_gettime /* 265 */
.long sys_clock_getres
.long sys_clock_nanosleep
+ .long sys_mknod64
nr_syscalls=(.-sys_call_table)/4
diff -u --recursive --new-file -X /linux/dontdiff a/fs/namei.c b/fs/namei.c
--- a/fs/namei.c Sun Apr 20 12:59:32 2003
+++ b/fs/namei.c Mon Apr 21 02:07:18 2003
@@ -1403,11 +1403,12 @@
return error;
}
-asmlinkage long sys_mknod(const char __user * filename, int mode, dev_t dev)
+static long
+do_mknod(const char __user *filename, int mode, dev_t dev)
{
int error = 0;
- char * tmp;
- struct dentry * dentry;
+ char *tmp;
+ struct dentry *dentry;
struct nameidata nd;
if (S_ISDIR(mode))
@@ -1448,6 +1449,27 @@
return error;
}
+asmlinkage long
+sys_mknod(const char __user *filename, int mode, unsigned int devnr)
+{
+ dev_t dev = devnr;
+
+ if (dev != devnr)
+ return -EOVERFLOW;
+ return do_mknod(filename, mode, dev);
+}
+
+asmlinkage long
+sys_mknod64(const char __user *filename, int mode,
+ unsigned int major, unsigned int minor)
+{
+ dev_t dev = MKDEV(major, minor);
+
+ if (MAJOR(dev) != major || MINOR(dev) != minor)
+ return -EOVERFLOW;
+ return do_mknod(filename, mode, dev);
+}
+
int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
{
int error = may_create(dir, dentry);
diff -u --recursive --new-file -X /linux/dontdiff a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
--- a/include/asm-i386/unistd.h Mon Feb 24 23:02:56 2003
+++ b/include/asm-i386/unistd.h Mon Apr 21 01:01:48 2003
@@ -273,8 +273,9 @@
#define __NR_clock_gettime (__NR_timer_create+6)
#define __NR_clock_getres (__NR_timer_create+7)
#define __NR_clock_nanosleep (__NR_timer_create+8)
+#define __NR_sys_mknod64 268
-#define NR_syscalls 268
+#define NR_syscalls 269
/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mknod64 with major,minor
2003-04-21 1:39 [PATCH] mknod64 with major,minor Andries.Brouwer
@ 2003-04-21 18:49 ` H. Peter Anvin
0 siblings, 0 replies; 2+ messages in thread
From: H. Peter Anvin @ 2003-04-21 18:49 UTC (permalink / raw)
To: linux-kernel
Followup to: <UTC200304210139.h3L1duq18832.aeb@smtp.cwi.nl>
By author: Andries.Brouwer@cwi.nl
In newsgroup: linux.dev.kernel
>
> A second version of mknod64 for i386.
> There are no assumptions on the size of dev_t.
>
> sys_mknod takes unsigned int (instead of dev_t)
> sys_mknod64 takes two unsigned ints.
>
Why unsigned int? If we have a legacy call it should presumably use
the legacy __u16 format.
-hpa
--
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-04-21 18:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-21 1:39 [PATCH] mknod64 with major,minor Andries.Brouwer
2003-04-21 18:49 ` H. Peter Anvin
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).