[BusyBox-cvs] busybox/util-linux fdisk.c, 1.18, 1.19 Config.in, 1.11, 1.12

Erik Andersen andersen at busybox.net
Tue Mar 30 09:09:00 UTC 2004


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

Modified Files:
	fdisk.c Config.in 
Log Message:
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


Index: Config.in
===================================================================
RCS file: /var/cvs/busybox/util-linux/Config.in,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- a/Config.in	15 Mar 2004 08:29:20 -0000	1.11
+++ b/Config.in	30 Mar 2004 09:08:58 -0000	1.12
@@ -74,14 +74,13 @@
 	  can be used to list and edit the set of partitions or BSD style
 	  'disk slices' that are defined on a hard drive.
 
-if !CONFIG_LFS
 config FDISK_SUPPORT_LARGE_DISKS
 	bool "  support over 4GB disks"
 	default y
 	depends on CONFIG_FDISK
+	select CONFIG_LFS
 	help
 	  Enable this option to support large disks > 4GB.
-endif
 
 config CONFIG_FEATURE_FDISK_WRITABLE
 	bool "  Write support"

Index: fdisk.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/fdisk.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- a/fdisk.c	15 Mar 2004 08:29:20 -0000	1.18
+++ b/fdisk.c	30 Mar 2004 09:08:58 -0000	1.19
@@ -93,7 +93,7 @@
 #endif
 
 
-#if defined(CONFIG_LFS) || defined(FDISK_SUPPORT_LARGE_DISKS) || defined(__alpha__) || defined(__ia64__) || defined(__s390x__)
+#if defined(CONFIG_LFS) || defined(__alpha__) || defined(__ia64__) || defined(__s390x__)
 typedef long long fdisk_loff_t;
 #else
 typedef long fdisk_loff_t;
@@ -846,71 +846,6 @@
 #define SUN_SSWAP32(x) (sun_other_endian ? __swap32(x) \
 				 : (uint32_t)(x))
 
-#if defined(CONFIG_LFS) || defined(FDISK_SUPPORT_LARGE_DISKS)
-/*
- * llseek.c -- stub calling the llseek system call
- *
- * Copyright (C) 1994 Remy Card.  This file may be redistributed
- * under the terms of the GNU Public License.
- */
-
-
-#if defined(__alpha__) || defined(__ia64__) || defined(__s390x__)
-
-#define my_llseek lseek
-
-#else
-
-#include <syscall.h>
-
-static fdisk_loff_t my_llseek (unsigned int f_d, fdisk_loff_t offset,
-		unsigned int origin)
-{
-	fdisk_loff_t result;
-	int retval;
-
-	retval = syscall(__NR__llseek, f_d, (unsigned long)(((unsigned long long) offset) >> 32),
-			(unsigned long)(((unsigned long long) offset) & 0xffffffff),
-			&result, origin);
-	return (retval == -1 ? (fdisk_loff_t) retval : result);
-}
-
-#endif /* __alpha__ */
-
-
-static fdisk_loff_t fdisk_llseek (unsigned int f_d, fdisk_loff_t offset,
-			 unsigned int origin)
-{
-	fdisk_loff_t result;
-	static int do_compat = 0;
-
-	if (!do_compat) {
-		result = my_llseek (f_d, offset, origin);
-		if (!(result == -1 && errno == ENOSYS))
-			return result;
-
-		/*
-		 * Just in case this code runs on top of an old kernel
-		 * which does not support the llseek system call
-		 */
-		do_compat = 1;
-		/*
-		 * Now try ordinary lseek.
-		 */
-	}
-
-	if ((sizeof(off_t) >= sizeof(fdisk_loff_t)) ||
-	    (offset < ((fdisk_loff_t) 1 << ((sizeof(off_t)*8) -1))))
-		return lseek(f_d, (off_t) offset, origin);
-
-	errno = EINVAL;
-	return -1;
-}
-#else
-# define fdisk_llseek lseek
-#endif  /* FDISK_SUPPORT_LARGE_DISKS */
-
-
 
 #ifdef CONFIG_FEATURE_OSF_LABEL
 /*
@@ -1437,7 +1372,7 @@
   sector = get_start_sect(xbsd_part);
 #endif
 
-  if (fdisk_llseek (fd, (fdisk_loff_t) sector * SECTOR_SIZE, SEEK_SET) == -1)
+  if (lseek (fd, (fdisk_loff_t) sector * SECTOR_SIZE, SEEK_SET) == -1)
     fdisk_fatal (unable_to_seek);
   if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE))
     fdisk_fatal (unable_to_write);
@@ -1605,7 +1540,7 @@
 	sector = 0;
 #endif
 
-	if (fdisk_llseek (fd, (fdisk_loff_t) sector * SECTOR_SIZE, SEEK_SET) == -1)
+	if (lseek (fd, (fdisk_loff_t) sector * SECTOR_SIZE, SEEK_SET) == -1)
 		fdisk_fatal (unable_to_seek);
 	if (BSD_BBSIZE != read (fd, disklabelbuffer, BSD_BBSIZE))
 		fdisk_fatal (unable_to_read);
@@ -1651,12 +1586,12 @@
 
 #if defined (__alpha__) && BSD_LABELSECTOR == 0
   alpha_bootblock_checksum (disklabelbuffer);
-  if (fdisk_llseek (fd, (fdisk_loff_t) 0, SEEK_SET) == -1)
+  if (lseek (fd, (fdisk_loff_t) 0, SEEK_SET) == -1)
     fdisk_fatal (unable_to_seek);
   if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE))
     fdisk_fatal (unable_to_write);
 #else
-  if (fdisk_llseek (fd, (fdisk_loff_t) sector * SECTOR_SIZE + BSD_LABELOFFSET,
+  if (lseek (fd, (fdisk_loff_t) sector * SECTOR_SIZE + BSD_LABELOFFSET,
 		   SEEK_SET) == -1)
     fdisk_fatal (unable_to_seek);
   if (sizeof (struct xbsd_disklabel) != write (fd, d, sizeof (struct xbsd_disklabel)))
@@ -2083,7 +2018,7 @@
 	 */
 	 sgiinfo *info = fill_sgiinfo();
 	 int infostartblock = SGI_SSWAP32(sgilabel->directory[0].vol_file_start);
-	 if (fdisk_llseek(fd, (long long)infostartblock*
+	 if (lseek(fd, (long long)infostartblock*
 				SECTOR_SIZE, SEEK_SET) < 0)
 	    fdisk_fatal(unable_to_seek);
 	 if (write(fd, info, SECTOR_SIZE) != SECTOR_SIZE)
@@ -3467,7 +3402,7 @@
 static void
 seek_sector(uint secno) {
 	fdisk_loff_t offset = (fdisk_loff_t) secno * sector_size;
-	if (fdisk_llseek(fd, offset, SEEK_SET) == (fdisk_loff_t) -1)
+	if (lseek(fd, offset, SEEK_SET) == (fdisk_loff_t) -1)
 		fdisk_fatal(unable_to_seek);
 }
 




More information about the busybox-cvs mailing list