Blame view
block/partitions/check.h
1.11 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 |
#include <linux/pagemap.h> #include <linux/blkdev.h> |
6d1d8050b block, partition:... |
3 |
#include <linux/genhd.h> |
1da177e4c Linux-2.6.12-rc2 |
4 5 6 7 8 |
/* * add_gd_partition adds a partitions details to the devices partition * description. */ |
1da177e4c Linux-2.6.12-rc2 |
9 |
struct parsed_partitions { |
1493bf217 block: use struct... |
10 |
struct block_device *bdev; |
1da177e4c Linux-2.6.12-rc2 |
11 12 13 14 15 |
char name[BDEVNAME_SIZE]; struct { sector_t from; sector_t size; int flags; |
6d1d8050b block, partition:... |
16 17 |
bool has_info; struct partition_meta_info info; |
689d6fac4 block: replace @e... |
18 |
} parts[DISK_MAX_PARTS]; |
1da177e4c Linux-2.6.12-rc2 |
19 20 |
int next; int limit; |
b403a98e2 block: improve au... |
21 |
bool access_beyond_eod; |
9c867fbe0 partitions: fix s... |
22 |
char *pp_buf; |
1da177e4c Linux-2.6.12-rc2 |
23 |
}; |
94ea4158f separate partitio... |
24 25 |
struct parsed_partitions * check_partition(struct gendisk *, struct block_device *); |
1493bf217 block: use struct... |
26 27 28 |
static inline void *read_part_sector(struct parsed_partitions *state, sector_t n, Sector *p) { |
b403a98e2 block: improve au... |
29 30 31 32 |
if (n >= get_capacity(state->bdev->bd_disk)) { state->access_beyond_eod = true; return NULL; } |
1493bf217 block: use struct... |
33 34 |
return read_dev_sector(state->bdev, n, p); } |
1da177e4c Linux-2.6.12-rc2 |
35 36 37 38 |
static inline void put_partition(struct parsed_partitions *p, int n, sector_t from, sector_t size) { if (n < p->limit) { |
9c867fbe0 partitions: fix s... |
39 |
char tmp[1 + BDEVNAME_SIZE + 10 + 1]; |
1da177e4c Linux-2.6.12-rc2 |
40 41 |
p->parts[n].from = from; p->parts[n].size = size; |
9c867fbe0 partitions: fix s... |
42 43 |
snprintf(tmp, sizeof(tmp), " %s%d", p->name, n); strlcat(p->pp_buf, tmp, PAGE_SIZE); |
1da177e4c Linux-2.6.12-rc2 |
44 45 46 47 |
} } extern int warn_no_part; |