]> git.pld-linux.org Git - packages/util-linux.git/blame - util-linux-fdisk-sectors.patch
- cryptsetup-luks isn't equivalent of cryptsetup
[packages/util-linux.git] / util-linux-fdisk-sectors.patch
CommitLineData
5545a732
JR
1- wrong number of sectors for large disks
2
3--- util-linux-2.13-pre6/fdisk/fdisk.h.sectors 2006-06-12 10:50:11.000000000 +0200
4+++ util-linux-2.13-pre6/fdisk/fdisk.h 2006-06-12 10:50:52.000000000 +0200
5@@ -81,8 +81,8 @@
6 #define SINGULAR 1
7 extern char *const str_units(int);
8
9-extern unsigned int get_start_sect(struct partition *p);
10-extern unsigned int get_nr_sects(struct partition *p);
11+extern unsigned long long get_start_sect(struct partition *p);
12+extern unsigned long long get_nr_sects(struct partition *p);
13
14 extern int osf_label;
15
16--- util-linux-2.13-pre6/fdisk/fdisksgilabel.h.sectors 2004-12-14 00:39:29.000000000 +0100
17+++ util-linux-2.13-pre6/fdisk/fdisksgilabel.h 2006-06-12 10:50:52.000000000 +0200
18@@ -103,8 +103,9 @@
19 /* fdisk.c */
20 #define sgilabel ((sgi_partition *)MBRbuffer)
21 #define sgiparam (sgilabel->devparam)
22-extern char MBRbuffer[MAX_SECTOR_SIZE];
23-extern unsigned int heads, sectors, cylinders, sector_size;
24+extern unsigned char MBRbuffer[MAX_SECTOR_SIZE];
25+extern unsigned int heads, cylinders, sector_size;
26+extern unsigned long long sectors;
27 extern int show_begin;
28 extern int sgi_label;
29 extern char *partition_type(unsigned char type);
30--- util-linux-2.13-pre6/fdisk/fdisksunlabel.h.sectors 2004-12-14 00:39:18.000000000 +0100
31+++ util-linux-2.13-pre6/fdisk/fdisksunlabel.h 2006-06-12 10:50:52.000000000 +0200
32@@ -37,8 +37,9 @@
33 : (__u32)(x))
34
35 /* fdisk.c */
36-extern char MBRbuffer[MAX_SECTOR_SIZE];
37-extern unsigned int heads, sectors, cylinders;
38+extern unsigned char MBRbuffer[MAX_SECTOR_SIZE];
39+extern unsigned int heads, cylinders;
40+extern unsigned long long sectors;
41 extern int show_begin;
42 extern int sun_label;
43 extern char *partition_type(unsigned char type);
44--- util-linux-2.13-pre6/fdisk/fdiskaixlabel.h.sectors 2004-12-14 00:39:47.000000000 +0100
45+++ util-linux-2.13-pre6/fdisk/fdiskaixlabel.h 2006-06-12 10:50:52.000000000 +0200
46@@ -19,9 +19,10 @@
47
48 /* fdisk.c */
49 #define aixlabel ((aix_partition *)MBRbuffer)
50-extern char MBRbuffer[MAX_SECTOR_SIZE];
51+extern unsigned char MBRbuffer[MAX_SECTOR_SIZE];
52 extern char changed[MAXIMUM_PARTS];
53-extern unsigned int heads, sectors, cylinders;
54+extern unsigned int heads, cylinders;
55+extern unsigned long long sectors;
56 extern int show_begin;
57 extern int aix_label;
58 extern char *partition_type(unsigned char type);
59--- util-linux-2.13-pre6/fdisk/fdisksunlabel.c.sectors 2005-07-31 18:00:29.000000000 +0200
60+++ util-linux-2.13-pre6/fdisk/fdisksunlabel.c 2006-06-12 10:50:52.000000000 +0200
61@@ -348,7 +348,7 @@
62 }
63
64 snprintf(sunlabel->info, sizeof(sunlabel->info),
65- "%s%s%s cyl %d alt %d hd %d sec %d",
66+ "%s%s%s cyl %d alt %d hd %d sec %llu",
67 p ? p->vendor : "", (p && *p->vendor) ? " " : "",
68 p ? p->model
69 : (floppy ? _("3,5\" floppy") : _("Linux custom")),
70@@ -655,7 +655,7 @@
71 w = strlen(disk_device);
72 if (xtra)
73 printf(
74- _("\nDisk %s (Sun disk label): %d heads, %d sectors, %d rpm\n"
75+ _("\nDisk %s (Sun disk label): %d heads, %llu sectors, %d rpm\n"
76 "%d cylinders, %d alternate cylinders, %d physical cylinders\n"
77 "%d extra sects/cyl, interleave %d:1\n"
78 "%s\n"
79@@ -669,7 +669,7 @@
80 str_units(PLURAL), units_per_sector);
81 else
82 printf(
83- _("\nDisk %s (Sun disk label): %d heads, %d sectors, %d cylinders\n"
84+ _("\nDisk %s (Sun disk label): %d heads, %llu sectors, %d cylinders\n"
85 "Units = %s of %d * 512 bytes\n\n"),
86 disk_device, heads, sectors, cylinders,
87 str_units(PLURAL), units_per_sector);
88--- util-linux-2.13-pre6/fdisk/fdisk.c.sectors 2006-06-12 10:50:11.000000000 +0200
89+++ util-linux-2.13-pre6/fdisk/fdisk.c 2006-06-12 10:51:53.000000000 +0200
90@@ -64,7 +64,7 @@
91
92 /* A valid partition table sector ends in 0x55 0xaa */
93 static unsigned int
94-part_table_flag(char *b) {
95+part_table_flag(unsigned char *b) {
96 return ((unsigned int) b[510]) + (((unsigned int) b[511]) << 8);
97 }
98
99@@ -74,7 +74,7 @@
100 }
101
102 static void
103-write_part_table_flag(char *b) {
104+write_part_table_flag(unsigned char *b) {
105 b[510] = 0x55;
106 b[511] = 0xaa;
107 }
108@@ -101,17 +101,17 @@
109 store4_little_endian(p->start4, start_sect);
110 }
111
112-unsigned int
113+unsigned long long
114 get_start_sect(struct partition *p) {
115 return read4_little_endian(p->start4);
116 }
117
118 static void
119-set_nr_sects(struct partition *p, unsigned int nr_sects) {
120+set_nr_sects(struct partition *p, unsigned long long nr_sects) {
121 store4_little_endian(p->size4, nr_sects);
122 }
123
124-unsigned int
125+unsigned long long
126 get_nr_sects(struct partition *p) {
127 return read4_little_endian(p->size4);
128 }
129@@ -123,7 +123,7 @@
130 * Raw disk label. For DOS-type partition tables the MBR,
131 * with descriptions of the primary partitions.
132 */
133-char MBRbuffer[MAX_SECTOR_SIZE];
134+unsigned char MBRbuffer[MAX_SECTOR_SIZE];
135
136 /*
137 * per partition table entry data
138@@ -137,8 +137,8 @@
139 struct partition *part_table; /* points into sectorbuffer */
140 struct partition *ext_pointer; /* points into sectorbuffer */
141 char changed; /* boolean */
142- unsigned int offset; /* disk sector number */
143- char *sectorbuffer; /* disk sector contents */
144+ unsigned long long offset; /* disk sector number */
145+ unsigned char *sectorbuffer; /* disk sector contents */
146 } ptes[MAXIMUM_PARTS];
147
148 char *disk_device, /* must be specified */
149@@ -157,15 +157,14 @@
150 unsigned int pt_heads, pt_sectors;
151 unsigned int kern_heads, kern_sectors;
152
153+unsigned long long sector_offset = 1, extended_offset = 0, sectors;
154+
155 unsigned int heads,
156- sectors,
157 cylinders,
158 sector_size = DEFAULT_SECTOR_SIZE,
159 user_set_sector_size = 0,
160- sector_offset = 1,
161 units_per_sector = 1,
162- display_in_cyl_units = 1,
163- extended_offset = 0; /* offset of link pointers */
164+ display_in_cyl_units = 1;
165
166 unsigned long long total_number_of_sectors;
167
168@@ -242,21 +241,21 @@
169 }
170
171 static void
172-seek_sector(int fd, unsigned int secno) {
173+seek_sector(int fd, unsigned long long secno) {
174 off_t offset = (off_t) secno * sector_size;
175 if (lseek(fd, offset, SEEK_SET) == (off_t) -1)
176 fatal(unable_to_seek);
177 }
178
179 static void
180-read_sector(int fd, unsigned int secno, char *buf) {
181+read_sector(int fd, unsigned long long secno, char *buf) {
182 seek_sector(fd, secno);
183 if (read(fd, buf, sector_size) != sector_size)
184 fatal(unable_to_read);
185 }
186
187 static void
188-write_sector(int fd, unsigned int secno, char *buf) {
189+write_sector(int fd, unsigned long long secno, char *buf) {
190 seek_sector(fd, secno);
191 if (write(fd, buf, sector_size) != sector_size)
192 fatal(unable_to_write);
193@@ -264,11 +263,11 @@
194
195 /* Allocate a buffer and read a partition table sector */
196 static void
197-read_pte(int fd, int pno, unsigned int offset) {
198+read_pte(int fd, int pno, unsigned long long offset) {
199 struct pte *pe = &ptes[pno];
200
201 pe->offset = offset;
202- pe->sectorbuffer = (char *) malloc(sector_size);
203+ pe->sectorbuffer = malloc(sector_size);
204 if (!pe->sectorbuffer)
205 fatal(out_of_memory);
206 read_sector(fd, offset, pe->sectorbuffer);
207@@ -276,7 +275,7 @@
208 pe->part_table = pe->ext_pointer = NULL;
209 }
210
211-static unsigned int
212+static unsigned long long
213 get_partition_start(struct pte *pe) {
214 return pe->offset + get_start_sect(pe->part_table);
215 }
216@@ -542,10 +541,10 @@
217 }
218
219 static void
220-set_partition(int i, int doext, unsigned int start, unsigned int stop,
221- int sysid) {
222+set_partition(int i, int doext, unsigned long long start,
223+ unsigned long long stop, int sysid) {
224 struct partition *p;
225- unsigned int offset;
226+ unsigned long long offset;
227
228 if (doext) {
229 p = ptes[i].ext_pointer;
230@@ -1544,7 +1543,7 @@
231 else
232 printf(_("\nDisk %s: %ld.%ld GB, %lld bytes\n"),
233 disk_device, megabytes/1000, (megabytes/100)%10, bytes);
234- printf(_("%d heads, %d sectors/track, %d cylinders"),
235+ printf(_("%d heads, %Ld sectors/track, %d cylinders"),
236 heads, sectors, cylinders);
237 if (units_per_sector == 1)
238 printf(_(", total %llu sectors"),
239@@ -1776,20 +1775,21 @@
240 struct partition *p;
241 int i;
242
243- printf(_("\nDisk %s: %d heads, %d sectors, %d cylinders\n\n"),
244+ printf(_("\nDisk %s: %d heads, %Ld sectors, %d cylinders\n\n"),
245 disk_device, heads, sectors, cylinders);
246 printf(_("Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID\n"));
247 for (i = 0 ; i < partitions; i++) {
248 pe = &ptes[i];
249 p = (extend ? pe->ext_pointer : pe->part_table);
250 if (p != NULL) {
251- printf("%2d %02x%4d%4d%5d%4d%4d%5d%11u%11u %02x\n",
252+ printf("%2d %02x%4d%4d%5d%4d%4d%5d%11lu%11lu %02x\n",
253 i + 1, p->boot_ind, p->head,
254 sector(p->sector),
255 cylinder(p->sector, p->cyl), p->end_head,
256 sector(p->end_sector),
257 cylinder(p->end_sector, p->end_cyl),
258- get_start_sect(p), get_nr_sects(p), p->sys_ind);
259+ (unsigned long) get_start_sect(p),
260+ (unsigned long) get_nr_sects(p), p->sys_ind);
261 if (p->sys_ind)
262 check_consistency(p, i);
263 }
264@@ -1797,7 +1797,7 @@
265 }
266
267 static void
268-fill_bounds(unsigned int *first, unsigned int *last) {
269+fill_bounds(unsigned long long *first, unsigned long long *last) {
270 int i;
271 struct pte *pe = &ptes[0];
272 struct partition *p;
273@@ -1830,7 +1830,7 @@
274 n, h + 1, heads);
275 if (real_s >= sectors)
276 fprintf(stderr, _("Partition %d: sector %d greater than "
277- "maximum %d\n"), n, s, sectors);
278+ "maximum %Ld\n"), n, s, sectors);
279 if (real_c >= cylinders)
280 fprintf(stderr, _("Partitions %d: cylinder %d greater than "
281 "maximum %d\n"), n, real_c + 1, cylinders);
282@@ -1843,8 +1843,8 @@
283 static void
284 verify(void) {
285 int i, j;
286- unsigned int total = 1;
287- unsigned int first[partitions], last[partitions];
288+ unsigned long total = 1;
289+ unsigned long long first[partitions], last[partitions];
290 struct partition *p;
291
292 if (warn_geometry())
293@@ -1888,7 +1888,7 @@
294
295 if (extended_offset) {
296 struct pte *pex = &ptes[ext_index];
297- unsigned int e_last = get_start_sect(pex->part_table) +
298+ unsigned long long e_last = get_start_sect(pex->part_table) +
299 get_nr_sects(pex->part_table) - 1;
300
301 for (i = 4; i < partitions; i++) {
302@@ -1907,8 +1907,8 @@
303 }
304
305 if (total > total_number_of_sectors)
306- printf(_("Total allocated sectors %d greater than the maximum "
307- "%lld\n"), total, total_number_of_sectors);
308+ printf(_("Total allocated sectors %ld greater than the maximum"
309+ " %lld\n"), total, total_number_of_sectors);
310 else if (total < total_number_of_sectors)
311 printf(_("%lld unallocated sectors\n"),
312 total_number_of_sectors - total);
313@@ -1921,7 +1921,7 @@
314 struct partition *p = ptes[n].part_table;
315 struct partition *q = ptes[ext_index].part_table;
316 long long llimit;
317- unsigned int start, stop = 0, limit, temp,
318+ unsigned long long start, stop = 0, limit, temp,
319 first[partitions], last[partitions];
320
321 if (p && p->sys_ind) {
322@@ -1967,7 +1967,7 @@
323 if (start > limit)
324 break;
325 if (start >= temp+units_per_sector && read) {
326- printf(_("Sector %d is already allocated\n"), temp);
327+ printf(_("Sector %llu is already allocated\n"), temp);
328 temp = start;
329 read = 0;
330 }
331@@ -2225,14 +2225,14 @@
332
333 #define MAX_PER_LINE 16
334 static void
335-print_buffer(char pbuffer[]) {
336+print_buffer(unsigned char pbuffer[]) {
337 int i,
338 l;
339
340 for (i = 0, l = 0; i < sector_size; i++, l++) {
341 if (l == 0)
342 printf("0x%03X:", i);
343- printf(" %02X", (unsigned char) pbuffer[i]);
344+ printf(" %02X", pbuffer[i]);
345 if (l == MAX_PER_LINE - 1) {
346 printf("\n");
347 l = -1;
This page took 0.058346 seconds and 4 git commands to generate.