1 Submitted By: Dan Nicholson <dbn_dot_lists_at_gmail_dot_com>
3 Initial Package Version: 2.12r
5 Upstream Status: Applied in util-linux-2.13-pre6.tar.bz2
6 Description: Replaces uses of *llseek with lseek. Fixes an issue
7 compiling util-linux with kernel headers from linux-2.6.18-rc1
10 diff -pur -x '*.rej' util-linux-2.12r.orig/fdisk/Makefile util-linux-2.12r/fdisk/Makefile
11 --- util-linux-2.12r.orig/fdisk/Makefile 2004-09-06 20:28:58.000000000 +0000
12 +++ util-linux-2.12r/fdisk/Makefile 2006-07-08 15:40:57.140375072 +0000
13 @@ -39,7 +39,7 @@ else
17 -cfdisk: cfdisk.o llseek.o disksize.o i386_sys_types.o $(LIB)/xstrncpy.o
18 +cfdisk: cfdisk.o disksize.o i386_sys_types.o $(LIB)/xstrncpy.o
19 ifeq "$(HAVE_SLANG)" "yes"
20 $(CC) $(LDFLAGS) $^ -o $@ $(LIBSLANG)
22 @@ -55,7 +55,7 @@ activate: sfdisk
26 -fdisk: fdisk.o llseek.o disksize.o fdiskbsdlabel.o fdisksgilabel.o \
27 +fdisk: fdisk.o disksize.o fdiskbsdlabel.o fdisksgilabel.o \
28 fdisksunlabel.o fdiskaixlabel.o i386_sys_types.o partname.o
29 fdisk.o: fdisk.c fdisk.h
30 fdiskbsdlabel.o: fdiskbsdlabel.c fdisk.h fdiskbsdlabel.h
31 diff -pur -x '*.rej' util-linux-2.12r.orig/fdisk/cfdisk.c util-linux-2.12r/fdisk/cfdisk.c
32 --- util-linux-2.12r.orig/fdisk/cfdisk.c 2005-09-09 21:44:57.000000000 +0000
33 +++ util-linux-2.12r/fdisk/cfdisk.c 2006-07-08 15:40:23.458901045 +0000
38 -extern long long ext2_llseek(unsigned int fd, long long offset,
39 - unsigned int origin);
41 #define VERSION UTIL_LINUX_VERSION
43 #define DEFAULT_DEVICE "/dev/hda"
44 @@ -552,7 +549,7 @@ die_x(int ret) {
47 read_sector(char *buffer, long long sect_num) {
48 - if (ext2_llseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)
49 + if (lseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)
50 fatal(_("Cannot seek on disk drive"), 2);
51 if (read(fd, buffer, SECTOR_SIZE) != SECTOR_SIZE)
52 fatal(_("Cannot read disk drive"), 2);
53 @@ -560,7 +557,7 @@ read_sector(char *buffer, long long sect
56 write_sector(char *buffer, long long sect_num) {
57 - if (ext2_llseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)
58 + if (lseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)
59 fatal(_("Cannot seek on disk drive"), 2);
60 if (write(fd, buffer, SECTOR_SIZE) != SECTOR_SIZE)
61 fatal(_("Cannot write disk drive"), 2);
62 @@ -587,7 +584,7 @@ get_dos_label(int i) {
65 offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE;
66 - if (ext2_llseek(fd, offset, SEEK_SET) == offset
67 + if (lseek(fd, offset, SEEK_SET) == offset
68 && read(fd, §or, sizeof(sector)) == sizeof(sector)) {
69 dos_copy_to_info(p_info[i].ostype, OSTYPESZ,
70 sector+DOS_OSTYPE_OFFSET, DOS_OSTYPE_SZ);
71 @@ -672,7 +669,7 @@ get_linux_label(int i) {
73 offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE
75 - if (ext2_llseek(fd, offset, SEEK_SET) == offset
76 + if (lseek(fd, offset, SEEK_SET) == offset
77 && read(fd, &e2fsb, sizeof(e2fsb)) == sizeof(e2fsb)
78 && e2fsb.s_magic[0] + (e2fsb.s_magic[1]<<8) == EXT2_SUPER_MAGIC) {
79 label = e2fsb.s_volume_name;
80 @@ -688,7 +685,7 @@ get_linux_label(int i) {
83 offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE + 0;
84 - if (ext2_llseek(fd, offset, SEEK_SET) == offset
85 + if (lseek(fd, offset, SEEK_SET) == offset
86 && read(fd, &xfsb, sizeof(xfsb)) == sizeof(xfsb)
87 && !strncmp(xfsb.s_magic, XFS_SUPER_MAGIC, 4)) {
89 @@ -702,7 +699,7 @@ get_linux_label(int i) {
91 offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE
93 - if (ext2_llseek(fd, offset, SEEK_SET) == offset
94 + if (lseek(fd, offset, SEEK_SET) == offset
95 && read(fd, &jfsb, sizeof(jfsb)) == sizeof(jfsb)
96 && !strncmp(jfsb.s_magic, JFS_MAGIC, strlen(JFS_MAGIC))) {
98 @@ -716,7 +713,7 @@ get_linux_label(int i) {
100 offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE
101 + REISERFS_DISK_OFFSET_IN_BYTES;
102 - if (ext2_llseek(fd, offset, SEEK_SET) == offset
103 + if (lseek(fd, offset, SEEK_SET) == offset
104 && read(fd, &reiserfsb, sizeof(reiserfsb)) == sizeof(reiserfsb)
105 && has_reiserfs_magic_string(&reiserfsb, &reiserfs_is_3_6)) {
106 if (reiserfs_is_3_6) {
107 @@ -1860,7 +1857,7 @@ write_part_table(void) {
110 mvaddstr(COMMAND_LINE_Y, COMMAND_LINE_X,
111 - _("Are you sure you want write the partition table "
112 + _("Are you sure you want to write the partition table "
113 "to disk? (yes or no): "));
114 len = get_string(response, LINE_LENGTH, NULL);
116 diff -pur -x '*.rej' util-linux-2.12r.orig/fdisk/fdisk.c util-linux-2.12r/fdisk/fdisk.c
117 --- util-linux-2.12r.orig/fdisk/fdisk.c 2004-12-18 02:00:31.000000000 +0000
118 +++ util-linux-2.12r/fdisk/fdisk.c 2006-07-08 15:40:23.461899841 +0000
119 @@ -239,8 +239,8 @@ void fatal(enum failure why) {
122 seek_sector(int fd, unsigned int secno) {
123 - long long offset = (long long) secno * sector_size;
124 - if (ext2_llseek(fd, offset, SEEK_SET) == (long long) -1)
125 + off_t offset = (off_t) secno * sector_size;
126 + if (lseek(fd, offset, SEEK_SET) == (off_t) -1)
127 fatal(unable_to_seek);
130 diff -pur -x '*.rej' util-linux-2.12r.orig/fdisk/fdisk.h util-linux-2.12r/fdisk/fdisk.h
131 --- util-linux-2.12r.orig/fdisk/fdisk.h 2004-12-15 18:19:06.000000000 +0000
132 +++ util-linux-2.12r/fdisk/fdisk.h 2006-07-08 15:40:23.462899439 +0000
134 #define cround(n) (display_in_cyl_units ? ((n)/units_per_sector)+1 : (n))
135 #define scround(x) (((x)+units_per_sector-1)/units_per_sector)
137 -extern long long ext2_llseek(unsigned int fd, long long offset,
138 - unsigned int origin);
140 #if defined(__GNUC__) && (defined(__arm__) || defined(__alpha__))
141 # define PACKED __attribute__ ((packed))
143 diff -pur -x '*.rej' util-linux-2.12r.orig/fdisk/fdiskbsdlabel.c util-linux-2.12r/fdisk/fdiskbsdlabel.c
144 --- util-linux-2.12r.orig/fdisk/fdiskbsdlabel.c 2003-07-13 21:12:47.000000000 +0000
145 +++ util-linux-2.12r/fdisk/fdiskbsdlabel.c 2006-07-08 15:40:23.463899038 +0000
146 @@ -566,7 +566,7 @@ xbsd_write_bootstrap (void)
147 sector = get_start_sect(xbsd_part);
150 - if (ext2_llseek (fd, (long long) sector * SECTOR_SIZE, SEEK_SET) == -1)
151 + if (lseek (fd, (off_t) sector * SECTOR_SIZE, SEEK_SET) == -1)
152 fatal (unable_to_seek);
153 if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE))
154 fatal (unable_to_write);
155 @@ -735,7 +735,7 @@ xbsd_readlabel (struct partition *p, str
159 - if (ext2_llseek (fd, (long long) sector * SECTOR_SIZE, SEEK_SET) == -1)
160 + if (lseek (fd, (off_t) sector * SECTOR_SIZE, SEEK_SET) == -1)
161 fatal (unable_to_seek);
162 if (BSD_BBSIZE != read (fd, disklabelbuffer, BSD_BBSIZE))
163 fatal (unable_to_read);
164 @@ -781,12 +781,12 @@ xbsd_writelabel (struct partition *p, st
166 #if defined (__alpha__) && BSD_LABELSECTOR == 0
167 alpha_bootblock_checksum (disklabelbuffer);
168 - if (ext2_llseek (fd, (long long) 0, SEEK_SET) == -1)
169 + if (lseek (fd, (off_t) 0, SEEK_SET) == -1)
170 fatal (unable_to_seek);
171 if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE))
172 fatal (unable_to_write);
174 - if (ext2_llseek (fd, (long long) sector * SECTOR_SIZE + BSD_LABELOFFSET,
175 + if (lseek (fd, (off_t) sector * SECTOR_SIZE + BSD_LABELOFFSET,
177 fatal (unable_to_seek);
178 if (sizeof (struct xbsd_disklabel) != write (fd, d, sizeof (struct xbsd_disklabel)))
179 diff -pur -x '*.rej' util-linux-2.12r.orig/fdisk/fdisksgilabel.c util-linux-2.12r/fdisk/fdisksgilabel.c
180 --- util-linux-2.12r.orig/fdisk/fdisksgilabel.c 2004-12-18 01:53:45.000000000 +0000
181 +++ util-linux-2.12r/fdisk/fdisksgilabel.c 2006-07-08 15:40:23.464898637 +0000
182 @@ -379,7 +379,7 @@ sgi_write_table(void) {
184 sgiinfo *info = fill_sgiinfo();
185 int infostartblock = SSWAP32(sgilabel->directory[0].vol_file_start);
186 - if (ext2_llseek(fd, (long long)infostartblock*
187 + if (lseek(fd, (off_t) infostartblock*
188 SECTOR_SIZE, SEEK_SET) < 0)
189 fatal(unable_to_seek);
190 if (write(fd, info, SECTOR_SIZE) != SECTOR_SIZE)
191 diff -pur -x '*.rej' util-linux-2.12r.orig/fdisk/sfdisk.c util-linux-2.12r/fdisk/sfdisk.c
192 --- util-linux-2.12r.orig/fdisk/sfdisk.c 2005-01-04 22:31:57.000000000 +0000
193 +++ util-linux-2.12r/fdisk/sfdisk.c 2006-07-08 15:40:23.467897432 +0000
194 @@ -164,36 +164,17 @@ fatal(char *s, ...) {
196 * sseek: seek to specified sector - return 0 on failure
198 - * For >4GB disks lseek needs a > 32bit arg, and we have to use llseek.
199 - * On the other hand, a 32 bit sector number is OK until 2TB.
200 - * The routines _llseek and sseek below are the only ones that
201 - * know about the loff_t type.
203 * Note: we use 512-byte sectors here, irrespective of the hardware ss.
206 -#if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (__s390x__)
211 -static __attribute__used
212 -_syscall5(int, _llseek, unsigned int, fd, ulong, hi, ulong, lo,
213 - loff_t *, res, unsigned int, wh);
217 sseek(char *dev, unsigned int fd, unsigned long s) {
219 - in = ((loff_t) s << 9);
221 + in = ((off_t) s << 9);
225 - if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0) {
227 if ((out = lseek(fd, in, SEEK_SET)) != in) {
231 error(_("seek error on %s - cannot seek to %lu\n"), dev, s);
234 diff -pur -x '*.rej' util-linux-2.12r.orig/partx/partx.c util-linux-2.12r/partx/partx.c
235 --- util-linux-2.12r.orig/partx/partx.c 2004-08-23 20:13:27.000000000 +0000
236 +++ util-linux-2.12r/partx/partx.c 2006-07-08 15:40:23.469896630 +0000
237 @@ -330,34 +330,15 @@ xmalloc (size_t size) {
242 - * sseek: seek to specified sector
244 -#if !defined (__alpha__) && !defined (__ia64__) && !defined (__s390x__) && !defined(__x86_64__)
245 -#define NEED__llseek
249 -#include <linux/unistd.h> /* _syscall */
251 -_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo,
252 - long long *, res, uint, wh);
256 sseek(int fd, unsigned int secnr) {
258 in = ((long long) secnr << 9);
262 - if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0
265 if ((out = lseek(fd, in, SEEK_SET)) != in)
268 - fprintf(stderr, "llseek error\n");
269 + fprintf(stderr, "lseek error\n");