mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

358 lines
11 KiB

diff -Naur util-linux-2.12.orig/fdisk/cfdisk.c util-linux-2.12/fdisk/cfdisk.c
--- util-linux-2.12.orig/fdisk/cfdisk.c 2004-03-27 18:50:54.000000000 +0100
+++ util-linux-2.12/fdisk/cfdisk.c 2004-03-27 18:34:56.000000000 +0100
@@ -85,9 +85,6 @@
#include "get_blocks.h"
#include "common.h"
-extern long long ext2_llseek(unsigned int fd, long long offset,
- unsigned int origin);
-
#define VERSION UTIL_LINUX_VERSION
#ifdef __GNU__
@@ -578,16 +575,16 @@
}
static void
-read_sector(char *buffer, long long sect_num) {
- if (ext2_llseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)
+read_sector(char *buffer, off_t sect_num) {
+ if (lseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)
fatal(_("Cannot seek on disk drive"), 2);
if (read(fd, buffer, SECTOR_SIZE) != SECTOR_SIZE)
fatal(_("Cannot read disk drive"), 2);
}
static void
-write_sector(char *buffer, long long sect_num) {
- if (ext2_llseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)
+write_sector(char *buffer, off_t sect_num) {
+ if (lseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)
fatal(_("Cannot seek on disk drive"), 2);
if (write(fd, buffer, SECTOR_SIZE) != SECTOR_SIZE)
fatal(_("Cannot write disk drive"), 2);
@@ -611,10 +608,10 @@
#define DOS_OSTYPE_SZ 8
#define DOS_LABEL_SZ 11
#define DOS_FSTYPE_SZ 8
- long long offset;
+ off_t offset;
offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE;
- if (ext2_llseek(fd, offset, SEEK_SET) == offset
+ if (lseek(fd, offset, SEEK_SET) == offset
&& read(fd, &sector, sizeof(sector)) == sizeof(sector)) {
dos_copy_to_info(p_info[i].ostype, OSTYPESZ,
sector+DOS_OSTYPE_OFFSET, DOS_OSTYPE_SZ);
@@ -671,12 +668,12 @@
} xfsb;
char *label;
- long long offset;
+ off_t offset;
int j;
offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE
+ 1024;
- if (ext2_llseek(fd, offset, SEEK_SET) == offset
+ if (lseek(fd, offset, SEEK_SET) == offset
&& read(fd, &e2fsb, sizeof(e2fsb)) == sizeof(e2fsb)
&& e2fsb.s_magic[0] + (e2fsb.s_magic[1]<<8) == EXT2_SUPER_MAGIC) {
label = e2fsb.s_volume_name;
@@ -692,7 +689,7 @@
}
offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE + 0;
- if (ext2_llseek(fd, offset, SEEK_SET) == offset
+ if (lseek(fd, offset, SEEK_SET) == offset
&& read(fd, &xfsb, sizeof(xfsb)) == sizeof(xfsb)
&& !strcmp(xfsb.s_magic, XFS_SUPER_MAGIC)) {
label = xfsb.s_fname;
@@ -706,7 +703,7 @@
/* reiserfs? */
offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE
+ REISERFS_DISK_OFFSET_IN_BYTES;
- if (ext2_llseek(fd, offset, SEEK_SET) == offset
+ if (lseek(fd, offset, SEEK_SET) == offset
&& read(fd, &reiserfsb, 1024) == 1024
&& is_reiserfs_magic_string(&reiserfsb)) {
strncpy(p_info[i].fstype, "reiserfs", FSTYPESZ);
diff -Naur util-linux-2.12.orig/fdisk/fdiskbsdlabel.c util-linux-2.12/fdisk/fdiskbsdlabel.c
--- util-linux-2.12.orig/fdisk/fdiskbsdlabel.c 2004-03-27 18:50:54.000000000 +0100
+++ util-linux-2.12/fdisk/fdiskbsdlabel.c 2004-03-27 18:36:51.000000000 +0100
@@ -574,7 +574,7 @@
sector = get_start_sect(xbsd_part);
#endif
- if (ext2_llseek (fd, (long long) sector * SECTOR_SIZE, SEEK_SET) == -1)
+ if (lseek (fd, (off_t) sector * SECTOR_SIZE, SEEK_SET) == -1)
fatal (unable_to_seek);
if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE))
fatal (unable_to_write);
@@ -745,7 +745,7 @@
sector = 0;
#endif
- if (ext2_llseek (fd, (long long) sector * SECTOR_SIZE, SEEK_SET) == -1)
+ if (lseek (fd, (off_t) sector * SECTOR_SIZE, SEEK_SET) == -1)
fatal (unable_to_seek);
if (BSD_BBSIZE != read (fd, disklabelbuffer, BSD_BBSIZE))
fatal (unable_to_read);
@@ -791,12 +791,12 @@
#if defined (__alpha__) && BSD_LABELSECTOR == 0
alpha_bootblock_checksum (disklabelbuffer);
- if (ext2_llseek (fd, (long long) 0, SEEK_SET) == -1)
+ if (lseek (fd, (off_t) 0, SEEK_SET) == -1)
fatal (unable_to_seek);
if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE))
fatal (unable_to_write);
#else
- if (ext2_llseek (fd, (long long) sector * SECTOR_SIZE + BSD_LABELOFFSET,
+ if (lseek (fd, (off_t) sector * SECTOR_SIZE + BSD_LABELOFFSET,
SEEK_SET) == -1)
fatal (unable_to_seek);
if (sizeof (struct xbsd_disklabel) != write (fd, d, sizeof (struct xbsd_disklabel)))
diff -Naur util-linux-2.12.orig/fdisk/fdisk.c util-linux-2.12/fdisk/fdisk.c
--- util-linux-2.12.orig/fdisk/fdisk.c 2004-03-27 18:50:54.000000000 +0100
+++ util-linux-2.12/fdisk/fdisk.c 2004-03-27 18:35:42.000000000 +0100
@@ -241,7 +241,7 @@
static void
seek_sector(int fd, unsigned int secno) {
long long offset = (long long) secno * sector_size;
- if (ext2_llseek(fd, offset, SEEK_SET) == (long long) -1)
+ if (lseek(fd, offset, SEEK_SET) == (off_t) -1)
fatal(unable_to_seek);
}
diff -Naur util-linux-2.12.orig/fdisk/fdisksgilabel.c util-linux-2.12/fdisk/fdisksgilabel.c
--- util-linux-2.12.orig/fdisk/fdisksgilabel.c 2004-03-27 18:50:54.000000000 +0100
+++ util-linux-2.12/fdisk/fdisksgilabel.c 2004-03-27 18:37:17.000000000 +0100
@@ -379,7 +379,7 @@
*/
sgiinfo *info = fill_sgiinfo();
int infostartblock = SSWAP32(sgilabel->directory[0].vol_file_start);
- if (ext2_llseek(fd, (long long)infostartblock*
+ if (lseek(fd, (off_t)infostartblock*
SECTOR_SIZE, SEEK_SET) < 0)
fatal(unable_to_seek);
if (write(fd, info, SECTOR_SIZE) != SECTOR_SIZE)
diff -Naur util-linux-2.12.orig/fdisk/llseek.c util-linux-2.12/fdisk/llseek.c
--- util-linux-2.12.orig/fdisk/llseek.c 2003-07-13 20:30:27.000000000 +0200
+++ util-linux-2.12/fdisk/llseek.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,110 +0,0 @@
-/*
- * 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.
- */
-
-#include <sys/types.h>
-
-#include <errno.h>
-#include <unistd.h>
-
-extern long long ext2_llseek (unsigned int, long long, unsigned int);
-
-#ifdef __linux__
-
-#ifdef HAVE_LLSEEK
-#include <syscall.h>
-
-#else /* HAVE_LLSEEK */
-
-#if defined(__alpha__) || defined(__ia64__) || defined(__s390x__)
-
-#define my_llseek lseek
-
-#else
-#include <linux/unistd.h> /* for __NR__llseek */
-
-static int _llseek (unsigned int, unsigned long,
- unsigned long, long long *, unsigned int);
-
-#ifdef __NR__llseek
-
-static _syscall5(int,_llseek,unsigned int,fd,unsigned long,offset_high,
- unsigned long, offset_low,long long *,result,
- unsigned int, origin)
-
-#else
-
-/* no __NR__llseek on compilation machine - might give it explicitly */
-static int _llseek (unsigned int fd, unsigned long oh,
- unsigned long ol, long long *result,
- unsigned int origin) {
- errno = ENOSYS;
- return -1;
-}
-
-#endif
-
-static long long my_llseek (unsigned int fd, long long offset,
- unsigned int origin)
-{
- long long result;
- int retval;
-
- retval = _llseek (fd, ((unsigned long long) offset) >> 32,
- ((unsigned long long) offset) & 0xffffffff,
- &result, origin);
- return (retval == -1 ? (long long) retval : result);
-}
-
-#endif /* __alpha__ */
-
-#endif /* HAVE_LLSEEK */
-
-long long ext2_llseek (unsigned int fd, long long offset,
- unsigned int origin)
-{
- long long result;
- static int do_compat = 0;
-
- if (!do_compat) {
- result = my_llseek (fd, 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(long long)) ||
- (offset < ((long long) 1 << ((sizeof(off_t)*8) -1))))
- return lseek(fd, (off_t) offset, origin);
-
- errno = EINVAL;
- return -1;
-}
-
-#else /* !linux */
-
-long long ext2_llseek (unsigned int fd, long long offset,
- unsigned int origin)
-{
- if ((sizeof(off_t) < sizeof(long long)) &&
- (offset >= ((long long) 1 << ((sizeof(off_t)*8) -1)))) {
- errno = EINVAL;
- return -1;
- }
- return lseek (fd, (off_t) offset, origin);
-}
-
-#endif /* linux */
-
-
diff -Naur util-linux-2.12.orig/po/POTFILES.in util-linux-2.12/po/POTFILES.in
--- util-linux-2.12.orig/po/POTFILES.in 2003-07-05 22:19:45.000000000 +0200
+++ util-linux-2.12/po/POTFILES.in 2004-03-27 18:46:42.000000000 +0100
@@ -18,7 +18,6 @@
fdisk/fdisksgilabel.c
fdisk/fdisksunlabel.c
fdisk/i386_sys_types.c
-fdisk/llseek.c
fdisk/partname.c
fdisk/sfdisk.c
getopt/getopt.c
--- ./fdisk/Makefile.orig 2004-08-22 09:30:42.000000000 -0500
+++ ./fdisk/Makefile 2004-08-22 09:30:55.000000000 -0500
@@ -39,7 +39,7 @@
endif
endif
-cfdisk: cfdisk.o llseek.o i386_sys_types.o $(LIB)/xstrncpy.o
+cfdisk: cfdisk.o i386_sys_types.o $(LIB)/xstrncpy.o
ifeq "$(HAVE_SLANG)" "yes"
$(CC) $(LDFLAGS) $^ -o $@ $(LIBSLANG)
else
@@ -55,7 +55,7 @@
rm -f activate
ln -s sfdisk activate
-fdisk: fdisk.o llseek.o fdiskbsdlabel.o fdisksgilabel.o fdisksunlabel.o \
+fdisk: fdisk.o fdiskbsdlabel.o fdisksgilabel.o fdisksunlabel.o \
fdiskaixlabel.o i386_sys_types.o partname.o
fdisk.o: fdisk.c fdisk.h
fdiskbsdlabel.o: fdiskbsdlabel.c fdisk.h fdiskbsdlabel.h
--- ./fdisk/sfdisk.c.orig 2004-08-22 09:34:01.000000000 -0500
+++ ./fdisk/sfdisk.c 2004-08-22 09:36:31.000000000 -0500
@@ -123,30 +123,18 @@
/*
* sseek: seek to specified sector - return 0 on failure
*
- * For >4GB disks lseek needs a > 32bit arg, and we have to use llseek.
- * On the other hand, a 32 bit sector number is OK until 2TB.
- * The routines _llseek and sseek below are the only ones that
- * know about the loff_t type.
+ * This relies on _FILE_OFFSET_BITS=64.
*
* Note: we use 512-byte sectors here, irrespective of the hardware ss.
*/
-#if !defined (__alpha__) && !defined (__ia64__) && !defined (__x86_64__) && !defined (__s390x__)
-static
-_syscall5(int, _llseek, unsigned int, fd, ulong, hi, ulong, lo,
- loff_t *, res, unsigned int, wh);
-#endif
static int
sseek(char *dev, unsigned int fd, unsigned long s) {
- loff_t in, out;
- in = ((loff_t) s << 9);
+ off_t in, out;
+ in = ((off_t) s << 9);
out = 1;
-#if !defined (__alpha__) && !defined (__ia64__) && !defined (__x86_64__) && !defined (__s390x__)
- if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0) {
-#else
if ((out = lseek(fd, in, SEEK_SET)) != in) {
-#endif
perror("llseek");
error(_("seek error on %s - cannot seek to %lu\n"), dev, s);
return 0;
--- ./partx/partx.c.orig 2004-08-23 06:23:31.000000000 -0500
+++ ./partx/partx.c 2004-08-23 06:26:36.000000000 -0500
@@ -333,30 +333,16 @@
/*
* sseek: seek to specified sector
+ *
+ * This relies on _FILE_OFFSET_BITS=64.
*/
-#if !defined (__alpha__) && !defined (__ia64__) && !defined (__s390x__) && !defined(__x86_64__)
-#define NEED__llseek
-#endif
-
-#ifdef NEED__llseek
-#include <linux/unistd.h> /* _syscall */
-static
-_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo,
- long long *, res, uint, wh);
-#endif
-
static int
sseek(int fd, unsigned int secnr) {
- long long in, out;
- in = ((long long) secnr << 9);
+ off_t in, out;
+ in = ((off_t) secnr << 9);
out = 1;
-#ifdef NEED__llseek
- if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0
- || out != in)
-#else
if ((out = lseek(fd, in, SEEK_SET)) != in)
-#endif
{
fprintf(stderr, "llseek error\n");
return -1;