source: patches/util-linux-2.12r-missing_lseek-1.patch@ 9397228

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 9397228 was 73888e6, checked in by Justin Knierim <cross-lfs@…>, 18 years ago

Fixed util-linux lseek patch name to match book.

  • Property mode set to 100644
File size: 10.4 KB
RevLine 
[6cff4e4]1Submitted By: Dan Nicholson <dbn_dot_lists_at_gmail_dot_com>
2Date: 2006-07-08
3Initial Package Version: 2.12r
4Origin: Upstream
5Upstream Status: Applied in util-linux-2.13-pre6.tar.bz2
6Description: Replaces uses of *llseek with lseek. Fixes an issue
7 compiling util-linux with kernel headers from linux-2.6.18-rc1
8 headers_install.
9
10diff -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
14 endif
15 endif
16
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)
21 else
22@@ -55,7 +55,7 @@ activate: sfdisk
23 rm -f activate
24 ln -s sfdisk activate
25
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
31diff -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
34@@ -84,9 +84,6 @@
35 #include "xstrncpy.h"
36 #include "common.h"
37
38-extern long long ext2_llseek(unsigned int fd, long long offset,
39- unsigned int origin);
40-
41 #define VERSION UTIL_LINUX_VERSION
42
43 #define DEFAULT_DEVICE "/dev/hda"
44@@ -552,7 +549,7 @@ die_x(int ret) {
45
46 static void
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
54
55 static void
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) {
63 long long offset;
64
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, &sector, 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) {
72
73 offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE
74 + 1024;
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) {
81 }
82
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)) {
88 label = xfsb.s_fname;
89@@ -702,7 +699,7 @@ get_linux_label(int i) {
90 /* jfs? */
91 offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE
92 + JFS_SUPER1_OFF;
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))) {
97 label = jfsb.s_label;
98@@ -716,7 +713,7 @@ get_linux_label(int i) {
99 /* reiserfs? */
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) {
108
109 while (!done) {
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);
115 clear_warning();
116diff -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) {
120
121 static void
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);
128 }
129
130diff -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
133@@ -26,9 +26,6 @@
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)
136
137-extern long long ext2_llseek(unsigned int fd, long long offset,
138- unsigned int origin);
139-
140 #if defined(__GNUC__) && (defined(__arm__) || defined(__alpha__))
141 # define PACKED __attribute__ ((packed))
142 #else
143diff -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);
148 #endif
149
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
156 sector = 0;
157 #endif
158
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
165
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);
173 #else
174- if (ext2_llseek (fd, (long long) sector * SECTOR_SIZE + BSD_LABELOFFSET,
175+ if (lseek (fd, (off_t) sector * SECTOR_SIZE + BSD_LABELOFFSET,
176 SEEK_SET) == -1)
177 fatal (unable_to_seek);
178 if (sizeof (struct xbsd_disklabel) != write (fd, d, sizeof (struct xbsd_disklabel)))
179diff -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) {
183 */
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)
191diff -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, ...) {
195 /*
196 * sseek: seek to specified sector - return 0 on failure
197 *
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.
202- *
203 * Note: we use 512-byte sectors here, irrespective of the hardware ss.
204 */
205-#undef use_lseek
206-#if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (__s390x__)
207-#define use_lseek
208-#endif
209-
210-#ifndef use_lseek
211-static __attribute__used
212-_syscall5(int, _llseek, unsigned int, fd, ulong, hi, ulong, lo,
213- loff_t *, res, unsigned int, wh);
214-#endif
215
216 static int
217 sseek(char *dev, unsigned int fd, unsigned long s) {
218- loff_t in, out;
219- in = ((loff_t) s << 9);
220+ off_t in, out;
221+ in = ((off_t) s << 9);
222 out = 1;
223
224-#ifndef use_lseek
225- if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0) {
226-#else
227 if ((out = lseek(fd, in, SEEK_SET)) != in) {
228-#endif
229- perror("llseek");
230+ perror("lseek");
231 error(_("seek error on %s - cannot seek to %lu\n"), dev, s);
232 return 0;
233 }
234diff -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) {
238 return t;
239 }
240
241-/*
242- * sseek: seek to specified sector
243- */
244-#if !defined (__alpha__) && !defined (__ia64__) && !defined (__s390x__) && !defined(__x86_64__)
245-#define NEED__llseek
246-#endif
247-
248-#ifdef NEED__llseek
249-#include <linux/unistd.h> /* _syscall */
250-static
251-_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo,
252- long long *, res, uint, wh);
253-#endif
254-
255 static int
256 sseek(int fd, unsigned int secnr) {
257 long long in, out;
258 in = ((long long) secnr << 9);
259 out = 1;
260
261-#ifdef NEED__llseek
262- if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0
263- || out != in)
264-#else
265 if ((out = lseek(fd, in, SEEK_SET)) != in)
266-#endif
267 {
268- fprintf(stderr, "llseek error\n");
269+ fprintf(stderr, "lseek error\n");
270 return -1;
271 }
272 return 0;
Note: See TracBrowser for help on using the repository browser.