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

  1. diff -Naur util-linux-2.12.orig/fdisk/cfdisk.c util-linux-2.12/fdisk/cfdisk.c
  2. --- util-linux-2.12.orig/fdisk/cfdisk.c 2004-03-27 18:50:54.000000000 +0100
  3. +++ util-linux-2.12/fdisk/cfdisk.c 2004-03-27 18:34:56.000000000 +0100
  4. @@ -85,9 +85,6 @@
  5. #include "get_blocks.h"
  6. #include "common.h"
  7. -extern long long ext2_llseek(unsigned int fd, long long offset,
  8. - unsigned int origin);
  9. -
  10. #define VERSION UTIL_LINUX_VERSION
  11. #ifdef __GNU__
  12. @@ -578,16 +575,16 @@
  13. }
  14. static void
  15. -read_sector(char *buffer, long long sect_num) {
  16. - if (ext2_llseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)
  17. +read_sector(char *buffer, off_t sect_num) {
  18. + if (lseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)
  19. fatal(_("Cannot seek on disk drive"), 2);
  20. if (read(fd, buffer, SECTOR_SIZE) != SECTOR_SIZE)
  21. fatal(_("Cannot read disk drive"), 2);
  22. }
  23. static void
  24. -write_sector(char *buffer, long long sect_num) {
  25. - if (ext2_llseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)
  26. +write_sector(char *buffer, off_t sect_num) {
  27. + if (lseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)
  28. fatal(_("Cannot seek on disk drive"), 2);
  29. if (write(fd, buffer, SECTOR_SIZE) != SECTOR_SIZE)
  30. fatal(_("Cannot write disk drive"), 2);
  31. @@ -611,10 +608,10 @@
  32. #define DOS_OSTYPE_SZ 8
  33. #define DOS_LABEL_SZ 11
  34. #define DOS_FSTYPE_SZ 8
  35. - long long offset;
  36. + off_t offset;
  37. offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE;
  38. - if (ext2_llseek(fd, offset, SEEK_SET) == offset
  39. + if (lseek(fd, offset, SEEK_SET) == offset
  40. && read(fd, &sector, sizeof(sector)) == sizeof(sector)) {
  41. dos_copy_to_info(p_info[i].ostype, OSTYPESZ,
  42. sector+DOS_OSTYPE_OFFSET, DOS_OSTYPE_SZ);
  43. @@ -671,12 +668,12 @@
  44. } xfsb;
  45. char *label;
  46. - long long offset;
  47. + off_t offset;
  48. int j;
  49. offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE
  50. + 1024;
  51. - if (ext2_llseek(fd, offset, SEEK_SET) == offset
  52. + if (lseek(fd, offset, SEEK_SET) == offset
  53. && read(fd, &e2fsb, sizeof(e2fsb)) == sizeof(e2fsb)
  54. && e2fsb.s_magic[0] + (e2fsb.s_magic[1]<<8) == EXT2_SUPER_MAGIC) {
  55. label = e2fsb.s_volume_name;
  56. @@ -692,7 +689,7 @@
  57. }
  58. offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE + 0;
  59. - if (ext2_llseek(fd, offset, SEEK_SET) == offset
  60. + if (lseek(fd, offset, SEEK_SET) == offset
  61. && read(fd, &xfsb, sizeof(xfsb)) == sizeof(xfsb)
  62. && !strcmp(xfsb.s_magic, XFS_SUPER_MAGIC)) {
  63. label = xfsb.s_fname;
  64. @@ -706,7 +703,7 @@
  65. /* reiserfs? */
  66. offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE
  67. + REISERFS_DISK_OFFSET_IN_BYTES;
  68. - if (ext2_llseek(fd, offset, SEEK_SET) == offset
  69. + if (lseek(fd, offset, SEEK_SET) == offset
  70. && read(fd, &reiserfsb, 1024) == 1024
  71. && is_reiserfs_magic_string(&reiserfsb)) {
  72. strncpy(p_info[i].fstype, "reiserfs", FSTYPESZ);
  73. diff -Naur util-linux-2.12.orig/fdisk/fdiskbsdlabel.c util-linux-2.12/fdisk/fdiskbsdlabel.c
  74. --- util-linux-2.12.orig/fdisk/fdiskbsdlabel.c 2004-03-27 18:50:54.000000000 +0100
  75. +++ util-linux-2.12/fdisk/fdiskbsdlabel.c 2004-03-27 18:36:51.000000000 +0100
  76. @@ -574,7 +574,7 @@
  77. sector = get_start_sect(xbsd_part);
  78. #endif
  79. - if (ext2_llseek (fd, (long long) sector * SECTOR_SIZE, SEEK_SET) == -1)
  80. + if (lseek (fd, (off_t) sector * SECTOR_SIZE, SEEK_SET) == -1)
  81. fatal (unable_to_seek);
  82. if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE))
  83. fatal (unable_to_write);
  84. @@ -745,7 +745,7 @@
  85. sector = 0;
  86. #endif
  87. - if (ext2_llseek (fd, (long long) sector * SECTOR_SIZE, SEEK_SET) == -1)
  88. + if (lseek (fd, (off_t) sector * SECTOR_SIZE, SEEK_SET) == -1)
  89. fatal (unable_to_seek);
  90. if (BSD_BBSIZE != read (fd, disklabelbuffer, BSD_BBSIZE))
  91. fatal (unable_to_read);
  92. @@ -791,12 +791,12 @@
  93. #if defined (__alpha__) && BSD_LABELSECTOR == 0
  94. alpha_bootblock_checksum (disklabelbuffer);
  95. - if (ext2_llseek (fd, (long long) 0, SEEK_SET) == -1)
  96. + if (lseek (fd, (off_t) 0, SEEK_SET) == -1)
  97. fatal (unable_to_seek);
  98. if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE))
  99. fatal (unable_to_write);
  100. #else
  101. - if (ext2_llseek (fd, (long long) sector * SECTOR_SIZE + BSD_LABELOFFSET,
  102. + if (lseek (fd, (off_t) sector * SECTOR_SIZE + BSD_LABELOFFSET,
  103. SEEK_SET) == -1)
  104. fatal (unable_to_seek);
  105. if (sizeof (struct xbsd_disklabel) != write (fd, d, sizeof (struct xbsd_disklabel)))
  106. diff -Naur util-linux-2.12.orig/fdisk/fdisk.c util-linux-2.12/fdisk/fdisk.c
  107. --- util-linux-2.12.orig/fdisk/fdisk.c 2004-03-27 18:50:54.000000000 +0100
  108. +++ util-linux-2.12/fdisk/fdisk.c 2004-03-27 18:35:42.000000000 +0100
  109. @@ -241,7 +241,7 @@
  110. static void
  111. seek_sector(int fd, unsigned int secno) {
  112. long long offset = (long long) secno * sector_size;
  113. - if (ext2_llseek(fd, offset, SEEK_SET) == (long long) -1)
  114. + if (lseek(fd, offset, SEEK_SET) == (off_t) -1)
  115. fatal(unable_to_seek);
  116. }
  117. diff -Naur util-linux-2.12.orig/fdisk/fdisksgilabel.c util-linux-2.12/fdisk/fdisksgilabel.c
  118. --- util-linux-2.12.orig/fdisk/fdisksgilabel.c 2004-03-27 18:50:54.000000000 +0100
  119. +++ util-linux-2.12/fdisk/fdisksgilabel.c 2004-03-27 18:37:17.000000000 +0100
  120. @@ -379,7 +379,7 @@
  121. */
  122. sgiinfo *info = fill_sgiinfo();
  123. int infostartblock = SSWAP32(sgilabel->directory[0].vol_file_start);
  124. - if (ext2_llseek(fd, (long long)infostartblock*
  125. + if (lseek(fd, (off_t)infostartblock*
  126. SECTOR_SIZE, SEEK_SET) < 0)
  127. fatal(unable_to_seek);
  128. if (write(fd, info, SECTOR_SIZE) != SECTOR_SIZE)
  129. diff -Naur util-linux-2.12.orig/fdisk/llseek.c util-linux-2.12/fdisk/llseek.c
  130. --- util-linux-2.12.orig/fdisk/llseek.c 2003-07-13 20:30:27.000000000 +0200
  131. +++ util-linux-2.12/fdisk/llseek.c 1970-01-01 01:00:00.000000000 +0100
  132. @@ -1,110 +0,0 @@
  133. -/*
  134. - * llseek.c -- stub calling the llseek system call
  135. - *
  136. - * Copyright (C) 1994 Remy Card. This file may be redistributed
  137. - * under the terms of the GNU Public License.
  138. - */
  139. -
  140. -#include <sys/types.h>
  141. -
  142. -#include <errno.h>
  143. -#include <unistd.h>
  144. -
  145. -extern long long ext2_llseek (unsigned int, long long, unsigned int);
  146. -
  147. -#ifdef __linux__
  148. -
  149. -#ifdef HAVE_LLSEEK
  150. -#include <syscall.h>
  151. -
  152. -#else /* HAVE_LLSEEK */
  153. -
  154. -#if defined(__alpha__) || defined(__ia64__) || defined(__s390x__)
  155. -
  156. -#define my_llseek lseek
  157. -
  158. -#else
  159. -#include <linux/unistd.h> /* for __NR__llseek */
  160. -
  161. -static int _llseek (unsigned int, unsigned long,
  162. - unsigned long, long long *, unsigned int);
  163. -
  164. -#ifdef __NR__llseek
  165. -
  166. -static _syscall5(int,_llseek,unsigned int,fd,unsigned long,offset_high,
  167. - unsigned long, offset_low,long long *,result,
  168. - unsigned int, origin)
  169. -
  170. -#else
  171. -
  172. -/* no __NR__llseek on compilation machine - might give it explicitly */
  173. -static int _llseek (unsigned int fd, unsigned long oh,
  174. - unsigned long ol, long long *result,
  175. - unsigned int origin) {
  176. - errno = ENOSYS;
  177. - return -1;
  178. -}
  179. -
  180. -#endif
  181. -
  182. -static long long my_llseek (unsigned int fd, long long offset,
  183. - unsigned int origin)
  184. -{
  185. - long long result;
  186. - int retval;
  187. -
  188. - retval = _llseek (fd, ((unsigned long long) offset) >> 32,
  189. - ((unsigned long long) offset) & 0xffffffff,
  190. - &result, origin);
  191. - return (retval == -1 ? (long long) retval : result);
  192. -}
  193. -
  194. -#endif /* __alpha__ */
  195. -
  196. -#endif /* HAVE_LLSEEK */
  197. -
  198. -long long ext2_llseek (unsigned int fd, long long offset,
  199. - unsigned int origin)
  200. -{
  201. - long long result;
  202. - static int do_compat = 0;
  203. -
  204. - if (!do_compat) {
  205. - result = my_llseek (fd, offset, origin);
  206. - if (!(result == -1 && errno == ENOSYS))
  207. - return result;
  208. -
  209. - /*
  210. - * Just in case this code runs on top of an old kernel
  211. - * which does not support the llseek system call
  212. - */
  213. - do_compat = 1;
  214. - /*
  215. - * Now try ordinary lseek.
  216. - */
  217. - }
  218. -
  219. - if ((sizeof(off_t) >= sizeof(long long)) ||
  220. - (offset < ((long long) 1 << ((sizeof(off_t)*8) -1))))
  221. - return lseek(fd, (off_t) offset, origin);
  222. -
  223. - errno = EINVAL;
  224. - return -1;
  225. -}
  226. -
  227. -#else /* !linux */
  228. -
  229. -long long ext2_llseek (unsigned int fd, long long offset,
  230. - unsigned int origin)
  231. -{
  232. - if ((sizeof(off_t) < sizeof(long long)) &&
  233. - (offset >= ((long long) 1 << ((sizeof(off_t)*8) -1)))) {
  234. - errno = EINVAL;
  235. - return -1;
  236. - }
  237. - return lseek (fd, (off_t) offset, origin);
  238. -}
  239. -
  240. -#endif /* linux */
  241. -
  242. -
  243. diff -Naur util-linux-2.12.orig/po/POTFILES.in util-linux-2.12/po/POTFILES.in
  244. --- util-linux-2.12.orig/po/POTFILES.in 2003-07-05 22:19:45.000000000 +0200
  245. +++ util-linux-2.12/po/POTFILES.in 2004-03-27 18:46:42.000000000 +0100
  246. @@ -18,7 +18,6 @@
  247. fdisk/fdisksgilabel.c
  248. fdisk/fdisksunlabel.c
  249. fdisk/i386_sys_types.c
  250. -fdisk/llseek.c
  251. fdisk/partname.c
  252. fdisk/sfdisk.c
  253. getopt/getopt.c
  254. --- ./fdisk/Makefile.orig 2004-08-22 09:30:42.000000000 -0500
  255. +++ ./fdisk/Makefile 2004-08-22 09:30:55.000000000 -0500
  256. @@ -39,7 +39,7 @@
  257. endif
  258. endif
  259. -cfdisk: cfdisk.o llseek.o i386_sys_types.o $(LIB)/xstrncpy.o
  260. +cfdisk: cfdisk.o i386_sys_types.o $(LIB)/xstrncpy.o
  261. ifeq "$(HAVE_SLANG)" "yes"
  262. $(CC) $(LDFLAGS) $^ -o $@ $(LIBSLANG)
  263. else
  264. @@ -55,7 +55,7 @@
  265. rm -f activate
  266. ln -s sfdisk activate
  267. -fdisk: fdisk.o llseek.o fdiskbsdlabel.o fdisksgilabel.o fdisksunlabel.o \
  268. +fdisk: fdisk.o fdiskbsdlabel.o fdisksgilabel.o fdisksunlabel.o \
  269. fdiskaixlabel.o i386_sys_types.o partname.o
  270. fdisk.o: fdisk.c fdisk.h
  271. fdiskbsdlabel.o: fdiskbsdlabel.c fdisk.h fdiskbsdlabel.h
  272. --- ./fdisk/sfdisk.c.orig 2004-08-22 09:34:01.000000000 -0500
  273. +++ ./fdisk/sfdisk.c 2004-08-22 09:36:31.000000000 -0500
  274. @@ -123,30 +123,18 @@
  275. /*
  276. * sseek: seek to specified sector - return 0 on failure
  277. *
  278. - * For >4GB disks lseek needs a > 32bit arg, and we have to use llseek.
  279. - * On the other hand, a 32 bit sector number is OK until 2TB.
  280. - * The routines _llseek and sseek below are the only ones that
  281. - * know about the loff_t type.
  282. + * This relies on _FILE_OFFSET_BITS=64.
  283. *
  284. * Note: we use 512-byte sectors here, irrespective of the hardware ss.
  285. */
  286. -#if !defined (__alpha__) && !defined (__ia64__) && !defined (__x86_64__) && !defined (__s390x__)
  287. -static
  288. -_syscall5(int, _llseek, unsigned int, fd, ulong, hi, ulong, lo,
  289. - loff_t *, res, unsigned int, wh);
  290. -#endif
  291. static int
  292. sseek(char *dev, unsigned int fd, unsigned long s) {
  293. - loff_t in, out;
  294. - in = ((loff_t) s << 9);
  295. + off_t in, out;
  296. + in = ((off_t) s << 9);
  297. out = 1;
  298. -#if !defined (__alpha__) && !defined (__ia64__) && !defined (__x86_64__) && !defined (__s390x__)
  299. - if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0) {
  300. -#else
  301. if ((out = lseek(fd, in, SEEK_SET)) != in) {
  302. -#endif
  303. perror("llseek");
  304. error(_("seek error on %s - cannot seek to %lu\n"), dev, s);
  305. return 0;
  306. --- ./partx/partx.c.orig 2004-08-23 06:23:31.000000000 -0500
  307. +++ ./partx/partx.c 2004-08-23 06:26:36.000000000 -0500
  308. @@ -333,30 +333,16 @@
  309. /*
  310. * sseek: seek to specified sector
  311. + *
  312. + * This relies on _FILE_OFFSET_BITS=64.
  313. */
  314. -#if !defined (__alpha__) && !defined (__ia64__) && !defined (__s390x__) && !defined(__x86_64__)
  315. -#define NEED__llseek
  316. -#endif
  317. -
  318. -#ifdef NEED__llseek
  319. -#include <linux/unistd.h> /* _syscall */
  320. -static
  321. -_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo,
  322. - long long *, res, uint, wh);
  323. -#endif
  324. -
  325. static int
  326. sseek(int fd, unsigned int secnr) {
  327. - long long in, out;
  328. - in = ((long long) secnr << 9);
  329. + off_t in, out;
  330. + in = ((off_t) secnr << 9);
  331. out = 1;
  332. -#ifdef NEED__llseek
  333. - if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0
  334. - || out != in)
  335. -#else
  336. if ((out = lseek(fd, in, SEEK_SET)) != in)
  337. -#endif
  338. {
  339. fprintf(stderr, "llseek error\n");
  340. return -1;