svn commit: trunk/busybox/util-linux

vda at busybox.net vda at busybox.net
Wed Jan 3 02:58:56 UTC 2007


Author: vda
Date: 2007-01-02 18:58:54 -0800 (Tue, 02 Jan 2007)
New Revision: 17141

Log:
fdisk: remove 8k buffer from bss - OSF labels
are not THAT common anyway


Modified:
   trunk/busybox/util-linux/fdisk.c
   trunk/busybox/util-linux/fdisk_osf.c
   trunk/busybox/util-linux/fdisk_sgi.c


Changeset:
Modified: trunk/busybox/util-linux/fdisk.c
===================================================================
--- trunk/busybox/util-linux/fdisk.c	2007-01-03 02:56:00 UTC (rev 17140)
+++ trunk/busybox/util-linux/fdisk.c	2007-01-03 02:58:54 UTC (rev 17141)
@@ -2715,7 +2715,7 @@
 
 
 static void
-try(const char *device, int user_specified)
+trydev(const char *device, int user_specified)
 {
 	int gb;
 
@@ -2736,7 +2736,7 @@
 				return;
 			}
 #if ENABLE_FEATURE_OSF_LABEL
-			if (btrydev(device) < 0)
+			if (bsd_trydev(device) < 0)
 #endif
 				printf(_("Disk %s doesn't contain a valid "
 					"partition table\n"), device);
@@ -2780,7 +2780,7 @@
 		if (isdigit(s[-1]))
 			continue;
 		sprintf(devname, "/dev/%s", ptname);
-		try(devname, 0);
+		trydev(devname, 0);
 	}
 #if ENABLE_FEATURE_CLEAN_UP
 	fclose(procpt);
@@ -2865,7 +2865,7 @@
 #endif
 			listing = 1;
 			for (k = 0; k < argc; k++)
-				try(argv[k], 1);
+				trydev(argv[k], 1);
 		} else {
 			/* we no longer have default device names */
 			/* but, we can use /proc/partitions instead */

Modified: trunk/busybox/util-linux/fdisk_osf.c
===================================================================
--- trunk/busybox/util-linux/fdisk_osf.c	2007-01-03 02:56:00 UTC (rev 17140)
+++ trunk/busybox/util-linux/fdisk_osf.c	2007-01-03 02:58:54 UTC (rev 17141)
@@ -272,12 +272,9 @@
 static int xbsd_part_index;
 #endif
 
-#if defined(__alpha__)
 /* We access this through a uint64_t * when checksumming */
-static char disklabelbuffer[BSD_BBSIZE] ATTRIBUTE_ALIGNED(8);
-#else
-static char disklabelbuffer[BSD_BBSIZE];
-#endif
+/* hopefully xmalloc gives us required alignment */
+static char *disklabelbuffer; /*[BSD_BBSIZE]*/
 
 static struct xbsd_disklabel xbsd_dlabel;
 
@@ -299,7 +296,7 @@
 }
 
 static int
-btrydev(const char * dev)
+bsd_trydev(const char * dev)
 {
 	if (xbsd_readlabel(NULL, &xbsd_dlabel) == 0)
 		return -1;
@@ -309,7 +306,7 @@
 }
 
 static void
-bmenu(void)
+bsd_menu(void)
 {
 	puts(_("Command action"));
 	puts(_("\td\tdelete a BSD partition"));
@@ -431,7 +428,7 @@
 			break;
 #endif
 		default:
-			bmenu();
+			bsd_menu();
 			break;
 		}
 	}
@@ -921,6 +918,9 @@
 {
 	int t, sector;
 
+	if (!disklabelbuffer)
+		disklabelbuffer = xmalloc(BSD_BBSIZE);
+
 	/* p is used only to get the starting sector */
 #if !defined(__alpha__)
 	sector = (p ? get_start_sect(p) : 0);

Modified: trunk/busybox/util-linux/fdisk_sgi.c
===================================================================
--- trunk/busybox/util-linux/fdisk_sgi.c	2007-01-03 02:56:00 UTC (rev 17140)
+++ trunk/busybox/util-linux/fdisk_sgi.c	2007-01-03 02:58:54 UTC (rev 17141)
@@ -808,42 +808,43 @@
 	}
 
 	memset(MBRbuffer, 0, sizeof(MBRbuffer));
+	/* fields with '//' are already zeroed out by memset above */
+
 	sgilabel->magic = SGI_SSWAP32(SGI_LABEL_MAGIC);
-	sgilabel->boot_part = SGI_SSWAP16(0);
+	//sgilabel->boot_part = SGI_SSWAP16(0);
 	sgilabel->swap_part = SGI_SSWAP16(1);
 
-	/* sizeof(sgilabel->boot_file) = 16 > 6 */
-	memset(sgilabel->boot_file, 0, 16);
-	strcpy((char*)sgilabel->boot_file, "/unix");
+	//memset(sgilabel->boot_file, 0, 16);
+	strcpy((char*)sgilabel->boot_file, "/unix"); /* sizeof(sgilabel->boot_file) == 16 > 6 */
 
-	sgilabel->devparam.skew                     = (0);
-	sgilabel->devparam.gap1                     = (0);
-	sgilabel->devparam.gap2                     = (0);
-	sgilabel->devparam.sparecyl                 = (0);
+	//sgilabel->devparam.skew                     = (0);
+	//sgilabel->devparam.gap1                     = (0);
+	//sgilabel->devparam.gap2                     = (0);
+	//sgilabel->devparam.sparecyl                 = (0);
 	sgilabel->devparam.pcylcount                = SGI_SSWAP16(geometry.cylinders);
-	sgilabel->devparam.head_vol0                = SGI_SSWAP16(0);
+	//sgilabel->devparam.head_vol0                = SGI_SSWAP16(0);
+	/* tracks/cylinder (heads) */
 	sgilabel->devparam.ntrks                    = SGI_SSWAP16(geometry.heads);
-						/* tracks/cylinder (heads) */
-	sgilabel->devparam.cmd_tag_queue_depth      = (0);
-	sgilabel->devparam.unused0                  = (0);
-	sgilabel->devparam.unused1                  = SGI_SSWAP16(0);
+	//sgilabel->devparam.cmd_tag_queue_depth      = (0);
+	//sgilabel->devparam.unused0                  = (0);
+	//sgilabel->devparam.unused1                  = SGI_SSWAP16(0);
+	/* sectors/track */
 	sgilabel->devparam.nsect                    = SGI_SSWAP16(geometry.sectors);
-						/* sectors/track */
 	sgilabel->devparam.bytes                    = SGI_SSWAP16(512);
 	sgilabel->devparam.ilfact                   = SGI_SSWAP16(1);
 	sgilabel->devparam.flags                    = SGI_SSWAP32(TRACK_FWD|
 							IGNORE_ERRORS|RESEEK);
-	sgilabel->devparam.datarate                 = SGI_SSWAP32(0);
+	//sgilabel->devparam.datarate                 = SGI_SSWAP32(0);
 	sgilabel->devparam.retries_on_error         = SGI_SSWAP32(1);
-	sgilabel->devparam.ms_per_word              = SGI_SSWAP32(0);
-	sgilabel->devparam.xylogics_gap1            = SGI_SSWAP16(0);
-	sgilabel->devparam.xylogics_syncdelay       = SGI_SSWAP16(0);
-	sgilabel->devparam.xylogics_readdelay       = SGI_SSWAP16(0);
-	sgilabel->devparam.xylogics_gap2            = SGI_SSWAP16(0);
-	sgilabel->devparam.xylogics_readgate        = SGI_SSWAP16(0);
-	sgilabel->devparam.xylogics_writecont       = SGI_SSWAP16(0);
-	memset( &(sgilabel->directory), 0, sizeof(struct volume_directory)*15 );
-	memset( &(sgilabel->partitions), 0, sizeof(struct sgi_partinfo)*16 );
+	//sgilabel->devparam.ms_per_word              = SGI_SSWAP32(0);
+	//sgilabel->devparam.xylogics_gap1            = SGI_SSWAP16(0);
+	//sgilabel->devparam.xylogics_syncdelay       = SGI_SSWAP16(0);
+	//sgilabel->devparam.xylogics_readdelay       = SGI_SSWAP16(0);
+	//sgilabel->devparam.xylogics_gap2            = SGI_SSWAP16(0);
+	//sgilabel->devparam.xylogics_readgate        = SGI_SSWAP16(0);
+	//sgilabel->devparam.xylogics_writecont       = SGI_SSWAP16(0);
+	//memset( &(sgilabel->directory), 0, sizeof(struct volume_directory)*15 );
+	//memset( &(sgilabel->partitions), 0, sizeof(struct sgi_partinfo)*16 );
 	current_label_type = label_sgi;
 	partitions = 16;
 	sgi_volumes = 15;




More information about the busybox-cvs mailing list