This source file includes following definitions.
- atari_check_partition
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #include <linux/fs.h>
21 #include <linux/genhd.h>
22 #include <linux/kernel.h>
23
24 #include <asm/atari_rootsec.h>
25
26
27
28 #define ICD_PARTS
29
30 extern int current_minor;
31
32 void
33 atari_check_partition (struct gendisk *hd, unsigned int dev)
34 {
35 int i, minor = current_minor, m_lim = current_minor + hd->max_p;
36 struct buffer_head *bh;
37 struct rootsector *rs;
38 struct partition_info *pi;
39 ulong extensect;
40 #ifdef ICD_PARTS
41 int part_fmt = 0;
42 #endif
43
44 bh = bread (dev, 0, 1024);
45 if (!bh)
46 {
47 printk (" unable to read block 0\n");
48 return;
49 }
50
51 rs = (struct rootsector *) bh->b_data;
52 printk (" %s%c:", hd->major_name, 'a' + (minor >> hd->minor_shift));
53
54 pi = &rs->part[0];
55 for (i = 1; pi < &rs->part[4] && minor < m_lim; i++, minor++, pi++)
56 {
57 if (pi->flg & 1)
58
59 {
60 if (memcmp (pi->id, "XGM", 3) == 0)
61
62 {
63 struct rootsector *xrs;
64 struct buffer_head *xbh;
65 ulong partsect;
66
67 #ifdef ICD_PARTS
68 part_fmt = 1;
69 #endif
70 partsect = extensect = pi->st;
71 while (1)
72 {
73 xbh = bread (dev, partsect / 2, 1024);
74 if (!xbh)
75 {
76 printk (" block %ld read failed\n", partsect);
77 return;
78 }
79 if (partsect & 1)
80 xrs = (struct rootsector *) &xbh->b_data[512];
81 else
82 xrs = (struct rootsector *) &xbh->b_data[0];
83
84
85 if (!(xrs->part[0].flg & 1)) {
86 printk( "\nFirst sub-partition in extended partition is not valid!\n" );
87 break;
88 }
89
90 hd->part[minor].start_sect = partsect + xrs->part[0].st;
91 hd->part[minor].nr_sects = xrs->part[0].siz;
92 printk (" %s%c%d", hd->major_name,
93 'a' + (minor >> hd->minor_shift), i);
94
95 if (!(xrs->part[1].flg & 1)) {
96
97 brelse( xbh );
98 break;
99 }
100 if (memcmp( xrs->part[1].id, "XGM", 3 ) != 0) {
101 printk( "\nID of extended partition is not XGM!\n" );
102 brelse( xbh );
103 break;
104 }
105
106 partsect = xrs->part[1].st + extensect;
107 brelse (xbh);
108 i++;
109 minor++;
110 if (minor >= m_lim) {
111 printk( "\nMaximum number of partitions reached!\n" );
112 break;
113 }
114 }
115 }
116 else
117 {
118
119 hd->part[minor].start_sect = pi->st;
120 hd->part[minor].nr_sects = pi->siz;
121 printk (" %s%c%d", hd->major_name,
122 'a' + (minor >> hd->minor_shift), i);
123
124 }
125 }
126 }
127 #ifdef ICD_PARTS
128 if ( part_fmt!=1 )
129 {
130 pi = &rs->icdpart[0];
131
132 if (memcmp (pi->id, "GEM", 3) == 0 ||
133 memcmp (pi->id, "BGM", 3) == 0 ||
134 memcmp (pi->id, "RAW", 3) == 0 )
135 {
136 for (i = 1; pi < &rs->icdpart[8] && minor < m_lim; i++, minor++, pi++)
137 {
138
139 if (pi->flg & 1 &&
140 (memcmp (pi->id, "GEM", 3) == 0 ||
141 memcmp (pi->id, "BGM", 3) == 0 ||
142 memcmp (pi->id, "RAW", 3) == 0) )
143 {
144 part_fmt = 2;
145 hd->part[minor].start_sect = pi->st;
146 hd->part[minor].nr_sects = pi->siz;
147 printk (" %s%c%d", hd->major_name,
148 'a' + (minor >> hd->minor_shift), i);
149 }
150 }
151 }
152 }
153 #endif
154 brelse (bh);
155
156 printk ("\n");
157 }
158