From: "Andres Salomon" <dilinger@voxel.net>
To: <akpm@digeo.com>
Cc: <linux-kernel@vger.kernel.org>, <Andries.Brouwer@cwi.nl>
Subject: [PATCH] 2.5.70-mm3: 64bit kdev_t explicitly-sized types
Date: Sun, 1 Jun 2003 06:05:26 -0400 (EDT) [thread overview]
Message-ID: <14959.24.195.0.157.1054461926.squirrel@zero.voxel.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 411 bytes --]
This patch changes some of the core stuff touched by
64-bit-dev_t-kdev_t.patch (the driver stuff is left alone) to use
explicitly sized types (ie, __u64). The only really controvertial part of
it is the inclusion of asm/types.h in asm/posix_types.h; since asm/types.h
only (on most archs) defines the standard {u,s}{8,16,32,64} types and
umode_t, I don't think namespace pollution will be much of an issue...
[-- Attachment #2: 64-bit-explicit-types.patch --]
[-- Type: application/octet-stream, Size: 3573 bytes --]
diff -x {arch} -urN linux-patch-1/include/asm-i386/posix_types.h linux-patch-2/include/asm-i386/posix_types.h
--- linux-patch-1/include/asm-i386/posix_types.h 2003-06-01 04:38:39.000000000 -0400
+++ linux-patch-2/include/asm-i386/posix_types.h 2003-06-01 04:43:10.000000000 -0400
@@ -1,15 +1,15 @@
#ifndef __ARCH_I386_POSIX_TYPES_H
#define __ARCH_I386_POSIX_TYPES_H
+#include <asm/types.h>
+
/*
* This file is generally used by user-level software, so you need to
* be a little careful about namespace pollution etc. Also, we cannot
* assume GCC is being used.
*/
-#ifdef __GNUC__
-typedef unsigned long long __kernel_dev_t;
-#endif
+typedef __u64 __kernel_dev_t;
typedef unsigned long __kernel_ino_t;
typedef unsigned short __kernel_mode_t;
typedef unsigned short __kernel_nlink_t;
diff -x {arch} -urN linux-patch-1/include/linux/kdev_t.h linux-patch-2/include/linux/kdev_t.h
--- linux-patch-1/include/linux/kdev_t.h 2003-06-01 04:38:58.000000000 -0400
+++ linux-patch-2/include/linux/kdev_t.h 2003-06-01 04:43:19.000000000 -0400
@@ -5,10 +5,10 @@
#include <linux/types.h> /* for dev_t */
typedef struct {
- unsigned long long value;
+ __u64 value;
} kdev_t;
-#define __mkdev(major, minor) (((unsigned long long)(major) << 32) + (minor))
+#define __mkdev(major, minor) (((__u64)(major) << 32) + (minor))
#define mk_kdev(major, minor) ((kdev_t) { __mkdev(major,minor) } )
@@ -17,12 +17,12 @@
* internal equality comparisons and for things
* like NFS filehandle conversion.
*/
-static inline unsigned long long kdev_val(kdev_t dev)
+static inline __u64 kdev_val(kdev_t dev)
{
return dev.value;
}
-static inline kdev_t val_to_kdev(unsigned long long val)
+static inline kdev_t val_to_kdev(__u64 val)
{
kdev_t dev;
dev.value = val;
@@ -39,8 +39,8 @@
#define kdev_none(d1) (!kdev_val(d1))
-#define minor(dev) (unsigned int)((dev).value & 0xffffffff)
-#define major(dev) (unsigned int)((dev).value >> 32)
+#define minor(dev) (__u32) ((dev).value & 0xffffffff)
+#define major(dev) (__u32) ((dev).value >> 32)
/* These are for user-level "dev_t" */
/* Going back and forth between dev and (ma,mi) is one-to-one
@@ -69,17 +69,17 @@
}
#else
/* ugly macro versions */
-#define MAJOR(dev) ((unsigned int)({ dev_t __dev = dev; \
+#define MAJOR(dev) ((__u32)({ dev_t __dev = dev; \
(__dev & ~0xffffffffULL) ? (__dev >> 32) : \
(__dev & ~0xffff) ? (__dev >> 16) : (__dev >> 8); }))
-#define MINOR(dev) ((unsigned int)({ dev_t __dev = dev; \
+#define MINOR(dev) ((__u32)({ dev_t __dev = dev; \
(__dev & ~0xffffffffULL) ? (__dev & 0xffffffff) : \
(__dev & ~0xffff) ? (__dev & 0xffff) : (__dev & 0xff); }))
#define constant_MKDEV(ma, mi) \
((((ma)|(mi)) & ~0xffff) ? ((ma) << 32) | (mi) : \
(((ma)|(mi)) & ~0xff) ? ((ma) << 16) | (mi) : ((ma) << 8) | (mi))
#define MKDEV(major, minor) ({ \
- unsigned int __ma = major, __mi = minor, __both = (__ma | __mi); \
+ __u32 __ma = major, __mi = minor, __both = (__ma | __mi); \
((sizeof(dev_t) > 4 && (__both & ~0xffff)) ? (((dev_t) __ma) << 32) : \
(__both & ~0xff) ? (((dev_t) __ma) << 16) : (((dev_t) __ma) << 8) \
) | __mi; })
@@ -91,15 +91,15 @@
static inline dev_t kdev_t_to_nr(kdev_t dev)
{
- unsigned int ma = major(dev);
- unsigned int mi = minor(dev);
+ __u32 ma = major(dev);
+ __u32 mi = minor(dev);
return MKDEV(ma, mi);
}
static inline kdev_t to_kdev_t(dev_t dev)
{
- unsigned int ma = MAJOR(dev);
- unsigned int mi = MINOR(dev);
+ __u32 ma = MAJOR(dev);
+ __u32 mi = MINOR(dev);
return mk_kdev(ma, mi);
}
reply other threads:[~2003-06-01 9:57 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=14959.24.195.0.157.1054461926.squirrel@zero.voxel.net \
--to=dilinger@voxel.net \
--cc=Andries.Brouwer@cwi.nl \
--cc=akpm@digeo.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®