diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-07-03 10:25:08 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-07-03 10:25:08 -0400 |
commit | 0a1340c185734a57fbf4775927966ad4a1347b02 (patch) | |
tree | d9ed8f0dd809a7c542a3356601125ea5b5aaa804 /fs/partitions | |
parent | af18ddb8864b096e3ed4732e2d4b21c956dcfe3a (diff) | |
parent | 29454dde27d8e340bb1987bad9aa504af7081eba (diff) | |
download | kernel-crypto-0a1340c185734a57fbf4775927966ad4a1347b02.tar.gz kernel-crypto-0a1340c185734a57fbf4775927966ad4a1347b02.tar.xz kernel-crypto-0a1340c185734a57fbf4775927966ad4a1347b02.zip |
Merge rsync://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
include/linux/kernel.h
Diffstat (limited to 'fs/partitions')
-rw-r--r-- | fs/partitions/Makefile | 1 | ||||
-rw-r--r-- | fs/partitions/acorn.c | 1 | ||||
-rw-r--r-- | fs/partitions/check.c | 44 | ||||
-rw-r--r-- | fs/partitions/devfs.c | 130 | ||||
-rw-r--r-- | fs/partitions/devfs.h | 10 | ||||
-rw-r--r-- | fs/partitions/efi.c | 1 | ||||
-rw-r--r-- | fs/partitions/efi.h | 1 | ||||
-rw-r--r-- | fs/partitions/ibm.c | 1 | ||||
-rw-r--r-- | fs/partitions/mac.c | 1 | ||||
-rw-r--r-- | fs/partitions/msdos.c | 1 |
10 files changed, 15 insertions, 176 deletions
diff --git a/fs/partitions/Makefile b/fs/partitions/Makefile index 42c7d3878ed..d713ce6b3e1 100644 --- a/fs/partitions/Makefile +++ b/fs/partitions/Makefile @@ -4,7 +4,6 @@ obj-y := check.o -obj-$(CONFIG_DEVFS_FS) += devfs.o obj-$(CONFIG_ACORN_PARTITION) += acorn.o obj-$(CONFIG_AMIGA_PARTITION) += amiga.o obj-$(CONFIG_ATARI_PARTITION) += atari.o diff --git a/fs/partitions/acorn.c b/fs/partitions/acorn.c index c05085710fc..1bc9f372c7d 100644 --- a/fs/partitions/acorn.c +++ b/fs/partitions/acorn.c @@ -12,7 +12,6 @@ * every single manufacturer of SCSI and IDE cards created their own * method. */ -#include <linux/config.h> #include <linux/buffer_head.h> #include <linux/adfs_fs.h> diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 7ef1f094de9..839634026eb 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c @@ -18,10 +18,8 @@ #include <linux/fs.h> #include <linux/kmod.h> #include <linux/ctype.h> -#include <linux/devfs_fs_kernel.h> #include "check.h" -#include "devfs.h" #include "acorn.h" #include "amiga.h" @@ -161,18 +159,11 @@ check_partition(struct gendisk *hd, struct block_device *bdev) if (!state) return NULL; -#ifdef CONFIG_DEVFS_FS - if (hd->devfs_name[0] != '\0') { - printk(KERN_INFO " /dev/%s:", hd->devfs_name); + disk_name(hd, 0, state->name); + printk(KERN_INFO " %s:", state->name); + if (isdigit(state->name[strlen(state->name)-1])) sprintf(state->name, "p"); - } -#endif - else { - disk_name(hd, 0, state->name); - printk(KERN_INFO " %s:", state->name); - if (isdigit(state->name[strlen(state->name)-1])) - sprintf(state->name, "p"); - } + state->limit = hd->minors; i = res = 0; while (!res && check_part[i]) { @@ -328,7 +319,7 @@ void delete_partition(struct gendisk *disk, int part) p->nr_sects = 0; p->ios[0] = p->ios[1] = 0; p->sectors[0] = p->sectors[1] = 0; - devfs_remove("%s/part%d", disk->devfs_name, part); + sysfs_remove_link(&p->kobj, "subsystem"); if (p->holder_dir) kobject_unregister(p->holder_dir); kobject_uevent(&p->kobj, KOBJ_REMOVE); @@ -349,10 +340,6 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len) p->nr_sects = len; p->partno = part; - devfs_mk_bdev(MKDEV(disk->major, disk->first_minor + part), - S_IFBLK|S_IRUSR|S_IWUSR, - "%s/part%d", disk->devfs_name, part); - if (isdigit(disk->kobj.name[strlen(disk->kobj.name)-1])) snprintf(p->kobj.name,KOBJ_NAME_LEN,"%sp%d",disk->kobj.name,part); else @@ -363,6 +350,7 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len) kobject_add(&p->kobj); if (!disk->part_uevent_suppress) kobject_uevent(&p->kobj, KOBJ_ADD); + sysfs_create_link(&p->kobj, &block_subsys.kset.kobj, "subsystem"); partition_sysfs_add_subdir(p); disk->part[part-1] = p; } @@ -398,6 +386,7 @@ static void disk_sysfs_symlinks(struct gendisk *disk) kfree(disk_name); } } + sysfs_create_link(&disk->kobj, &block_subsys.kset.kobj, "subsystem"); } /* Not exported, helper to add_disk(). */ @@ -420,14 +409,8 @@ void register_disk(struct gendisk *disk) disk_sysfs_add_subdirs(disk); /* No minors to use for partitions */ - if (disk->minors == 1) { - if (disk->devfs_name[0] != '\0') - devfs_add_disk(disk); + if (disk->minors == 1) goto exit; - } - - /* always add handle for the whole disk */ - devfs_add_partitioned(disk); /* No such device (e.g., media were just removed) */ if (!get_capacity(disk)) @@ -481,6 +464,10 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev) sector_t from = state->parts[p].from; if (!size) continue; + if (from + size > get_capacity(disk)) { + printk(" %s: p%d exceeds device capacity\n", + disk->disk_name, p); + } add_partition(disk, p, from, size); #ifdef CONFIG_BLK_DEV_MD if (state->parts[p].flags) @@ -496,8 +483,8 @@ unsigned char *read_dev_sector(struct block_device *bdev, sector_t n, Sector *p) struct address_space *mapping = bdev->bd_inode->i_mapping; struct page *page; - page = read_cache_page(mapping, (pgoff_t)(n >> (PAGE_CACHE_SHIFT-9)), - (filler_t *)mapping->a_ops->readpage, NULL); + page = read_mapping_page(mapping, (pgoff_t)(n >> (PAGE_CACHE_SHIFT-9)), + NULL); if (!IS_ERR(page)) { wait_on_page_locked(page); if (!PageUptodate(page)) @@ -531,8 +518,6 @@ void del_gendisk(struct gendisk *disk) disk_stat_set_all(disk, 0); disk->stamp = 0; - devfs_remove_disk(disk); - kobject_uevent(&disk->kobj, KOBJ_REMOVE); if (disk->holder_dir) kobject_unregister(disk->holder_dir); @@ -548,5 +533,6 @@ void del_gendisk(struct gendisk *disk) put_device(disk->driverfs_dev); disk->driverfs_dev = NULL; } + sysfs_remove_link(&disk->kobj, "subsystem"); kobject_del(&disk->kobj); } diff --git a/fs/partitions/devfs.c b/fs/partitions/devfs.c deleted file mode 100644 index 3f0a780c9ce..00000000000 --- a/fs/partitions/devfs.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * This tries to keep block devices away from devfs as much as possible. - */ -#include <linux/fs.h> -#include <linux/devfs_fs_kernel.h> -#include <linux/vmalloc.h> -#include <linux/genhd.h> -#include <linux/bitops.h> -#include <linux/mutex.h> - - -struct unique_numspace { - u32 num_free; /* Num free in bits */ - u32 length; /* Array length in bytes */ - unsigned long *bits; - struct semaphore mutex; -}; - -static DEFINE_MUTEX(numspace_mutex); - -static int expand_numspace(struct unique_numspace *s) -{ - u32 length; - void *bits; - - if (s->length < 16) - length = 16; - else - length = s->length << 1; - - bits = vmalloc(length); - if (!bits) - return -ENOMEM; - if (s->bits) { - memcpy(bits, s->bits, s->length); - vfree(s->bits); - } - - s->num_free = (length - s->length) << 3; - s->bits = bits; - memset(bits + s->length, 0, length - s->length); - s->length = length; - - return 0; -} - -static int alloc_unique_number(struct unique_numspace *s) -{ - int rval = 0; - - mutex_lock(&numspace_mutex); - if (s->num_free < 1) - rval = expand_numspace(s); - if (!rval) { - rval = find_first_zero_bit(s->bits, s->length << 3); - --s->num_free; - __set_bit(rval, s->bits); - } - mutex_unlock(&numspace_mutex); - - return rval; -} - -static void dealloc_unique_number(struct unique_numspace *s, int number) -{ - int old_val; - - if (number >= 0) { - mutex_lock(&numspace_mutex); - old_val = __test_and_clear_bit(number, s->bits); - if (old_val) - ++s->num_free; - mutex_unlock(&numspace_mutex); - } -} - -static struct unique_numspace disc_numspace; -static struct unique_numspace cdrom_numspace; - -void devfs_add_partitioned(struct gendisk *disk) -{ - char dirname[64], symlink[16]; - - devfs_mk_dir(disk->devfs_name); - devfs_mk_bdev(MKDEV(disk->major, disk->first_minor), - S_IFBLK|S_IRUSR|S_IWUSR, - "%s/disc", disk->devfs_name); - - disk->number = alloc_unique_number(&disc_numspace); - - sprintf(symlink, "discs/disc%d", disk->number); - sprintf(dirname, "../%s", disk->devfs_name); - devfs_mk_symlink(symlink, dirname); - -} - -void devfs_add_disk(struct gendisk *disk) -{ - devfs_mk_bdev(MKDEV(disk->major, disk->first_minor), - (disk->flags & GENHD_FL_CD) ? - S_IFBLK|S_IRUGO|S_IWUGO : - S_IFBLK|S_IRUSR|S_IWUSR, - "%s", disk->devfs_name); - - if (disk->flags & GENHD_FL_CD) { - char dirname[64], symlink[16]; - - disk->number = alloc_unique_number(&cdrom_numspace); - - sprintf(symlink, "cdroms/cdrom%d", disk->number); - sprintf(dirname, "../%s", disk->devfs_name); - devfs_mk_symlink(symlink, dirname); - } -} - -void devfs_remove_disk(struct gendisk *disk) -{ - if (disk->minors != 1) { - devfs_remove("discs/disc%d", disk->number); - dealloc_unique_number(&disc_numspace, disk->number); - devfs_remove("%s/disc", disk->devfs_name); - } - if (disk->flags & GENHD_FL_CD) { - devfs_remove("cdroms/cdrom%d", disk->number); - dealloc_unique_number(&cdrom_numspace, disk->number); - } - devfs_remove(disk->devfs_name); -} - - diff --git a/fs/partitions/devfs.h b/fs/partitions/devfs.h deleted file mode 100644 index 176118b4e49..00000000000 --- a/fs/partitions/devfs.h +++ /dev/null @@ -1,10 +0,0 @@ - -#ifdef CONFIG_DEVFS_FS -void devfs_add_disk(struct gendisk *dev); -void devfs_add_partitioned(struct gendisk *dev); -void devfs_remove_disk(struct gendisk *dev); -#else -# define devfs_add_disk(disk) do { } while (0) -# define devfs_add_partitioned(disk) do { } while (0) -# define devfs_remove_disk(disk) do { } while (0) -#endif diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c index 0f5b017aeba..63730282ad8 100644 --- a/fs/partitions/efi.c +++ b/fs/partitions/efi.c @@ -91,7 +91,6 @@ * - Code works, detects all the partitions. * ************************************************************/ -#include <linux/config.h> #include <linux/crc32.h> #include "check.h" #include "efi.h" diff --git a/fs/partitions/efi.h b/fs/partitions/efi.h index c44fb056144..2cc89d0475b 100644 --- a/fs/partitions/efi.h +++ b/fs/partitions/efi.h @@ -26,7 +26,6 @@ #define FS_PART_EFI_H_INCLUDED #include <linux/types.h> -#include <linux/config.h> #include <linux/fs.h> #include <linux/genhd.h> #include <linux/kernel.h> diff --git a/fs/partitions/ibm.c b/fs/partitions/ibm.c index 830c55d86ab..d352a7381fe 100644 --- a/fs/partitions/ibm.c +++ b/fs/partitions/ibm.c @@ -6,7 +6,6 @@ * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 */ -#include <linux/config.h> #include <linux/buffer_head.h> #include <linux/hdreg.h> #include <linux/slab.h> diff --git a/fs/partitions/mac.c b/fs/partitions/mac.c index 813292f2121..c0871002d00 100644 --- a/fs/partitions/mac.c +++ b/fs/partitions/mac.c @@ -6,7 +6,6 @@ * Re-organised Feb 1998 Russell King */ -#include <linux/config.h> #include <linux/ctype.h> #include "check.h" #include "mac.h" diff --git a/fs/partitions/msdos.c b/fs/partitions/msdos.c index 9935d254186..8f12587c312 100644 --- a/fs/partitions/msdos.c +++ b/fs/partitions/msdos.c @@ -19,7 +19,6 @@ * Re-organised Feb 1998 Russell King */ -#include <linux/config.h> #include "check.h" #include "msdos.h" |