[BusyBox-cvs] busybox/util-linux fdisk.c,1.16,1.17

Erik Andersen andersen at busybox.net
Fri Feb 6 05:27:01 UTC 2004


Update of /var/cvs/busybox/util-linux
In directory nail:/tmp/cvs-serv19529/util-linux

Modified Files:
	fdisk.c 
Log Message:
Eliminate use of a kernel scsi header file.

Prevent potentially misaligned accesses while indexing a pointer
to the partition table, which would be a bad thing on i.e. arm.


Index: fdisk.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/fdisk.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- fdisk.c	30 Jan 2004 22:49:51 -0000	1.16
+++ fdisk.c	6 Feb 2004 05:26:58 -0000	1.17
@@ -26,12 +26,7 @@
 #include <setjmp.h>
 #include <assert.h>             /* assert */
 #include <getopt.h>
-
 #include <endian.h>
-#define u_char  unsigned char
-#include <scsi/scsi.h>          /* SCSI_IOCTL_GET_IDLUN */
-#undef u_char
-
 #include <sys/ioctl.h>
 #include <sys/param.h>
 #include <sys/sysmacros.h>     /* major */
@@ -93,6 +88,10 @@
 #define cround(n)       (display_in_cyl_units ? ((n)/units_per_sector)+1 : (n))
 #define scround(x)      (((x)+units_per_sector-1)/units_per_sector)
 
+#ifdef CONFIG_FEATURE_SUN_LABEL
+#define SCSI_IOCTL_GET_IDLUN 0x5382
+#endif
+
 
 #if defined(CONFIG_LFS) || defined(FDISK_SUPPORT_LARGE_DISKS) || defined(__alpha__) || defined(__ia64__) || defined(__s390x__)
 typedef long long fdisk_loff_t;
@@ -203,7 +202,7 @@
 	unsigned char end_cyl;          /* end cylinder */
 	unsigned char start4[4];        /* starting sector counting from 0 */
 	unsigned char size4[4];         /* nr of sectors in partition */
-};
+} __attribute__((__packed__));
 
 enum failure {
 	ioctl_error, unable_to_open, unable_to_read, unable_to_seek,




More information about the busybox-cvs mailing list