Skip to contentSkip to conversation

make evtchn use a dynamic minor

PATCH In review Steven Rostedt 3 participants 4 messages Sep 29, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 make evtchn use a dynamic minor

Along with the blktap hardcoding of a major number. It has come to my attention that evtchn also hardcodes a minor number. Not so bad, but can later cause conflicts. evtchn uses the misc device to get its major number.

This patch makes evtchn use a dynamic minor number instead. It also updates the code in tools to create the device node if udev fails. The tools now read the sysfs system to find the minor number needed.

One thing that is missing though, in this patch, is the update to ./debugger/pdb/evtchn.ml, which still has the hard coded 201 as the minor. This calls evtchn_open which is a C function that creates the node if it doesn't already exist. I don't know much about Modula-2 but the major and minor probably don't need to be passed in, and the C code can do the same thing as the tools do now. But I'll let others decide on that.

-- Steve

linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c +1 -1
diff -r 748e3c64d8f1 linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c
@@ -419,7 +419,7 @@ static struct file_operations evtchn_fop
 };
 
 static struct miscdevice evtchn_miscdev = {
-	.minor        = EVTCHN_MINOR,
+	.minor        = MISC_DYNAMIC_MINOR,
 	.name         = "evtchn",
 	.fops         = &evtchn_fops,
 	.devfs_name   = "misc/evtchn",
linux-2.6-xen-sparse/include/xen/public/evtchn.h +0 -3
diff -r 748e3c64d8f1 linux-2.6-xen-sparse/include/xen/public/evtchn.h
@@ -32,9 +32,6 @@
 
 #ifndef __LINUX_PUBLIC_EVTCHN_H__
 #define __LINUX_PUBLIC_EVTCHN_H__
-
-/* /dev/xen/evtchn resides at device number major=10, minor=201 */
-#define EVTCHN_MINOR 201
 
 /*
  * Bind a fresh port to VIRQ @virq.
tools/libxc/xc_linux.c +58 -3

81 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 2 lines · Steven Rostedt

One thing that is missing though, in this patch, is the update to ./debugger/pdb/evtchn.ml, which still has the hard coded 201 as the

As far as I can tell this is completely abandoned code, it has been unable to compile for a long time. Can't we just remove the directory? The false positives get annoying after a while.

regards
john

#2 lore raw
In reply to Steven Rostedt
Quoted 3 lines · Steven Rostedt

This patch makes evtchn use a dynamic minor number instead. It also updates the code in tools to create the device node if udev fails. The tools now read the sysfs system to find the minor number needed.

Are there really systems out there that mount sysfs yet don't use udev?

It'd be nice to avoid the skanky search-and-create code in userspace. But we'll take it if it really is likely to be useful.

-- Keir

#3 lore raw
Quoted 7 lines · Keir Fraser
Quoted 3 lines · Steven Rostedt

This patch makes evtchn use a dynamic minor number instead. It also updates the code in tools to create the device node if udev fails. The tools now read the sysfs system to find the minor number needed.

Are there really systems out there that mount sysfs yet don't use udev?

I use to :-) (and sometimes still do!)

Quoted 4 lines

It'd be nice to avoid the skanky search-and-create code in userspace. But we'll take it if it really is likely to be useful.

Yeah, I didn't care much for it either, but my intent was to make it as robust as possible. Either way is fine with me.

-- Steve