diff options
| author | Eric Andersen <andersen@codepoet.org> | 2004-02-06 05:26:58 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 2004-02-06 05:26:58 +0000 |
| commit | 7495b0d4b1959b1391c460f24c285b46417730ea (patch) | |
| tree | 5a3aa06b7a2a42a24073643c9aa148e5f7a66922 /util-linux | |
| parent | 68474f3b36902ecd903a2d26c06a3d18f3f4bdc5 (diff) | |
| download | busybox-w32-7495b0d4b1959b1391c460f24c285b46417730ea.tar.gz busybox-w32-7495b0d4b1959b1391c460f24c285b46417730ea.tar.bz2 busybox-w32-7495b0d4b1959b1391c460f24c285b46417730ea.zip | |
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.
Diffstat (limited to 'util-linux')
| -rw-r--r-- | util-linux/fdisk.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index 891380395..2374960df 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c | |||
| @@ -26,12 +26,7 @@ | |||
| 26 | #include <setjmp.h> | 26 | #include <setjmp.h> |
| 27 | #include <assert.h> /* assert */ | 27 | #include <assert.h> /* assert */ |
| 28 | #include <getopt.h> | 28 | #include <getopt.h> |
| 29 | |||
| 30 | #include <endian.h> | 29 | #include <endian.h> |
| 31 | #define u_char unsigned char | ||
| 32 | #include <scsi/scsi.h> /* SCSI_IOCTL_GET_IDLUN */ | ||
| 33 | #undef u_char | ||
| 34 | |||
| 35 | #include <sys/ioctl.h> | 30 | #include <sys/ioctl.h> |
| 36 | #include <sys/param.h> | 31 | #include <sys/param.h> |
| 37 | #include <sys/sysmacros.h> /* major */ | 32 | #include <sys/sysmacros.h> /* major */ |
| @@ -93,6 +88,10 @@ | |||
| 93 | #define cround(n) (display_in_cyl_units ? ((n)/units_per_sector)+1 : (n)) | 88 | #define cround(n) (display_in_cyl_units ? ((n)/units_per_sector)+1 : (n)) |
| 94 | #define scround(x) (((x)+units_per_sector-1)/units_per_sector) | 89 | #define scround(x) (((x)+units_per_sector-1)/units_per_sector) |
| 95 | 90 | ||
| 91 | #ifdef CONFIG_FEATURE_SUN_LABEL | ||
| 92 | #define SCSI_IOCTL_GET_IDLUN 0x5382 | ||
| 93 | #endif | ||
| 94 | |||
| 96 | 95 | ||
| 97 | #if defined(CONFIG_LFS) || defined(FDISK_SUPPORT_LARGE_DISKS) || defined(__alpha__) || defined(__ia64__) || defined(__s390x__) | 96 | #if defined(CONFIG_LFS) || defined(FDISK_SUPPORT_LARGE_DISKS) || defined(__alpha__) || defined(__ia64__) || defined(__s390x__) |
| 98 | typedef long long fdisk_loff_t; | 97 | typedef long long fdisk_loff_t; |
| @@ -203,7 +202,7 @@ struct partition { | |||
| 203 | unsigned char end_cyl; /* end cylinder */ | 202 | unsigned char end_cyl; /* end cylinder */ |
| 204 | unsigned char start4[4]; /* starting sector counting from 0 */ | 203 | unsigned char start4[4]; /* starting sector counting from 0 */ |
| 205 | unsigned char size4[4]; /* nr of sectors in partition */ | 204 | unsigned char size4[4]; /* nr of sectors in partition */ |
| 206 | }; | 205 | } __attribute__((__packed__)); |
| 207 | 206 | ||
| 208 | enum failure { | 207 | enum failure { |
| 209 | ioctl_error, unable_to_open, unable_to_read, unable_to_seek, | 208 | ioctl_error, unable_to_open, unable_to_read, unable_to_seek, |
