aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-01-03 02:58:54 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-01-03 02:58:54 +0000
commitd54708399dbab43b2867dad1a41eb199eb0813d8 (patch)
tree28d5d123f2babb30d3998febc250a584d92ca065
parent9b1381fd2fb7179f731709542507015799f90a51 (diff)
downloadbusybox-w32-d54708399dbab43b2867dad1a41eb199eb0813d8.tar.gz
busybox-w32-d54708399dbab43b2867dad1a41eb199eb0813d8.tar.bz2
busybox-w32-d54708399dbab43b2867dad1a41eb199eb0813d8.zip
fdisk: remove 8k buffer from bss - OSF labels
are not THAT common anyway
-rw-r--r--util-linux/fdisk.c8
-rw-r--r--util-linux/fdisk_osf.c16
-rw-r--r--util-linux/fdisk_sgi.c49
3 files changed, 37 insertions, 36 deletions
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 27b041e8e..cc6dfa57a 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -2715,7 +2715,7 @@ is_ide_cdrom_or_tape(const char *device)
2715 2715
2716 2716
2717static void 2717static void
2718try(const char *device, int user_specified) 2718trydev(const char *device, int user_specified)
2719{ 2719{
2720 int gb; 2720 int gb;
2721 2721
@@ -2736,7 +2736,7 @@ try(const char *device, int user_specified)
2736 return; 2736 return;
2737 } 2737 }
2738#if ENABLE_FEATURE_OSF_LABEL 2738#if ENABLE_FEATURE_OSF_LABEL
2739 if (btrydev(device) < 0) 2739 if (bsd_trydev(device) < 0)
2740#endif 2740#endif
2741 printf(_("Disk %s doesn't contain a valid " 2741 printf(_("Disk %s doesn't contain a valid "
2742 "partition table\n"), device); 2742 "partition table\n"), device);
@@ -2780,7 +2780,7 @@ tryprocpt(void)
2780 if (isdigit(s[-1])) 2780 if (isdigit(s[-1]))
2781 continue; 2781 continue;
2782 sprintf(devname, "/dev/%s", ptname); 2782 sprintf(devname, "/dev/%s", ptname);
2783 try(devname, 0); 2783 trydev(devname, 0);
2784 } 2784 }
2785#if ENABLE_FEATURE_CLEAN_UP 2785#if ENABLE_FEATURE_CLEAN_UP
2786 fclose(procpt); 2786 fclose(procpt);
@@ -2865,7 +2865,7 @@ int fdisk_main(int argc, char **argv)
2865#endif 2865#endif
2866 listing = 1; 2866 listing = 1;
2867 for (k = 0; k < argc; k++) 2867 for (k = 0; k < argc; k++)
2868 try(argv[k], 1); 2868 trydev(argv[k], 1);
2869 } else { 2869 } else {
2870 /* we no longer have default device names */ 2870 /* we no longer have default device names */
2871 /* but, we can use /proc/partitions instead */ 2871 /* but, we can use /proc/partitions instead */
diff --git a/util-linux/fdisk_osf.c b/util-linux/fdisk_osf.c
index 17acd1977..16a046ea3 100644
--- a/util-linux/fdisk_osf.c
+++ b/util-linux/fdisk_osf.c
@@ -272,12 +272,9 @@ static struct partition *xbsd_part;
272static int xbsd_part_index; 272static int xbsd_part_index;
273#endif 273#endif
274 274
275#if defined(__alpha__)
276/* We access this through a uint64_t * when checksumming */ 275/* We access this through a uint64_t * when checksumming */
277static char disklabelbuffer[BSD_BBSIZE] ATTRIBUTE_ALIGNED(8); 276/* hopefully xmalloc gives us required alignment */
278#else 277static char *disklabelbuffer; /*[BSD_BBSIZE]*/
279static char disklabelbuffer[BSD_BBSIZE];
280#endif
281 278
282static struct xbsd_disklabel xbsd_dlabel; 279static struct xbsd_disklabel xbsd_dlabel;
283 280
@@ -299,7 +296,7 @@ check_osf_label(void)
299} 296}
300 297
301static int 298static int
302btrydev(const char * dev) 299bsd_trydev(const char * dev)
303{ 300{
304 if (xbsd_readlabel(NULL, &xbsd_dlabel) == 0) 301 if (xbsd_readlabel(NULL, &xbsd_dlabel) == 0)
305 return -1; 302 return -1;
@@ -309,7 +306,7 @@ btrydev(const char * dev)
309} 306}
310 307
311static void 308static void
312bmenu(void) 309bsd_menu(void)
313{ 310{
314 puts(_("Command action")); 311 puts(_("Command action"));
315 puts(_("\td\tdelete a BSD partition")); 312 puts(_("\td\tdelete a BSD partition"));
@@ -431,7 +428,7 @@ bsd_select(void)
431 break; 428 break;
432#endif 429#endif
433 default: 430 default:
434 bmenu(); 431 bsd_menu();
435 break; 432 break;
436 } 433 }
437 } 434 }
@@ -921,6 +918,9 @@ xbsd_readlabel(struct partition *p, struct xbsd_disklabel *d)
921{ 918{
922 int t, sector; 919 int t, sector;
923 920
921 if (!disklabelbuffer)
922 disklabelbuffer = xmalloc(BSD_BBSIZE);
923
924 /* p is used only to get the starting sector */ 924 /* p is used only to get the starting sector */
925#if !defined(__alpha__) 925#if !defined(__alpha__)
926 sector = (p ? get_start_sect(p) : 0); 926 sector = (p ? get_start_sect(p) : 0);
diff --git a/util-linux/fdisk_sgi.c b/util-linux/fdisk_sgi.c
index c83ef2420..bb354d8d9 100644
--- a/util-linux/fdisk_sgi.c
+++ b/util-linux/fdisk_sgi.c
@@ -808,42 +808,43 @@ create_sgilabel(void)
808 } 808 }
809 809
810 memset(MBRbuffer, 0, sizeof(MBRbuffer)); 810 memset(MBRbuffer, 0, sizeof(MBRbuffer));
811 /* fields with '//' are already zeroed out by memset above */
812
811 sgilabel->magic = SGI_SSWAP32(SGI_LABEL_MAGIC); 813 sgilabel->magic = SGI_SSWAP32(SGI_LABEL_MAGIC);
812 sgilabel->boot_part = SGI_SSWAP16(0); 814 //sgilabel->boot_part = SGI_SSWAP16(0);
813 sgilabel->swap_part = SGI_SSWAP16(1); 815 sgilabel->swap_part = SGI_SSWAP16(1);
814 816
815 /* sizeof(sgilabel->boot_file) = 16 > 6 */ 817 //memset(sgilabel->boot_file, 0, 16);
816 memset(sgilabel->boot_file, 0, 16); 818 strcpy((char*)sgilabel->boot_file, "/unix"); /* sizeof(sgilabel->boot_file) == 16 > 6 */
817 strcpy((char*)sgilabel->boot_file, "/unix");
818 819
819 sgilabel->devparam.skew = (0); 820 //sgilabel->devparam.skew = (0);
820 sgilabel->devparam.gap1 = (0); 821 //sgilabel->devparam.gap1 = (0);
821 sgilabel->devparam.gap2 = (0); 822 //sgilabel->devparam.gap2 = (0);
822 sgilabel->devparam.sparecyl = (0); 823 //sgilabel->devparam.sparecyl = (0);
823 sgilabel->devparam.pcylcount = SGI_SSWAP16(geometry.cylinders); 824 sgilabel->devparam.pcylcount = SGI_SSWAP16(geometry.cylinders);
824 sgilabel->devparam.head_vol0 = SGI_SSWAP16(0); 825 //sgilabel->devparam.head_vol0 = SGI_SSWAP16(0);
826 /* tracks/cylinder (heads) */
825 sgilabel->devparam.ntrks = SGI_SSWAP16(geometry.heads); 827 sgilabel->devparam.ntrks = SGI_SSWAP16(geometry.heads);
826 /* tracks/cylinder (heads) */ 828 //sgilabel->devparam.cmd_tag_queue_depth = (0);
827 sgilabel->devparam.cmd_tag_queue_depth = (0); 829 //sgilabel->devparam.unused0 = (0);
828 sgilabel->devparam.unused0 = (0); 830 //sgilabel->devparam.unused1 = SGI_SSWAP16(0);
829 sgilabel->devparam.unused1 = SGI_SSWAP16(0); 831 /* sectors/track */
830 sgilabel->devparam.nsect = SGI_SSWAP16(geometry.sectors); 832 sgilabel->devparam.nsect = SGI_SSWAP16(geometry.sectors);
831 /* sectors/track */
832 sgilabel->devparam.bytes = SGI_SSWAP16(512); 833 sgilabel->devparam.bytes = SGI_SSWAP16(512);
833 sgilabel->devparam.ilfact = SGI_SSWAP16(1); 834 sgilabel->devparam.ilfact = SGI_SSWAP16(1);
834 sgilabel->devparam.flags = SGI_SSWAP32(TRACK_FWD| 835 sgilabel->devparam.flags = SGI_SSWAP32(TRACK_FWD|
835 IGNORE_ERRORS|RESEEK); 836 IGNORE_ERRORS|RESEEK);
836 sgilabel->devparam.datarate = SGI_SSWAP32(0); 837 //sgilabel->devparam.datarate = SGI_SSWAP32(0);
837 sgilabel->devparam.retries_on_error = SGI_SSWAP32(1); 838 sgilabel->devparam.retries_on_error = SGI_SSWAP32(1);
838 sgilabel->devparam.ms_per_word = SGI_SSWAP32(0); 839 //sgilabel->devparam.ms_per_word = SGI_SSWAP32(0);
839 sgilabel->devparam.xylogics_gap1 = SGI_SSWAP16(0); 840 //sgilabel->devparam.xylogics_gap1 = SGI_SSWAP16(0);
840 sgilabel->devparam.xylogics_syncdelay = SGI_SSWAP16(0); 841 //sgilabel->devparam.xylogics_syncdelay = SGI_SSWAP16(0);
841 sgilabel->devparam.xylogics_readdelay = SGI_SSWAP16(0); 842 //sgilabel->devparam.xylogics_readdelay = SGI_SSWAP16(0);
842 sgilabel->devparam.xylogics_gap2 = SGI_SSWAP16(0); 843 //sgilabel->devparam.xylogics_gap2 = SGI_SSWAP16(0);
843 sgilabel->devparam.xylogics_readgate = SGI_SSWAP16(0); 844 //sgilabel->devparam.xylogics_readgate = SGI_SSWAP16(0);
844 sgilabel->devparam.xylogics_writecont = SGI_SSWAP16(0); 845 //sgilabel->devparam.xylogics_writecont = SGI_SSWAP16(0);
845 memset( &(sgilabel->directory), 0, sizeof(struct volume_directory)*15 ); 846 //memset( &(sgilabel->directory), 0, sizeof(struct volume_directory)*15 );
846 memset( &(sgilabel->partitions), 0, sizeof(struct sgi_partinfo)*16 ); 847 //memset( &(sgilabel->partitions), 0, sizeof(struct sgi_partinfo)*16 );
847 current_label_type = label_sgi; 848 current_label_type = label_sgi;
848 partitions = 16; 849 partitions = 16;
849 sgi_volumes = 15; 850 sgi_volumes = 15;