* [PATCH] devfs (2/7) - minor miscdev changes
@ 2003-04-18 16:12 Christoph Hellwig
2003-04-18 16:29 ` Roland Dreier
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2003-04-18 16:12 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel
Make sure the first argument to devfs_register is zero.
diff -Nru a/drivers/char/misc.c b/drivers/char/misc.c
--- a/drivers/char/misc.c Fri Apr 18 15:56:44 2003
+++ b/drivers/char/misc.c Fri Apr 18 15:56:44 2003
@@ -166,8 +166,8 @@
int misc_register(struct miscdevice * misc)
{
- static devfs_handle_t devfs_handle, dir;
struct miscdevice *c;
+ char buf[256];
if (misc->next || misc->prev)
return -EBUSY;
@@ -195,14 +195,16 @@
}
if (misc->minor < DYNAMIC_MINORS)
misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7);
- if (!devfs_handle)
- devfs_handle = devfs_mk_dir("misc");
- dir = strchr (misc->name, '/') ? NULL : devfs_handle;
- misc->devfs_handle =
- devfs_register (dir, misc->name, DEVFS_FL_NONE,
- MISC_MAJOR, misc->minor,
- S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP,
- misc->fops, NULL);
+
+
+ /* yuck, yet another stupid special-casing. We should rather
+ add ->devfs_name to avoid this mess. */
+ snprintf(buf, sizeof(buf), strchr(misc->name, '/') ?
+ "%s" : "misc/%s", misc->name);
+ misc->devfs_handle = devfs_register(NULL, buf, 0,
+ MISC_MAJOR, misc->minor,
+ S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP,
+ misc->fops, NULL);
/*
* Add it to the front, so that later devices can "override"
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] devfs (2/7) - minor miscdev changes
2003-04-18 16:12 [PATCH] devfs (2/7) - minor miscdev changes Christoph Hellwig
@ 2003-04-18 16:29 ` Roland Dreier
2003-04-18 17:03 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Roland Dreier @ 2003-04-18 16:29 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-kernel
int misc_register(struct miscdevice * misc)
{
- static devfs_handle_t devfs_handle, dir;
struct miscdevice *c;
+ char buf[256];
Wouldn't it be better not to have a 256-byte buffer on the stack?
- Roland
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] devfs (2/7) - minor miscdev changes
2003-04-18 16:29 ` Roland Dreier
@ 2003-04-18 17:03 ` Christoph Hellwig
0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2003-04-18 17:03 UTC (permalink / raw)
To: Roland Dreier; +Cc: linux-kernel
On Fri, Apr 18, 2003 at 09:29:00AM -0700, Roland Dreier wrote:
> int misc_register(struct miscdevice * misc)
> {
> - static devfs_handle_t devfs_handle, dir;
> struct miscdevice *c;
> + char buf[256];
>
> Wouldn't it be better not to have a 256-byte buffer on the stack?
You're probably right. But 64 bytes should be enough anyway - that's
what devfs uses everywhere else.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-04-18 16:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-18 16:12 [PATCH] devfs (2/7) - minor miscdev changes Christoph Hellwig
2003-04-18 16:29 ` Roland Dreier
2003-04-18 17:03 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox