linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: "[PATCH] devfs: switch over ubd to ->devfs_name" breaks ubd/sysfs
@ 2003-04-21 11:55 Oleg Drokin
  2003-04-21 12:18 ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Oleg Drokin @ 2003-04-21 11:55 UTC (permalink / raw)
  To: hch, linux-kernel, user-mode-linux-devel

Hello!

   The "[PATCH] devfs: switch over ubd to ->devfs_name" patch that was included into 2.5.68,
   have broken UML's ubd/sysfs interaction.
   Sysfs is very upset when something tries to register several devices with 
   same name, so I was forced to use following patch.
   If this is wrong, then please explain to me why, and suggest the correct way of handling
   this situation.

   Thank you.
   
Bye,
    Oleg

===== arch/um/drivers/ubd_kern.c 1.32 vs edited =====
--- 1.32/arch/um/drivers/ubd_kern.c	Sun Apr 20 01:17:05 2003
+++ edited/arch/um/drivers/ubd_kern.c	Mon Apr 21 15:52:54 2003
@@ -494,7 +494,7 @@
 	disk->first_minor = unit << UBD_SHIFT;
 	disk->fops = &ubd_blops;
 	set_capacity(disk, size / 512);
-	sprintf(disk->disk_name, "ubd");
+	sprintf(disk->disk_name, "ubd%d", unit);
 	sprintf(disk->devfs_name, "ubd/disc%d", unit);
 
 	disk->private_data = &ubd_dev[unit];
@@ -527,7 +527,7 @@
 	if(err) 
 		return(err);
  
-	if(fake_major)
+	if(fake_major != MAJOR_NR)
 		ubd_new_disk(fake_major, dev->size, n, 
 			     &fake_gendisk[n]);
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: "[PATCH] devfs: switch over ubd to ->devfs_name" breaks ubd/sysfs
  2003-04-21 11:55 "[PATCH] devfs: switch over ubd to ->devfs_name" breaks ubd/sysfs Oleg Drokin
@ 2003-04-21 12:18 ` Christoph Hellwig
  2003-04-21 12:30   ` Oleg Drokin
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2003-04-21 12:18 UTC (permalink / raw)
  To: Oleg Drokin; +Cc: hch, linux-kernel, user-mode-linux-devel

On Mon, Apr 21, 2003 at 03:55:30PM +0400, Oleg Drokin wrote:
> Hello!
> 
>    The "[PATCH] devfs: switch over ubd to ->devfs_name" patch that was included into 2.5.68,
>    have broken UML's ubd/sysfs interaction.
>    Sysfs is very upset when something tries to register several devices with 
>    same name, so I was forced to use following patch.
>    If this is wrong, then please explain to me why, and suggest the correct way of handling
>    this situation.

Patch looks okay to me.  But I'm still a bit confused about all
that fake_major stuff.  Someone care to explain it?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: "[PATCH] devfs: switch over ubd to ->devfs_name" breaks ubd/sysfs
  2003-04-21 12:18 ` Christoph Hellwig
@ 2003-04-21 12:30   ` Oleg Drokin
  2003-04-21 12:34     ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Oleg Drokin @ 2003-04-21 12:30 UTC (permalink / raw)
  To: Christoph Hellwig, linux-kernel, user-mode-linux-devel

Hello!

On Mon, Apr 21, 2003 at 02:18:45PM +0200, Christoph Hellwig wrote:
> >    The "[PATCH] devfs: switch over ubd to ->devfs_name" patch that was included into 2.5.68,
> >    have broken UML's ubd/sysfs interaction.
> >    Sysfs is very upset when something tries to register several devices with 
> >    same name, so I was forced to use following patch.
> >    If this is wrong, then please explain to me why, and suggest the correct way of handling
> >    this situation.
> Patch looks okay to me.  But I'm still a bit confused about all
> that fake_major stuff.  Someone care to explain it?

fake major is easy, it allows you to register ubd device on two majors.
This is useful e.g. for installing distros inside of UML.
Distro installers are tend to look for IDE disk on major 3, for example.
Then if you boot with ubd=3, installer will find the disk ;)

Actually the patch consits of two parts, as there might be more than one
ubd device, we need to name them differently.

Actually I just see that if one enables fake major stuff, the sysfs will still
be upset, as names for both UBD_MAJOR and fake_major would be the same.

So perhaps fillowing patch should be used.

Bye,
    Oleg

===== arch/um/drivers/ubd_kern.c 1.32 vs edited =====
--- 1.32/arch/um/drivers/ubd_kern.c	Sun Apr 20 01:17:05 2003
+++ edited/arch/um/drivers/ubd_kern.c	Mon Apr 21 16:29:21 2003
@@ -494,8 +494,13 @@
 	disk->first_minor = unit << UBD_SHIFT;
 	disk->fops = &ubd_blops;
 	set_capacity(disk, size / 512);
-	sprintf(disk->disk_name, "ubd");
-	sprintf(disk->devfs_name, "ubd/disc%d", unit);
+	if ( major == MAJOR_NR ) {
+		sprintf(disk->disk_name, "ubd%d", unit);
+		sprintf(disk->devfs_name, "ubd/disc%d", unit);
+	} else {
+		sprintf(disk->disk_name, "ubd_fake%d", unit);
+		sprintf(disk->devfs_name, "ubd_fake/disc%d", unit);
+	}
 
 	disk->private_data = &ubd_dev[unit];
 	disk->queue = &ubd_queue;
@@ -527,7 +532,7 @@
 	if(err) 
 		return(err);
  
-	if(fake_major)
+	if(fake_major != MAJOR_NR)
 		ubd_new_disk(fake_major, dev->size, n, 
 			     &fake_gendisk[n]);
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: "[PATCH] devfs: switch over ubd to ->devfs_name" breaks ubd/sysfs
  2003-04-21 12:30   ` Oleg Drokin
@ 2003-04-21 12:34     ` Christoph Hellwig
  2003-04-21 12:39       ` Oleg Drokin
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2003-04-21 12:34 UTC (permalink / raw)
  To: Oleg Drokin; +Cc: Christoph Hellwig, linux-kernel, user-mode-linux-devel

On Mon, Apr 21, 2003 at 04:30:39PM +0400, Oleg Drokin wrote:
> fake major is easy, it allows you to register ubd device on two majors.
> This is useful e.g. for installing distros inside of UML.
> Distro installers are tend to look for IDE disk on major 3, for example.
> Then if you boot with ubd=3, installer will find the disk ;)

Not that I would argue in favour of using devfs, but to make this fake
major stuff useful with devfs you'd have to use the devfs entries of
the faked devices.  So instead of the ubd_fake devfs names you'd
better add a string boot option that'll get set into ->devfs_name for
those.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: "[PATCH] devfs: switch over ubd to ->devfs_name" breaks ubd/sysfs
  2003-04-21 12:34     ` Christoph Hellwig
@ 2003-04-21 12:39       ` Oleg Drokin
  0 siblings, 0 replies; 5+ messages in thread
From: Oleg Drokin @ 2003-04-21 12:39 UTC (permalink / raw)
  To: Christoph Hellwig, linux-kernel, user-mode-linux-devel

Hello!

On Mon, Apr 21, 2003 at 02:34:02PM +0200, Christoph Hellwig wrote:
> On Mon, Apr 21, 2003 at 04:30:39PM +0400, Oleg Drokin wrote:
> > fake major is easy, it allows you to register ubd device on two majors.
> > This is useful e.g. for installing distros inside of UML.
> > Distro installers are tend to look for IDE disk on major 3, for example.
> > Then if you boot with ubd=3, installer will find the disk ;)
> Not that I would argue in favour of using devfs, but to make this fake
> major stuff useful with devfs you'd have to use the devfs entries of
> the faked devices.  So instead of the ubd_fake devfs names you'd

There is separate option for this. Though it should be fixed, it seems.

But mind you, installers I've seen do not use devfs.

> better add a string boot option that'll get set into ->devfs_name for
> those.

There is. It is called "fakeide" ;)

This one should be fixed it seems.

Bye,
    Oleg

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-04-21 12:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-21 11:55 "[PATCH] devfs: switch over ubd to ->devfs_name" breaks ubd/sysfs Oleg Drokin
2003-04-21 12:18 ` Christoph Hellwig
2003-04-21 12:30   ` Oleg Drokin
2003-04-21 12:34     ` Christoph Hellwig
2003-04-21 12:39       ` Oleg Drokin

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).