diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-03-30 09:08:58 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-03-30 09:08:58 +0000 |
commit | 1236631700ba5e8f00d20c848cc425257c21f531 (patch) | |
tree | 5ae21af9774c93bca57613c8520f4593cbde89ef | |
parent | 75eb90f28882ca26cdb0af190ae9986720b26467 (diff) | |
download | busybox-w32-1236631700ba5e8f00d20c848cc425257c21f531.tar.gz busybox-w32-1236631700ba5e8f00d20c848cc425257c21f531.tar.bz2 busybox-w32-1236631700ba5e8f00d20c848cc425257c21f531.zip |
The fdisk llseek junk was redundant, since both uClibc and glibc
automatically promote lseek and friends to their 64 bit counterparts
when CONFIG_LFS is enabled, since it enables __USE_FILE_OFFSET64
-rw-r--r-- | util-linux/Config.in | 3 | ||||
-rw-r--r-- | util-linux/fdisk.c | 79 |
2 files changed, 8 insertions, 74 deletions
diff --git a/util-linux/Config.in b/util-linux/Config.in index c97e5c436..6972591cc 100644 --- a/util-linux/Config.in +++ b/util-linux/Config.in | |||
@@ -74,14 +74,13 @@ config CONFIG_FDISK | |||
74 | can be used to list and edit the set of partitions or BSD style | 74 | can be used to list and edit the set of partitions or BSD style |
75 | 'disk slices' that are defined on a hard drive. | 75 | 'disk slices' that are defined on a hard drive. |
76 | 76 | ||
77 | if !CONFIG_LFS | ||
78 | config FDISK_SUPPORT_LARGE_DISKS | 77 | config FDISK_SUPPORT_LARGE_DISKS |
79 | bool " support over 4GB disks" | 78 | bool " support over 4GB disks" |
80 | default y | 79 | default y |
81 | depends on CONFIG_FDISK | 80 | depends on CONFIG_FDISK |
81 | select CONFIG_LFS | ||
82 | help | 82 | help |
83 | Enable this option to support large disks > 4GB. | 83 | Enable this option to support large disks > 4GB. |
84 | endif | ||
85 | 84 | ||
86 | config CONFIG_FEATURE_FDISK_WRITABLE | 85 | config CONFIG_FEATURE_FDISK_WRITABLE |
87 | bool " Write support" | 86 | bool " Write support" |
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index f35aeb9f3..e9ef5cee3 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c | |||
@@ -93,7 +93,7 @@ | |||
93 | #endif | 93 | #endif |
94 | 94 | ||
95 | 95 | ||
96 | #if defined(CONFIG_LFS) || defined(FDISK_SUPPORT_LARGE_DISKS) || defined(__alpha__) || defined(__ia64__) || defined(__s390x__) | 96 | #if defined(CONFIG_LFS) || defined(__alpha__) || defined(__ia64__) || defined(__s390x__) |
97 | typedef long long fdisk_loff_t; | 97 | typedef long long fdisk_loff_t; |
98 | #else | 98 | #else |
99 | typedef long fdisk_loff_t; | 99 | typedef long fdisk_loff_t; |
@@ -846,71 +846,6 @@ typedef struct { | |||
846 | #define SUN_SSWAP32(x) (sun_other_endian ? __swap32(x) \ | 846 | #define SUN_SSWAP32(x) (sun_other_endian ? __swap32(x) \ |
847 | : (uint32_t)(x)) | 847 | : (uint32_t)(x)) |
848 | 848 | ||
849 | #if defined(CONFIG_LFS) || defined(FDISK_SUPPORT_LARGE_DISKS) | ||
850 | /* | ||
851 | * llseek.c -- stub calling the llseek system call | ||
852 | * | ||
853 | * Copyright (C) 1994 Remy Card. This file may be redistributed | ||
854 | * under the terms of the GNU Public License. | ||
855 | */ | ||
856 | |||
857 | |||
858 | #if defined(__alpha__) || defined(__ia64__) || defined(__s390x__) | ||
859 | |||
860 | #define my_llseek lseek | ||
861 | |||
862 | #else | ||
863 | |||
864 | #include <syscall.h> | ||
865 | |||
866 | static fdisk_loff_t my_llseek (unsigned int f_d, fdisk_loff_t offset, | ||
867 | unsigned int origin) | ||
868 | { | ||
869 | fdisk_loff_t result; | ||
870 | int retval; | ||
871 | |||
872 | retval = syscall(__NR__llseek, f_d, (unsigned long)(((unsigned long long) offset) >> 32), | ||
873 | (unsigned long)(((unsigned long long) offset) & 0xffffffff), | ||
874 | &result, origin); | ||
875 | return (retval == -1 ? (fdisk_loff_t) retval : result); | ||
876 | } | ||
877 | |||
878 | #endif /* __alpha__ */ | ||
879 | |||
880 | |||
881 | static fdisk_loff_t fdisk_llseek (unsigned int f_d, fdisk_loff_t offset, | ||
882 | unsigned int origin) | ||
883 | { | ||
884 | fdisk_loff_t result; | ||
885 | static int do_compat = 0; | ||
886 | |||
887 | if (!do_compat) { | ||
888 | result = my_llseek (f_d, offset, origin); | ||
889 | if (!(result == -1 && errno == ENOSYS)) | ||
890 | return result; | ||
891 | |||
892 | /* | ||
893 | * Just in case this code runs on top of an old kernel | ||
894 | * which does not support the llseek system call | ||
895 | */ | ||
896 | do_compat = 1; | ||
897 | /* | ||
898 | * Now try ordinary lseek. | ||
899 | */ | ||
900 | } | ||
901 | |||
902 | if ((sizeof(off_t) >= sizeof(fdisk_loff_t)) || | ||
903 | (offset < ((fdisk_loff_t) 1 << ((sizeof(off_t)*8) -1)))) | ||
904 | return lseek(f_d, (off_t) offset, origin); | ||
905 | |||
906 | errno = EINVAL; | ||
907 | return -1; | ||
908 | } | ||
909 | #else | ||
910 | # define fdisk_llseek lseek | ||
911 | #endif /* FDISK_SUPPORT_LARGE_DISKS */ | ||
912 | |||
913 | |||
914 | 849 | ||
915 | #ifdef CONFIG_FEATURE_OSF_LABEL | 850 | #ifdef CONFIG_FEATURE_OSF_LABEL |
916 | /* | 851 | /* |
@@ -1437,7 +1372,7 @@ xbsd_write_bootstrap (void) | |||
1437 | sector = get_start_sect(xbsd_part); | 1372 | sector = get_start_sect(xbsd_part); |
1438 | #endif | 1373 | #endif |
1439 | 1374 | ||
1440 | if (fdisk_llseek (fd, (fdisk_loff_t) sector * SECTOR_SIZE, SEEK_SET) == -1) | 1375 | if (lseek (fd, (fdisk_loff_t) sector * SECTOR_SIZE, SEEK_SET) == -1) |
1441 | fdisk_fatal (unable_to_seek); | 1376 | fdisk_fatal (unable_to_seek); |
1442 | if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE)) | 1377 | if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE)) |
1443 | fdisk_fatal (unable_to_write); | 1378 | fdisk_fatal (unable_to_write); |
@@ -1605,7 +1540,7 @@ xbsd_readlabel (struct partition *p, struct xbsd_disklabel *d) | |||
1605 | sector = 0; | 1540 | sector = 0; |
1606 | #endif | 1541 | #endif |
1607 | 1542 | ||
1608 | if (fdisk_llseek (fd, (fdisk_loff_t) sector * SECTOR_SIZE, SEEK_SET) == -1) | 1543 | if (lseek (fd, (fdisk_loff_t) sector * SECTOR_SIZE, SEEK_SET) == -1) |
1609 | fdisk_fatal (unable_to_seek); | 1544 | fdisk_fatal (unable_to_seek); |
1610 | if (BSD_BBSIZE != read (fd, disklabelbuffer, BSD_BBSIZE)) | 1545 | if (BSD_BBSIZE != read (fd, disklabelbuffer, BSD_BBSIZE)) |
1611 | fdisk_fatal (unable_to_read); | 1546 | fdisk_fatal (unable_to_read); |
@@ -1651,12 +1586,12 @@ xbsd_writelabel (struct partition *p, struct xbsd_disklabel *d) | |||
1651 | 1586 | ||
1652 | #if defined (__alpha__) && BSD_LABELSECTOR == 0 | 1587 | #if defined (__alpha__) && BSD_LABELSECTOR == 0 |
1653 | alpha_bootblock_checksum (disklabelbuffer); | 1588 | alpha_bootblock_checksum (disklabelbuffer); |
1654 | if (fdisk_llseek (fd, (fdisk_loff_t) 0, SEEK_SET) == -1) | 1589 | if (lseek (fd, (fdisk_loff_t) 0, SEEK_SET) == -1) |
1655 | fdisk_fatal (unable_to_seek); | 1590 | fdisk_fatal (unable_to_seek); |
1656 | if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE)) | 1591 | if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE)) |
1657 | fdisk_fatal (unable_to_write); | 1592 | fdisk_fatal (unable_to_write); |
1658 | #else | 1593 | #else |
1659 | if (fdisk_llseek (fd, (fdisk_loff_t) sector * SECTOR_SIZE + BSD_LABELOFFSET, | 1594 | if (lseek (fd, (fdisk_loff_t) sector * SECTOR_SIZE + BSD_LABELOFFSET, |
1660 | SEEK_SET) == -1) | 1595 | SEEK_SET) == -1) |
1661 | fdisk_fatal (unable_to_seek); | 1596 | fdisk_fatal (unable_to_seek); |
1662 | if (sizeof (struct xbsd_disklabel) != write (fd, d, sizeof (struct xbsd_disklabel))) | 1597 | if (sizeof (struct xbsd_disklabel) != write (fd, d, sizeof (struct xbsd_disklabel))) |
@@ -2083,7 +2018,7 @@ sgi_write_table(void) { | |||
2083 | */ | 2018 | */ |
2084 | sgiinfo *info = fill_sgiinfo(); | 2019 | sgiinfo *info = fill_sgiinfo(); |
2085 | int infostartblock = SGI_SSWAP32(sgilabel->directory[0].vol_file_start); | 2020 | int infostartblock = SGI_SSWAP32(sgilabel->directory[0].vol_file_start); |
2086 | if (fdisk_llseek(fd, (long long)infostartblock* | 2021 | if (lseek(fd, (long long)infostartblock* |
2087 | SECTOR_SIZE, SEEK_SET) < 0) | 2022 | SECTOR_SIZE, SEEK_SET) < 0) |
2088 | fdisk_fatal(unable_to_seek); | 2023 | fdisk_fatal(unable_to_seek); |
2089 | if (write(fd, info, SECTOR_SIZE) != SECTOR_SIZE) | 2024 | if (write(fd, info, SECTOR_SIZE) != SECTOR_SIZE) |
@@ -3467,7 +3402,7 @@ static void fdisk_fatal(enum failure why) { | |||
3467 | static void | 3402 | static void |
3468 | seek_sector(uint secno) { | 3403 | seek_sector(uint secno) { |
3469 | fdisk_loff_t offset = (fdisk_loff_t) secno * sector_size; | 3404 | fdisk_loff_t offset = (fdisk_loff_t) secno * sector_size; |
3470 | if (fdisk_llseek(fd, offset, SEEK_SET) == (fdisk_loff_t) -1) | 3405 | if (lseek(fd, offset, SEEK_SET) == (fdisk_loff_t) -1) |
3471 | fdisk_fatal(unable_to_seek); | 3406 | fdisk_fatal(unable_to_seek); |
3472 | } | 3407 | } |
3473 | 3408 | ||