Commit ceb1ee4c authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] removal of bogus exports

partition_name() moved from md.c to partitions/check.c; disk_name() is not
exported anymore; partition_name() takes dev_t instead of kdev_t.
parent bc2ce86f
......@@ -243,43 +243,6 @@ static mdk_rdev_t * find_rdev(mddev_t * mddev, dev_t dev)
return NULL;
}
static LIST_HEAD(device_names);
char * partition_name(kdev_t dev)
{
struct gendisk *hd;
static char nomem [] = "<nomem>";
dev_name_t *dname;
struct list_head *tmp;
list_for_each(tmp, &device_names) {
dname = list_entry(tmp, dev_name_t, list);
if (kdev_same(dname->dev, dev))
return dname->name;
}
dname = (dev_name_t *) kmalloc(sizeof(*dname), GFP_KERNEL);
if (!dname)
return nomem;
/*
* ok, add this new device name to the list
*/
hd = get_gendisk (dev);
dname->name = NULL;
if (hd)
dname->name = disk_name(hd, minor(dev)-hd->first_minor, dname->namebuf);
if (!dname->name) {
sprintf (dname->namebuf, "[dev %s]", kdevname(dev));
dname->name = dname->namebuf;
}
dname->dev = dev;
list_add(&dname->list, &device_names);
return dname->name;
}
static unsigned int calc_dev_sboffset(struct block_device *bdev)
{
unsigned int size = bdev->bd_inode->i_size >> BLOCK_SIZE_BITS;
......@@ -613,7 +576,7 @@ static void export_array(mddev_t *mddev)
static void print_desc(mdp_disk_t *desc)
{
printk(" DISK<N:%d,%s(%d,%d),R:%d,S:%d>\n", desc->number,
partition_name(mk_kdev(desc->major,desc->minor)),
partition_name(MKDEV(desc->major,desc->minor)),
desc->major,desc->minor,desc->raid_disk,desc->state);
}
......@@ -970,7 +933,7 @@ static mdk_rdev_t *md_import_device(dev_t newdev, int on_disk)
rdev = (mdk_rdev_t *) kmalloc(sizeof(*rdev), GFP_KERNEL);
if (!rdev) {
printk(KERN_ERR "md: could not alloc mem for %s!\n", partition_name(to_kdev_t(newdev)));
printk(KERN_ERR "md: could not alloc mem for %s!\n", partition_name(newdev));
return ERR_PTR(-ENOMEM);
}
memset(rdev, 0, sizeof(*rdev));
......@@ -981,7 +944,7 @@ static mdk_rdev_t *md_import_device(dev_t newdev, int on_disk)
err = lock_rdev(rdev, newdev);
if (err) {
printk(KERN_ERR "md: could not lock %s.\n",
partition_name(to_kdev_t(newdev)));
partition_name(newdev));
goto abort_free;
}
rdev->desc_nr = -1;
......@@ -1753,7 +1716,7 @@ static int autostart_array(dev_t startdev)
start_rdev = md_import_device(startdev, 1);
if (IS_ERR(start_rdev)) {
printk(KERN_WARNING "md: could not import %s!\n", partition_name(to_kdev_t(startdev)));
printk(KERN_WARNING "md: could not import %s!\n", partition_name(startdev));
goto abort;
}
......@@ -1788,7 +1751,7 @@ static int autostart_array(dev_t startdev)
rdev = md_import_device(dev, 1);
if (IS_ERR(rdev)) {
printk(KERN_WARNING "md: could not import %s, trying to run array nevertheless.\n",
partition_name(to_kdev_t(dev)));
partition_name(dev));
continue;
}
list_add(&rdev->same_set, &pending_raid_disks);
......@@ -1993,7 +1956,7 @@ static int hot_generate_error(mddev_t * mddev, dev_t dev)
return -ENODEV;
printk(KERN_INFO "md: trying to generate %s error in md%d ... \n",
partition_name(to_kdev_t(dev)), mdidx(mddev));
partition_name(dev), mdidx(mddev));
rdev = find_rdev(mddev, dev);
if (!rdev) {
......@@ -2027,7 +1990,7 @@ static int hot_remove_disk(mddev_t * mddev, dev_t dev)
return -ENODEV;
printk(KERN_INFO "md: trying to remove %s from md%d ... \n",
partition_name(to_kdev_t(dev)), mdidx(mddev));
partition_name(dev), mdidx(mddev));
rdev = find_rdev(mddev, dev);
if (!rdev)
......@@ -2056,7 +2019,7 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev)
return -ENODEV;
printk(KERN_INFO "md: trying to hot-add %s to md%d ... \n",
partition_name(to_kdev_t(dev)), mdidx(mddev));
partition_name(dev), mdidx(mddev));
if (!mddev->pers->hot_add_disk) {
printk(KERN_WARNING "md%d: personality does not support diskops!\n",
......@@ -2231,7 +2194,7 @@ static int md_ioctl(struct inode *inode, struct file *file,
err = autostart_array(arg);
if (err) {
printk(KERN_WARNING "md: autostart %s failed!\n",
partition_name(val_to_kdev(arg)));
partition_name(arg));
goto abort;
}
goto done;
......@@ -3230,7 +3193,7 @@ static void autostart_arrays(void)
rdev = md_import_device(dev,1);
if (IS_ERR(rdev)) {
printk(KERN_ALERT "md: could not import %s!\n",
partition_name(to_kdev_t(dev)));
partition_name(dev));
continue;
}
if (rdev->faulty) {
......@@ -3498,17 +3461,6 @@ int init_module(void)
return md_init();
}
static void free_device_names(void)
{
while (!list_empty(&device_names)) {
dev_name_t *tmp = list_entry(device_names.next,
dev_name_t, list);
list_del(&tmp->list);
kfree(tmp);
}
}
void cleanup_module(void)
{
md_unregister_thread(md_recovery_thread);
......@@ -3523,15 +3475,12 @@ void cleanup_module(void)
blk_dev[MAJOR_NR].queue = NULL;
blk_clear(MAJOR_NR);
free_device_names();
}
#endif
EXPORT_SYMBOL(md_size);
EXPORT_SYMBOL(register_md_personality);
EXPORT_SYMBOL(unregister_md_personality);
EXPORT_SYMBOL(partition_name);
EXPORT_SYMBOL(md_error);
EXPORT_SYMBOL(md_sync_acct);
EXPORT_SYMBOL(md_done_sync);
......
......@@ -553,3 +553,47 @@ void del_gendisk(struct gendisk *disk)
disk->part = NULL;
}
}
struct dev_name {
struct list_head list;
dev_t dev;
char namebuf[64];
char *name;
};
static LIST_HEAD(device_names);
char *partition_name(dev_t dev)
{
struct gendisk *hd;
static char nomem [] = "<nomem>";
struct dev_name *dname;
struct list_head *tmp;
list_for_each(tmp, &device_names) {
dname = list_entry(tmp, struct dev_name, list);
if (dname->dev == dev)
return dname->name;
}
dname = kmalloc(sizeof(*dname), GFP_KERNEL);
if (!dname)
return nomem;
/*
* ok, add this new device name to the list
*/
hd = get_gendisk(to_kdev_t(dev));
dname->name = NULL;
if (hd)
dname->name = disk_name(hd, MINOR(dev)-hd->first_minor, dname->namebuf);
if (!dname->name) {
sprintf(dname->namebuf, "[dev %s]", kdevname(to_kdev_t(dev)));
dname->name = dname->namebuf;
}
dname->dev = dev;
list_add(&dname->list, &device_names);
return dname->name;
}
......@@ -56,7 +56,7 @@ struct blkpg_partition {
#ifdef __KERNEL__
extern char * partition_name(kdev_t dev);
extern char * partition_name(dev_t dev);
extern int blk_ioctl(struct block_device *bdev, unsigned int cmd, unsigned long arg);
#endif /* __KERNEL__ */
......
......@@ -62,10 +62,9 @@
extern int md_size[MAX_MD_DEVS];
extern char * partition_name (kdev_t dev);
extern inline char * bdev_partition_name (struct block_device *bdev)
{
return partition_name(bdev ? to_kdev_t(bdev->bd_dev) : NODEV);
return partition_name(bdev ? bdev->bd_dev : 0);
}
extern int register_md_personality (int p_num, mdk_personality_t *p);
extern int unregister_md_personality (int p_num);
......
......@@ -299,16 +299,6 @@ typedef struct mdk_thread_s {
#define THREAD_WAKEUP 0
#define MAX_DISKNAME_LEN 64
typedef struct dev_name_s {
struct list_head list;
kdev_t dev;
char namebuf [MAX_DISKNAME_LEN];
char *name;
} dev_name_t;
#define __wait_event_lock_irq(wq, condition, lock) \
do { \
wait_queue_t __wait; \
......
......@@ -576,7 +576,7 @@ EXPORT_SYMBOL(fs_overflowgid);
EXPORT_SYMBOL(fasync_helper);
EXPORT_SYMBOL(kill_fasync);
EXPORT_SYMBOL(disk_name); /* for md.c */
EXPORT_SYMBOL(partition_name);
/* binfmt_aout */
EXPORT_SYMBOL(get_write_access);
......
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