From afae25b7c8d594f6349e81dce2b16ce44aa9f0ed Mon Sep 17 00:00:00 2001 From: Alexander Viro Date: Tue, 15 Oct 2002 04:25:18 -0700 Subject: [PATCH] preparation to use of driverfs refcounts, part 1 - partitions * update_partition() split into add_partition() and delete_partition(). * all updating of ->part[] is switched to these two (including initial filling/final cleaning). * per-partition devices are allocated on-demand and never reused. We allocate struct device in add_partition() and put reference to it into hd_struct. ->release() for that struct device frees it. delete_partition() removes reference from hd_struct and does put_device() on it. Basically, we get rid of problems with reused struct device by never reusing them... At that point devices for partitions are nice and sane. --- include/linux/genhd.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/linux') diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 6e1f68900bba..6b859fad6a8a 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -62,7 +62,7 @@ struct hd_struct { sector_t start_sect; sector_t nr_sects; devfs_handle_t de; /* primary (master) devfs entry */ - struct device hd_driverfs_dev; /* support driverfs hiearchy */ + struct device *hd_driverfs_dev; /* support driverfs hiearchy */ }; #define GENHD_FL_REMOVABLE 1 @@ -262,7 +262,8 @@ struct unixware_disklabel { char *disk_name (struct gendisk *hd, int part, char *buf); extern int rescan_partitions(struct gendisk *disk, struct block_device *bdev); -extern void update_partition(struct gendisk *disk, int part); +extern void add_partition(struct gendisk *, int, sector_t, sector_t); +extern void delete_partition(struct gendisk *, int); extern struct gendisk *alloc_disk(int minors); extern void put_disk(struct gendisk *disk); -- cgit v1.2.3