* udev and raw devices?
@ 2004-05-21 19:11 Thomas Winischhofer
2004-05-21 19:33 ` Greg KH
2004-05-21 19:42 ` Thomas Winischhofer
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Winischhofer @ 2004-05-21 19:11 UTC (permalink / raw)
To: linux-hotplug
Is that supported? If so, how...?
Reason for asking: Under 2.4, rdvd serves nicely for DVD players which
do their own caching/non-caching. Any chance for gaining this under
2.6+udev?
Thomas
--
Thomas Winischhofer
Vienna/Austria
thomas AT winischhofer DOT net http://www.winischhofer.net/
twini AT xfree86 DOT org
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id149&alloc_idÅ66&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: udev and raw devices?
2004-05-21 19:11 udev and raw devices? Thomas Winischhofer
@ 2004-05-21 19:33 ` Greg KH
2004-05-21 19:42 ` Thomas Winischhofer
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2004-05-21 19:33 UTC (permalink / raw)
To: linux-hotplug
On Fri, May 21, 2004 at 09:11:40PM +0200, Thomas Winischhofer wrote:
>
> Is that supported? If so, how...?
Here's the necessary kernel patch to do this. SuSE has it in their
kernels, and I need to submit it to the main kernel tree one of these
days...
Hope this helps,
greg k-h
--- a/drivers/char/raw.c 2004-05-21 12:33:11 -07:00
+++ b/drivers/char/raw.c 2004-05-21 12:33:11 -07:00
@@ -18,6 +18,7 @@
#include <linux/capability.h>
#include <linux/uio.h>
#include <linux/cdev.h>
+#include <linux/device.h>
#include <asm/uaccess.h>
@@ -26,6 +27,7 @@
int inuse;
};
+static struct class_simple *raw_class;
static struct raw_device_data raw_devices[MAX_RAW_MINORS];
static DECLARE_MUTEX(raw_mutex);
static struct file_operations raw_ctl_fops; /* forward declaration */
@@ -123,6 +125,13 @@
return ioctl_by_bdev(bdev, command, arg);
}
+static void bind_device(struct raw_config_request rq)
+{
+ class_simple_device_remove(MKDEV(RAW_MAJOR, rq.raw_minor));
+ class_simple_device_add(raw_class, MKDEV(RAW_MAJOR, rq.raw_minor),
+ NULL, "raw%d", rq.raw_minor);
+}
+
/*
* Deal with ioctls against the raw-device control interface, to bind
* and unbind other raw devices.
@@ -191,12 +200,15 @@
if (rq.block_major = 0 && rq.block_minor = 0) {
/* unbind */
rawdev->binding = NULL;
+ class_simple_device_remove(MKDEV(RAW_MAJOR, rq.raw_minor));
} else {
rawdev->binding = bdget(dev);
if (rawdev->binding = NULL)
err = -ENOMEM;
- else
+ else {
__module_get(THIS_MODULE);
+ bind_device(rq);
+ }
}
up(&raw_mutex);
} else {
@@ -281,6 +293,15 @@
goto error;
}
+ raw_class = class_simple_create(THIS_MODULE, "raw");
+ if (IS_ERR(raw_class)) {
+ printk(KERN_ERR "Error creating raw class.\n");
+ cdev_del(&raw_cdev);
+ unregister_chrdev_region(dev, MAX_RAW_MINORS);
+ goto error;
+ }
+ class_simple_device_add(raw_class, MKDEV(RAW_MAJOR, 0), NULL, "rawctl");
+
devfs_mk_cdev(MKDEV(RAW_MAJOR, 0),
S_IFCHR | S_IRUGO | S_IWUGO,
"raw/rawctl");
@@ -303,6 +324,8 @@
devfs_remove("raw/raw%d", i);
devfs_remove("raw/rawctl");
devfs_remove("raw");
+ class_simple_device_remove(MKDEV(RAW_MAJOR, 0));
+ class_simple_destroy(raw_class);
cdev_del(&raw_cdev);
unregister_chrdev_region(MKDEV(RAW_MAJOR, 0), MAX_RAW_MINORS);
}
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id149&alloc_idÅ66&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: udev and raw devices?
2004-05-21 19:11 udev and raw devices? Thomas Winischhofer
2004-05-21 19:33 ` Greg KH
@ 2004-05-21 19:42 ` Thomas Winischhofer
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Winischhofer @ 2004-05-21 19:42 UTC (permalink / raw)
To: linux-hotplug
Greg KH wrote:
> On Fri, May 21, 2004 at 09:11:40PM +0200, Thomas Winischhofer wrote:
>
>>Is that supported? If so, how...?
>
>
> Here's the necessary kernel patch to do this. SuSE has it in their
> kernels, and I need to submit it to the main kernel tree one of these
> days...
>
> Hope this helps,
Wow, that was fast. Thanks, I'll try that over the weekend.
Thomas
--
Thomas Winischhofer
Vienna/Austria
thomas AT winischhofer DOT net http://www.winischhofer.net/
twini AT xfree86 DOT org
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id149&alloc_idÅ66&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-05-21 19:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-21 19:11 udev and raw devices? Thomas Winischhofer
2004-05-21 19:33 ` Greg KH
2004-05-21 19:42 ` Thomas Winischhofer
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).