10 #include <linux/ctype.h>
20 #define VALID_PARTITION(pi,hdsiz) \
22 isalnum((pi)->id[0]) && isalnum((pi)->id[1]) && isalnum((pi)->id[2]) && \
23 be32_to_cpu((pi)->st) <= (hdsiz) && \
24 be32_to_cpu((pi)->st) + be32_to_cpu((pi)->siz) <= (hdsiz))
26 static inline int OK_id(
char *
s)
28 return memcmp (s,
"GEM", 3) == 0 ||
memcmp (s,
"BGM", 3) == 0 ||
29 memcmp (s,
"LNX", 3) == 0 ||
memcmp (s,
"SWP", 3) == 0 ||
30 memcmp (s,
"RAW", 3) == 0 ;
45 rs = read_part_sector(state, 0, §);
50 hd_size = state->
bdev->bd_inode->i_size >> 9;
66 for (slot = 1; pi < &rs->
part[4] && slot < state->
limit; slot++, pi++) {
74 if (
memcmp (pi->
id,
"XGM", 3) != 0) {
87 xrs = read_part_sector(state, partsect, §2);
89 printk (
" block %ld read failed\n", partsect);
95 if (!(xrs->
part[0].flg & 1)) {
96 printk(
"\nFirst sub-partition in extended partition is not valid!\n" );
97 put_dev_sector(sect2);
101 put_partition(state, slot,
105 if (!(xrs->
part[1].flg & 1)) {
107 put_dev_sector(sect2);
110 if (
memcmp( xrs->
part[1].id,
"XGM", 3 ) != 0) {
111 printk(
"\nID of extended partition is not XGM!\n");
112 put_dev_sector(sect2);
117 put_dev_sector(sect2);
118 if (++slot == state->
limit) {
119 printk(
"\nMaximum number of partitions reached!\n" );
131 for (; pi < &rs->
icdpart[8] && slot < state->
limit; slot++, pi++) {
133 if (!((pi->
flg & 1) && OK_id(pi->
id)))
136 put_partition (state, slot,
144 put_dev_sector(sect);