diff options
| author | Alexander Viro <viro@math.psu.edu> | 2002-09-07 03:05:09 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-09-07 03:05:09 -0700 |
| commit | 3708de94cf8d66e46d5ab7d712da81684ff99bf7 (patch) | |
| tree | da3d4469aaba6e171f958172888d0a007b5935f5 /include/linux | |
| parent | 07586b3328bc910bf2cc4c25f7eb2dea7555a69c (diff) | |
[PATCH] (24/25) disk capacity helpers
new helpers - get_capacity(gendisk)/set_capacity(gendisk, sectors).
Drivers switched to these; that eliminates most of the accesses to
disk->part[]... in the drivers (and makes code more readable, while
we are at it). That had caught several bugs when minor had been
used in place of minor>>minor_shift (acsi.c is especially nasty in
that respect; I don't know if it had ever been used with multiple
devices...)
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/genhd.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 6474393eff5e..0bd31339d6f5 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -95,6 +95,14 @@ static inline unsigned long get_start_sect(struct block_device *bdev) { return bdev->bd_offset; } +static inline sector_t get_capacity(struct gendisk *disk) +{ + return disk->part[0].nr_sects; +} +static inline void set_capacity(struct gendisk *disk, sector_t size) +{ + disk->part[0].nr_sects = size; +} #endif /* __KERNEL__ */ |
