devfs
[Top] [All Lists]

Perhaps a silly question about late 2.5 kernels

To: <devfs@xxxxxxxxxxx>
Subject: Perhaps a silly question about late 2.5 kernels
From: "James McMechan" <James_McMechan@xxxxxxxxxxx>
Date: Fri, 13 Dec 2002 18:29:49 -0800
References: <200212102033.17836.racsw@xxxxxxxxxxxxxxx> <3DFA2EE0.3050901@xxxxxxx>
Sender: devfs-bounce@xxxxxxxxxxx
I have been working on the user-mode-linux (ARCH=um) block driver ubd_kern.c
& ubd_user.c

Previously I was putting "ubd" into the registration so we had
/dev/ubd/discX/... devices nicely created by devfs.

Recently in 2.5 the add_disk() helper has appeared to be the correct way to
register a block device and it also worked with a disk->disk_name of "ubd"
still creating /dev/ubd/disc0/disc & co.

But in 2.5.50/51 sysfs reportedly is also using the name and kills the
kernel by trying to allocate two objects with the same name failing and then
deleting both objects without removing the references to the first object.

If add_disk is given a unique disk_name for each device I tend to end up
with /dev/ubd0/disc0/disc /dev/ubd1/disc1/disc which is slightly awkward.

So what I was trying was to use ubd/compat/ubdX and then devfs_mk_symlink to
recreate the /dev/ubd/discX entries is there some better way to do this I
feel I am approaching the problem from the wrong direction.

Any suggestions on a better approach to the problem, is it a purely sysfs
problem and add_disk() should take "ubd" for all the devices in one major
number? I have been using devfs much longer than sysfs has existed and so I
am asking here first since this is the part I understand the most of.

Also what is the proper method of disposing of the symlink when the device
goes away? I can save the handle and devfs_unregister but I am not sure that
is the proper method.


- err = ubd_new_disk(MAJOR_NR, dev->size, "ubd", n, &ubd_gendisk[n],
ubd_dir_handle, &dev->real);
+ /* glack sysfs now insists on seperate names for each device not just each
major number */
+ /* which causes devfs to create /dev/ubd/Y/discN */
+ sprintf(name1,"ubd/compat/ubd%d",n);
+ sprintf(name2,"compat/ubd%d/disc%d", n, n);
+ sprintf(name3,"disc%d", n);
+ err = ubd_new_disk(MAJOR_NR, dev->size, name1, n, &ubd_gendisk[n],
ubd_dir_handle, &dev->real);
+ devfs_mk_symlink(ubd_dir_handle, name3, DEVFS_FL_DEFAULT, name2, NULL,
NULL);

Attachment: smime.p7s
Description: S/MIME cryptographic signature

<Prev in Thread] Current Thread [Next in Thread>