mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roman Zippel <zippel@linux-m68k.org>
To: Greg KH <greg@kroah.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Joel Becker <Joel.Becker@oracle.com>, bert hubert <ahu@ds9a.nl>,
	<Andries.Brouwer@cwi.nl>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Wim Coekaerts <Wim.Coekaerts@oracle.com>
Subject: Re: 64-bit kdev_t - just for playing
Date: Wed, 2 Apr 2003 15:02:04 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.44.0304021442460.12110-100000@serv> (raw)
In-Reply-To: <20030401163522.GD1448@kroah.com>

Hi,

On Tue, 1 Apr 2003, Greg KH wrote:

> On Tue, Apr 01, 2003 at 03:42:14PM +0100, Alan Cox wrote:
> 
> > We need to default to 12:20 for char but where the 20 is actually
> > defaulting to 0000xx so we don't get extra minors for any device
> > that hasnt been audited for it

Why do we need to introduce new arbitrary limits?
I played a bit with the patch below, which adds dynamic device numbers and 
with a simple script like this the corresponding dev entries can be 
created:

mount -tsysfs none /sysfs
cd /sysfs/block
for d in *; do
        n=0x`cat $d/dev`
        ~/mn /dev/$d $n
        p=1
        while [ $p -lt `cat $d/range` ]; do
                ~/mn /dev/$d$p $[$n+$p]
                p=$[$p+1]
        done
done

We are sooo close to dynamic device numbers, so I really don't understand 
why people want to go back all the way back to static numbers.
The kernel is mostly ready, what is missing now is the userspace and a 
driver audit.

> I thought Andries's patch prevented the need for this, as it restricted
> the number of minors assigned to a device unless they converted to the
> new API.

This 'new API' is _huge_ step backwards, because it puts the burden of 
managing static device numbers on the drivers again.

bye, Roman

Index: drivers/block/genhd.c
===================================================================
RCS file: /home/other/cvs/linux/linux-2.5/drivers/block/genhd.c,v
retrieving revision 1.1.1.31
diff -u -p -r1.1.1.31 genhd.c
--- drivers/block/genhd.c	25 Mar 2003 09:21:17 -0000	1.1.1.31
+++ drivers/block/genhd.c	2 Apr 2003 11:07:16 -0000
@@ -253,6 +253,14 @@ static int exact_lock(dev_t dev, void *d
  */
 void add_disk(struct gendisk *disk)
 {
+	if (disk->flags & GENHD_FL_DYNAMIC) {
+		static dev_t next_dev = 0x10000;
+
+		disk->major = MAJOR(next_dev);
+		disk->first_minor = 0;
+		next_dev += 0x100;
+	}
+
 	disk->flags |= GENHD_FL_UP;
 	blk_register_region(MKDEV(disk->major, disk->first_minor),
 			    disk->minors, NULL, exact_match, exact_lock, disk);
Index: drivers/scsi/sd.c
===================================================================
RCS file: /home/other/cvs/linux/linux-2.5/drivers/scsi/sd.c,v
retrieving revision 1.1.1.38
diff -u -p -r1.1.1.38 sd.c
--- drivers/scsi/sd.c	18 Mar 2003 09:37:07 -0000	1.1.1.38
+++ drivers/scsi/sd.c	2 Apr 2003 12:41:34 -0000
@@ -56,7 +56,7 @@
  * Remaining dev_t-handling stuff
  */
 #define SD_MAJORS	16
-#define SD_DISKS	(SD_MAJORS << 4)
+#define SD_DISKS	4096
 
 /*
  * Time out in seconds for disks and Magneto-opticals (which are slower).
@@ -125,8 +125,7 @@ static int sd_major(int major_idx)
 	case 8 ... 15:
 		return SCSI_DISK8_MAJOR + major_idx;
 	default:
-		BUG();
-		return 0;	/* shut up gcc */
+		return 0;
 	}
 }
 
@@ -1344,6 +1343,10 @@ static int sd_attach(struct scsi_device 
 
 	gd->driverfs_dev = &sdp->sdev_driverfs_dev;
 	gd->flags = GENHD_FL_DRIVERFS | GENHD_FL_DEVFS;
+#if 0
+	if (!gd->major)
+#endif
+		gd->flags |= GENHD_FL_DYNAMIC;
 	if (sdp->removable)
 		gd->flags |= GENHD_FL_REMOVABLE;
 	gd->private_data = &sdkp->driver;
Index: include/asm-i386/posix_types.h
===================================================================
RCS file: /home/other/cvs/linux/linux-2.5/include/asm-i386/posix_types.h,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 posix_types.h
--- include/asm-i386/posix_types.h	25 Feb 2003 11:50:47 -0000	1.1.1.2
+++ include/asm-i386/posix_types.h	2 Apr 2003 11:07:16 -0000
@@ -7,7 +7,7 @@
  * assume GCC is being used.
  */
 
-typedef unsigned short	__kernel_dev_t;
+typedef unsigned long	__kernel_dev_t;
 typedef unsigned long	__kernel_ino_t;
 typedef unsigned short	__kernel_mode_t;
 typedef unsigned short	__kernel_nlink_t;
Index: include/linux/genhd.h
===================================================================
RCS file: /home/other/cvs/linux/linux-2.5/include/linux/genhd.h,v
retrieving revision 1.1.1.18
diff -u -p -r1.1.1.18 genhd.h
--- include/linux/genhd.h	18 Mar 2003 09:39:54 -0000	1.1.1.18
+++ include/linux/genhd.h	2 Apr 2003 11:07:16 -0000
@@ -71,6 +71,7 @@ struct hd_struct {
 #define GENHD_FL_DEVFS	4
 #define GENHD_FL_CD	8
 #define GENHD_FL_UP	16
+#define GENHD_FL_DYNAMIC 32
 
 struct disk_stats {
 	unsigned read_sectors, write_sectors;
Index: include/linux/kdev_t.h
===================================================================
RCS file: /home/other/cvs/linux/linux-2.5/include/linux/kdev_t.h,v
retrieving revision 1.1.1.6
diff -u -p -r1.1.1.6 kdev_t.h
--- include/linux/kdev_t.h	5 Nov 2002 10:48:59 -0000	1.1.1.6
+++ include/linux/kdev_t.h	2 Apr 2003 11:07:16 -0000
@@ -70,7 +70,7 @@ aeb - 950811
  * static arrays, and they are sized for a 8-bit index.
  */
 typedef struct {
-	unsigned short value;
+	unsigned long value;
 } kdev_t;
 
 #define KDEV_MINOR_BITS		8
@@ -112,7 +112,7 @@ static inline int kdev_same(kdev_t dev1,
 
 /* Mask off the high bits for now.. */
 #define minor(dev)	((dev).value & 0xff)
-#define major(dev)	(((dev).value >> KDEV_MINOR_BITS) & 0xff)
+#define major(dev)	((dev).value >> KDEV_MINOR_BITS)
 
 /* These are for user-level "dev_t" */
 #define MINORBITS	8


  reply	other threads:[~2003-04-02 12:50 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-27 20:27 Andries.Brouwer
2003-03-27 22:12 ` Roman Zippel
2003-03-27 22:55   ` Alan Cox
2003-03-27 23:19     ` Roman Zippel
2003-03-27 23:48       ` Greg KH
2003-03-28  9:47         ` Roman Zippel
2003-03-28 18:05           ` Joel Becker
2003-03-28 18:48             ` Roman Zippel
2003-03-31  8:31               ` bert hubert
2003-03-31  8:52                 ` Roman Zippel
2003-03-31 17:24                   ` Joel Becker
2003-03-31 21:32                     ` Roman Zippel
2003-03-31 22:18                       ` Alan Cox
2003-03-31 23:42                         ` Roman Zippel
2003-04-01 14:42                           ` Alan Cox
2003-04-01 16:35                             ` Greg KH
2003-04-02 13:02                               ` Roman Zippel [this message]
2003-04-01 14:42                           ` Alan Cox
2003-04-01 16:52                             ` Christoph Hellwig
2003-04-01 21:59                             ` H. Peter Anvin
2003-04-02  7:12                               ` Christoph Hellwig
2003-04-02  7:22                                 ` H. Peter Anvin
2003-03-31 23:45                         ` Joel Becker
2003-03-31 23:07                       ` Joel Becker
2003-03-31 23:35                         ` Roman Zippel
  -- strict thread matches above, loose matches on Subject: below --
2003-04-09 18:40 James Bottomley
2003-04-09 20:54 ` Roman Zippel
2003-04-10  2:19   ` James Bottomley
2003-04-10 12:47     ` Roman Zippel
2003-04-10 15:30       ` James Bottomley
2003-04-10 23:53         ` Roman Zippel
2003-04-11  0:01           ` David Lang
2003-04-11  0:17             ` Roman Zippel
2003-04-11  0:47           ` Joel Becker
2003-04-11  1:11             ` Roman Zippel
2003-04-09 18:36 Andries.Brouwer
2003-04-09 21:11 ` Roman Zippel
2003-04-01 18:32 Andries.Brouwer
2003-03-31 23:41 Badari Pulavarty
2003-03-31 23:54 ` William Lee Irwin III
2003-03-31 23:55 ` Joel Becker
2003-04-02 12:18 ` Roman Zippel
2003-04-02 17:31   ` Badari Pulavarty
2003-04-02 22:03     ` H. Peter Anvin
2003-04-03 10:09       ` David Lang
2003-04-03 11:14         ` Lars Marowsky-Bree
2003-04-03 12:13     ` Roman Zippel
2003-04-03 13:37       ` Andries Brouwer
2003-04-03 14:01         ` Roman Zippel
2003-04-07 15:02           ` H. Peter Anvin
2003-04-07 20:10             ` Roman Zippel
2003-04-07 21:57               ` Roman Zippel
2003-04-07 22:43                 ` Kevin P. Fleming
2003-04-08 15:22                   ` Roman Zippel
2003-04-08 22:53                 ` Werner Almesberger
2003-04-08 23:11                   ` David Lang
2003-04-08 23:47                     ` Werner Almesberger
2003-04-08 23:58                       ` Kevin P. Fleming
2003-04-08 23:56                     ` H. Peter Anvin
2003-04-08 23:06                       ` Andrew Morton
2003-04-09  0:40                       ` Roman Zippel
2003-04-09  1:02                         ` Joel Becker
2003-04-09  1:25                           ` Roman Zippel
2003-04-09 16:42                       ` Roman Zippel
2003-04-09  0:21                   ` Roman Zippel
2003-04-11  9:58               ` Pavel Machek
2003-04-08 15:29             ` Roman Zippel
2003-03-28 15:33 Andries.Brouwer
2003-03-28 15:49 ` Roman Zippel
2003-03-28 11:46 Andries.Brouwer
2003-03-28 11:57 ` Roman Zippel
2003-03-28 11:10 Andries.Brouwer
2003-03-28 11:36 ` Roman Zippel
2003-03-30 20:05   ` H. Peter Anvin
2003-03-30 20:13     ` Roman Zippel
2003-03-27 22:37 Andries.Brouwer
2003-03-27 22:55 ` Roman Zippel
2003-03-27  1:09 Andries.Brouwer
2003-03-27 19:23 ` Roman Zippel
2003-03-30 20:10 ` H. Peter Anvin

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=Pine.LNX.4.44.0304021442460.12110-100000@serv \
    --to=zippel@linux-m68k.org \
    --cc=Andries.Brouwer@cwi.nl \
    --cc=Joel.Becker@oracle.com \
    --cc=Wim.Coekaerts@oracle.com \
    --cc=ahu@ds9a.nl \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=greg@kroah.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®