Blame view

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