Commit 4d40f872 authored by Richard Gooch's avatar Richard Gooch

[PATCH] devfs patch for 2.5.8-pre2

- Documentation updates
- BKL removal (devfs doesn't need the BKL)
- Changed <devfs_rmdir> to allow later additions if not yet empty
- Added calls to <devfs_register_partitions> in drivers/block/blkpc.c
  <add_partition> and <del_partition>
- Bug fixes in unique number and devnum allocators.
parent d720d94f
...@@ -1885,3 +1885,23 @@ Changes for patch v208 ...@@ -1885,3 +1885,23 @@ Changes for patch v208
- Cleaned up declaration of <stat_read> - Cleaned up declaration of <stat_read>
- Updated README from master HTML file - Updated README from master HTML file
===============================================================================
Changes for patch v209
- Updated README from master HTML file
- Removed silently introduced calls to lock_kernel() and
unlock_kernel() due to recent VFS locking changes. BKL isn't
required in devfs
- Changed <devfs_rmdir> to allow later additions if not yet empty
- Added calls to <devfs_register_partitions> in drivers/block/blkpc.c
<add_partition> and <del_partition>
- Fixed bug in <devfs_alloc_unique_number>: was clearing beyond
bitfield
- Fixed bitfield data type for <devfs_*alloc_devnum>
- Made major bitfield type and initialiser 64 bit safe
...@@ -3,7 +3,7 @@ Devfs (Device File System) FAQ ...@@ -3,7 +3,7 @@ Devfs (Device File System) FAQ
Linux Devfs (Device File System) FAQ Linux Devfs (Device File System) FAQ
Richard Gooch Richard Gooch
24-JAN-2002 4-APR-2002
Document languages: Document languages:
...@@ -803,12 +803,19 @@ devfsd /dev ...@@ -803,12 +803,19 @@ devfsd /dev
add the following lines to your /etc/devfsd.conf file: add the following lines to your /etc/devfsd.conf file:
REGISTER ^pt[sy]/.* IGNORE REGISTER ^pt[sy] IGNORE
CHANGE ^pt[sy]/.* IGNORE CREATE ^pt[sy] IGNORE
CHANGE ^pt[sy] IGNORE
DELETE ^pt[sy] IGNORE
REGISTER .* COPY /dev-state/$devname $devpath REGISTER .* COPY /dev-state/$devname $devpath
CHANGE .* COPY $devpath /dev-state/$devname
CREATE .* COPY $devpath /dev-state/$devname CREATE .* COPY $devpath /dev-state/$devname
CHANGE .* COPY $devpath /dev-state/$devname
DELETE .* CFUNCTION GLOBAL unlink /dev-state/$devname
RESTORE /dev-state
Note that the sample devfsd.conf file contains these lines,
as well as other sample configurations you may find useful. See the
devfsd distribution
reboot. reboot.
...@@ -872,7 +879,8 @@ You can then slowly migrate your system to using the new device names ...@@ -872,7 +879,8 @@ You can then slowly migrate your system to using the new device names
(for example, by starting with /etc/fstab), and then limiting the (for example, by starting with /etc/fstab), and then limiting the
compatibility entries that devfsd creates. compatibility entries that devfsd creates.
MAKE SURE YOU INSTALL DEVFSD BEFORE YOU BOOT A DEVFS-ENABLED KERNEL! IF YOU CONFIGURE TO MOUNT DEVFS AT BOOT, MAKE SURE YOU INSTALL DEVFSD
BEFORE YOU BOOT A DEVFS-ENABLED KERNEL!
Now that devfs has gone into the 2.3.46 kernel, I'm getting a lot of Now that devfs has gone into the 2.3.46 kernel, I'm getting a lot of
reports back. Many of these are because people are trying to run reports back. Many of these are because people are trying to run
...@@ -1565,6 +1573,24 @@ character device, named pipe, etc.) may change without notice. Only ...@@ -1565,6 +1573,24 @@ character device, named pipe, etc.) may change without notice. Only
the existence of the entry should be relied upon. the existence of the entry should be relied upon.
When I start devfsd, I see the error:
Error opening file: ".devfsd" No such file or directory?
This means that devfs is not mounted. Make sure you have devfs mounted.
How do I mount devfs?
First make sure you have devfs compiled into your kernel (see
above). Then you will either need to:
set CONFIG_DEVFS_MOUNT=y in your kernel config
pass devfs=mount to your boot loader
mount devfs manually in your boot scripts with:
mount -t none devfs /dev
...@@ -1760,6 +1786,15 @@ steps below: ...@@ -1760,6 +1786,15 @@ steps below:
make sure you have enabled debugging output when configuring your
kernel. You will need to set (at least) the following config options:
CONFIG_DEVFS_DEBUG=y
CONFIG_DEBUG_KERNEL=y
CONFIG_DEBUG_SLAB=y
please make sure you have the latest devfs patches applied. The please make sure you have the latest devfs patches applied. The
latest kernel version might not have the latest devfs patches applied latest kernel version might not have the latest devfs patches applied
yet (Linus is very busy) yet (Linus is very busy)
...@@ -1768,7 +1803,10 @@ yet (Linus is very busy) ...@@ -1768,7 +1803,10 @@ yet (Linus is very busy)
save a copy of your complete kernel logs (preferably by save a copy of your complete kernel logs (preferably by
using the dmesg programme) for later inclusion in your bug using the dmesg programme) for later inclusion in your bug
report. You may need to use the -s switch to increase the report. You may need to use the -s switch to increase the
internal buffer size so you can capture all the boot messages internal buffer size so you can capture all the boot messages.
Don't edit or trim the dmesg output
try booting with devfs=dall passed to the kernel boot try booting with devfs=dall passed to the kernel boot
...@@ -1925,7 +1963,7 @@ http://www.atnf.csiro.au/~rgooch/linux/docs/devfs.html ...@@ -1925,7 +1963,7 @@ http://www.atnf.csiro.au/~rgooch/linux/docs/devfs.html
A Korean translation by viatoris@nownuri.net is available at A Korean translation by viatoris@nownuri.net is available at
http://viatoris.new21.org/devfs/devfs.html http://your.destiny.pe.kr/devfs/devfs.html
......
...@@ -113,6 +113,7 @@ int add_partition(struct block_device *bdev, struct blkpg_partition *p) ...@@ -113,6 +113,7 @@ int add_partition(struct block_device *bdev, struct blkpg_partition *p)
g->part[minor].nr_sects = plength; g->part[minor].nr_sects = plength;
if (g->sizes) if (g->sizes)
g->sizes[minor] = (plength >> (BLOCK_SIZE_BITS - 9)); g->sizes[minor] = (plength >> (BLOCK_SIZE_BITS - 9));
devfs_register_partitions (g, first_minor, 0);
return 0; return 0;
} }
...@@ -172,6 +173,7 @@ int del_partition(struct block_device *bdev, struct blkpg_partition *p) ...@@ -172,6 +173,7 @@ int del_partition(struct block_device *bdev, struct blkpg_partition *p)
g->part[minor].nr_sects = 0; g->part[minor].nr_sects = 0;
if (g->sizes) if (g->sizes)
g->sizes[minor] = 0; g->sizes[minor] = 0;
devfs_register_partitions (g, first_minor, 0);
bd_release(bdevp); bd_release(bdevp);
bdput(bdevp); bdput(bdevp);
......
This diff is collapsed.
/* devfs (Device FileSystem) utilities. /* devfs (Device FileSystem) utilities.
Copyright (C) 1999-2001 Richard Gooch Copyright (C) 1999-2002 Richard Gooch
This library is free software; you can redistribute it and/or This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public modify it under the terms of the GNU Library General Public
...@@ -48,6 +48,12 @@ ...@@ -48,6 +48,12 @@
20010818 Richard Gooch <rgooch@atnf.csiro.au> 20010818 Richard Gooch <rgooch@atnf.csiro.au>
Updated major masks up to Linus' "no new majors" proclamation. Updated major masks up to Linus' "no new majors" proclamation.
Block: were 126 now 122 free, char: were 26 now 19 free. Block: were 126 now 122 free, char: were 26 now 19 free.
20020324 Richard Gooch <rgooch@atnf.csiro.au>
Fixed bug in <devfs_alloc_unique_number>: was clearing beyond
bitfield.
20020326 Richard Gooch <rgooch@atnf.csiro.au>
Fixed bitfield data type for <devfs_*alloc_devnum>.
Made major bitfield type and initialiser 64 bit safe.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -125,8 +131,13 @@ EXPORT_SYMBOL(devfs_register_series); ...@@ -125,8 +131,13 @@ EXPORT_SYMBOL(devfs_register_series);
struct major_list struct major_list
{ {
spinlock_t lock; spinlock_t lock;
__u32 bits[8]; unsigned long bits[256 / BITS_PER_LONG];
}; };
#if BITS_PER_LONG == 32
# define INITIALISER64(low,high) (low), (high)
#else
# define INITIALISER64(low,high) ( (high) << 32 | (low) )
#endif
/* Block majors already assigned: /* Block majors already assigned:
0-3, 7-9, 11-63, 65-99, 101-113, 120-127, 199, 201, 240-255 0-3, 7-9, 11-63, 65-99, 101-113, 120-127, 199, 201, 240-255
...@@ -134,14 +145,11 @@ struct major_list ...@@ -134,14 +145,11 @@ struct major_list
*/ */
static struct major_list block_major_list = static struct major_list block_major_list =
{SPIN_LOCK_UNLOCKED, {SPIN_LOCK_UNLOCKED,
{0xfffffb8f, /* Majors 0 to 31 */ {INITIALISER64 (0xfffffb8f, 0xffffffff), /* Majors 0-31, 32-63 */
0xffffffff, /* Majors 32 to 63 */ INITIALISER64 (0xfffffffe, 0xff03ffef), /* Majors 64-95, 96-127 */
0xfffffffe, /* Majors 64 to 95 */ INITIALISER64 (0x00000000, 0x00000000), /* Majors 128-159, 160-191 */
0xff03ffef, /* Majors 96 to 127 */ INITIALISER64 (0x00000280, 0xffff0000), /* Majors 192-223, 224-255 */
0x00000000, /* Majors 128 to 159 */ }
0x00000000, /* Majors 160 to 191 */
0x00000280, /* Majors 192 to 223 */
0xffff0000} /* Majors 224 to 255 */
}; };
/* Char majors already assigned: /* Char majors already assigned:
...@@ -150,14 +158,11 @@ static struct major_list block_major_list = ...@@ -150,14 +158,11 @@ static struct major_list block_major_list =
*/ */
static struct major_list char_major_list = static struct major_list char_major_list =
{SPIN_LOCK_UNLOCKED, {SPIN_LOCK_UNLOCKED,
{0xfffffeff, /* Majors 0 to 31 */ {INITIALISER64 (0xfffffeff, 0xffffffff), /* Majors 0-31, 32-63 */
0xffffffff, /* Majors 32 to 63 */ INITIALISER64 (0xffffffff, 0xffffffff), /* Majors 64-95, 96-127 */
0xffffffff, /* Majors 64 to 95 */ INITIALISER64 (0x7cffffff, 0xffffffff), /* Majors 128-159, 160-191 */
0xffffffff, /* Majors 96 to 127 */ INITIALISER64 (0x3f0fffff, 0xffff007f), /* Majors 192-223, 224-255 */
0x7cffffff, /* Majors 128 to 159 */ }
0xffffffff, /* Majors 160 to 191 */
0x3f0fffff, /* Majors 192 to 223 */
0xffff007f} /* Majors 224 to 255 */
}; };
...@@ -212,7 +217,7 @@ EXPORT_SYMBOL(devfs_dealloc_major); ...@@ -212,7 +217,7 @@ EXPORT_SYMBOL(devfs_dealloc_major);
struct minor_list struct minor_list
{ {
int major; int major;
__u32 bits[8]; unsigned long bits[256 / BITS_PER_LONG];
struct minor_list *next; struct minor_list *next;
}; };
...@@ -267,7 +272,7 @@ kdev_t devfs_alloc_devnum (char type) ...@@ -267,7 +272,7 @@ kdev_t devfs_alloc_devnum (char type)
if (minor >= 256) continue; if (minor >= 256) continue;
__set_bit (minor, entry->bits); __set_bit (minor, entry->bits);
up (semaphore); up (semaphore);
return mk_kdev(entry->major, minor); return mk_kdev (entry->major, minor);
} }
/* Need to allocate a new major */ /* Need to allocate a new major */
if ( ( entry = kmalloc (sizeof *entry, GFP_KERNEL) ) == NULL ) if ( ( entry = kmalloc (sizeof *entry, GFP_KERNEL) ) == NULL )
...@@ -289,7 +294,7 @@ kdev_t devfs_alloc_devnum (char type) ...@@ -289,7 +294,7 @@ kdev_t devfs_alloc_devnum (char type)
else list->last->next = entry; else list->last->next = entry;
list->last = entry; list->last = entry;
up (semaphore); up (semaphore);
return mk_kdev(entry->major, 0); return mk_kdev (entry->major, 0);
} /* End Function devfs_alloc_devnum */ } /* End Function devfs_alloc_devnum */
EXPORT_SYMBOL(devfs_alloc_devnum); EXPORT_SYMBOL(devfs_alloc_devnum);
...@@ -309,7 +314,7 @@ void devfs_dealloc_devnum (char type, kdev_t devnum) ...@@ -309,7 +314,7 @@ void devfs_dealloc_devnum (char type, kdev_t devnum)
struct device_list *list; struct device_list *list;
struct minor_list *entry; struct minor_list *entry;
if (kdev_none(devnum)) return; if ( kdev_none (devnum) ) return;
if (type == DEVFS_SPECIAL_CHR) if (type == DEVFS_SPECIAL_CHR)
{ {
semaphore = &char_semaphore; semaphore = &char_semaphore;
...@@ -355,7 +360,6 @@ int devfs_alloc_unique_number (struct unique_numspace *space) ...@@ -355,7 +360,6 @@ int devfs_alloc_unique_number (struct unique_numspace *space)
{ {
int number; int number;
unsigned int length; unsigned int length;
__u32 *bits;
/* Get around stupid lack of semaphore initialiser */ /* Get around stupid lack of semaphore initialiser */
spin_lock (&space->init_lock); spin_lock (&space->init_lock);
...@@ -368,6 +372,8 @@ int devfs_alloc_unique_number (struct unique_numspace *space) ...@@ -368,6 +372,8 @@ int devfs_alloc_unique_number (struct unique_numspace *space)
down (&space->semaphore); down (&space->semaphore);
if (space->num_free < 1) if (space->num_free < 1)
{ {
void *bits;
if (space->length < 16) length = 16; if (space->length < 16) length = 16;
else length = space->length << 1; else length = space->length << 1;
if ( ( bits = vmalloc (length) ) == NULL ) if ( ( bits = vmalloc (length) ) == NULL )
......
...@@ -54,7 +54,7 @@ struct unique_numspace ...@@ -54,7 +54,7 @@ struct unique_numspace
unsigned char sem_initialised; unsigned char sem_initialised;
unsigned int num_free; /* Num free in bits */ unsigned int num_free; /* Num free in bits */
unsigned int length; /* Array length in bytes */ unsigned int length; /* Array length in bytes */
__u32 *bits; unsigned long *bits;
struct semaphore semaphore; struct semaphore semaphore;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment