source:
patches/util-linux-2.12r-missing_lseek-1.patch@
62f536e
Last change on this file since 62f536e was 73888e6, checked in by , 18 years ago | |
---|---|
|
|
File size: 10.4 KB |
-
util-linux-2.12r
Submitted By: Dan Nicholson <dbn_dot_lists_at_gmail_dot_com> Date: 2006-07-08 Initial Package Version: 2.12r Origin: Upstream Upstream Status: Applied in util-linux-2.13-pre6.tar.bz2 Description: Replaces uses of *llseek with lseek. Fixes an issue compiling util-linux with kernel headers from linux-2.6.18-rc1 headers_install. diff -pur -x '*.rej' util-linux-2.12r.orig/fdisk/Makefile util-linux-2.12r/fdisk/Makefile
old new else 39 39 endif 40 40 endif 41 41 42 cfdisk: cfdisk.o llseek.odisksize.o i386_sys_types.o $(LIB)/xstrncpy.o42 cfdisk: cfdisk.o disksize.o i386_sys_types.o $(LIB)/xstrncpy.o 43 43 ifeq "$(HAVE_SLANG)" "yes" 44 44 $(CC) $(LDFLAGS) $^ -o $@ $(LIBSLANG) 45 45 else … … activate: sfdisk 55 55 rm -f activate 56 56 ln -s sfdisk activate 57 57 58 fdisk: fdisk.o llseek.odisksize.o fdiskbsdlabel.o fdisksgilabel.o \58 fdisk: fdisk.o disksize.o fdiskbsdlabel.o fdisksgilabel.o \ 59 59 fdisksunlabel.o fdiskaixlabel.o i386_sys_types.o partname.o 60 60 fdisk.o: fdisk.c fdisk.h 61 61 fdiskbsdlabel.o: fdiskbsdlabel.c fdisk.h fdiskbsdlabel.h -
util-linux-2.12r
diff -pur -x '*.rej' util-linux-2.12r.orig/fdisk/cfdisk.c util-linux-2.12r/fdisk/cfdisk.c
old new 84 84 #include "xstrncpy.h" 85 85 #include "common.h" 86 86 87 extern long long ext2_llseek(unsigned int fd, long long offset,88 unsigned int origin);89 90 87 #define VERSION UTIL_LINUX_VERSION 91 88 92 89 #define DEFAULT_DEVICE "/dev/hda" … … die_x(int ret) { 552 549 553 550 static void 554 551 read_sector(char *buffer, long long sect_num) { 555 if ( ext2_llseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)552 if (lseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0) 556 553 fatal(_("Cannot seek on disk drive"), 2); 557 554 if (read(fd, buffer, SECTOR_SIZE) != SECTOR_SIZE) 558 555 fatal(_("Cannot read disk drive"), 2); … … read_sector(char *buffer, long long sect 560 557 561 558 static void 562 559 write_sector(char *buffer, long long sect_num) { 563 if ( ext2_llseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)560 if (lseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0) 564 561 fatal(_("Cannot seek on disk drive"), 2); 565 562 if (write(fd, buffer, SECTOR_SIZE) != SECTOR_SIZE) 566 563 fatal(_("Cannot write disk drive"), 2); … … get_dos_label(int i) { 587 584 long long offset; 588 585 589 586 offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE; 590 if ( ext2_llseek(fd, offset, SEEK_SET) == offset587 if (lseek(fd, offset, SEEK_SET) == offset 591 588 && read(fd, §or, sizeof(sector)) == sizeof(sector)) { 592 589 dos_copy_to_info(p_info[i].ostype, OSTYPESZ, 593 590 sector+DOS_OSTYPE_OFFSET, DOS_OSTYPE_SZ); … … get_linux_label(int i) { 672 669 673 670 offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE 674 671 + 1024; 675 if ( ext2_llseek(fd, offset, SEEK_SET) == offset672 if (lseek(fd, offset, SEEK_SET) == offset 676 673 && read(fd, &e2fsb, sizeof(e2fsb)) == sizeof(e2fsb) 677 674 && e2fsb.s_magic[0] + (e2fsb.s_magic[1]<<8) == EXT2_SUPER_MAGIC) { 678 675 label = e2fsb.s_volume_name; … … get_linux_label(int i) { 688 685 } 689 686 690 687 offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE + 0; 691 if ( ext2_llseek(fd, offset, SEEK_SET) == offset688 if (lseek(fd, offset, SEEK_SET) == offset 692 689 && read(fd, &xfsb, sizeof(xfsb)) == sizeof(xfsb) 693 690 && !strncmp(xfsb.s_magic, XFS_SUPER_MAGIC, 4)) { 694 691 label = xfsb.s_fname; … … get_linux_label(int i) { 702 699 /* jfs? */ 703 700 offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE 704 701 + JFS_SUPER1_OFF; 705 if ( ext2_llseek(fd, offset, SEEK_SET) == offset702 if (lseek(fd, offset, SEEK_SET) == offset 706 703 && read(fd, &jfsb, sizeof(jfsb)) == sizeof(jfsb) 707 704 && !strncmp(jfsb.s_magic, JFS_MAGIC, strlen(JFS_MAGIC))) { 708 705 label = jfsb.s_label; … … get_linux_label(int i) { 716 713 /* reiserfs? */ 717 714 offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE 718 715 + REISERFS_DISK_OFFSET_IN_BYTES; 719 if ( ext2_llseek(fd, offset, SEEK_SET) == offset716 if (lseek(fd, offset, SEEK_SET) == offset 720 717 && read(fd, &reiserfsb, sizeof(reiserfsb)) == sizeof(reiserfsb) 721 718 && has_reiserfs_magic_string(&reiserfsb, &reiserfs_is_3_6)) { 722 719 if (reiserfs_is_3_6) { … … write_part_table(void) { 1860 1857 1861 1858 while (!done) { 1862 1859 mvaddstr(COMMAND_LINE_Y, COMMAND_LINE_X, 1863 _("Are you sure you want write the partition table "1860 _("Are you sure you want to write the partition table " 1864 1861 "to disk? (yes or no): ")); 1865 1862 len = get_string(response, LINE_LENGTH, NULL); 1866 1863 clear_warning(); -
util-linux-2.12r
diff -pur -x '*.rej' util-linux-2.12r.orig/fdisk/fdisk.c util-linux-2.12r/fdisk/fdisk.c
old new void fatal(enum failure why) { 239 239 240 240 static void 241 241 seek_sector(int fd, unsigned int secno) { 242 long long offset = (long long) secno * sector_size;243 if ( ext2_llseek(fd, offset, SEEK_SET) == (long long) -1)242 off_t offset = (off_t) secno * sector_size; 243 if (lseek(fd, offset, SEEK_SET) == (off_t) -1) 244 244 fatal(unable_to_seek); 245 245 } 246 246 -
util-linux-2.12r
diff -pur -x '*.rej' util-linux-2.12r.orig/fdisk/fdisk.h util-linux-2.12r/fdisk/fdisk.h
old new 26 26 #define cround(n) (display_in_cyl_units ? ((n)/units_per_sector)+1 : (n)) 27 27 #define scround(x) (((x)+units_per_sector-1)/units_per_sector) 28 28 29 extern long long ext2_llseek(unsigned int fd, long long offset,30 unsigned int origin);31 32 29 #if defined(__GNUC__) && (defined(__arm__) || defined(__alpha__)) 33 30 # define PACKED __attribute__ ((packed)) 34 31 #else -
fdisk/fdiskbsdlabel.c
diff -pur -x '*.rej' util-linux-2.12r.orig/fdisk/fdiskbsdlabel.c util-linux-2.12r/fdisk/fdiskbsdlabel.c
old new xbsd_write_bootstrap (void) 566 566 sector = get_start_sect(xbsd_part); 567 567 #endif 568 568 569 if ( ext2_llseek (fd, (long long) sector * SECTOR_SIZE, SEEK_SET) == -1)569 if (lseek (fd, (off_t) sector * SECTOR_SIZE, SEEK_SET) == -1) 570 570 fatal (unable_to_seek); 571 571 if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE)) 572 572 fatal (unable_to_write); … … xbsd_readlabel (struct partition *p, str 735 735 sector = 0; 736 736 #endif 737 737 738 if ( ext2_llseek (fd, (long long) sector * SECTOR_SIZE, SEEK_SET) == -1)738 if (lseek (fd, (off_t) sector * SECTOR_SIZE, SEEK_SET) == -1) 739 739 fatal (unable_to_seek); 740 740 if (BSD_BBSIZE != read (fd, disklabelbuffer, BSD_BBSIZE)) 741 741 fatal (unable_to_read); … … xbsd_writelabel (struct partition *p, st 781 781 782 782 #if defined (__alpha__) && BSD_LABELSECTOR == 0 783 783 alpha_bootblock_checksum (disklabelbuffer); 784 if ( ext2_llseek (fd, (long long) 0, SEEK_SET) == -1)784 if (lseek (fd, (off_t) 0, SEEK_SET) == -1) 785 785 fatal (unable_to_seek); 786 786 if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE)) 787 787 fatal (unable_to_write); 788 788 #else 789 if ( ext2_llseek (fd, (long long) sector * SECTOR_SIZE + BSD_LABELOFFSET,789 if (lseek (fd, (off_t) sector * SECTOR_SIZE + BSD_LABELOFFSET, 790 790 SEEK_SET) == -1) 791 791 fatal (unable_to_seek); 792 792 if (sizeof (struct xbsd_disklabel) != write (fd, d, sizeof (struct xbsd_disklabel))) -
fdisk/fdisksgilabel.c
diff -pur -x '*.rej' util-linux-2.12r.orig/fdisk/fdisksgilabel.c util-linux-2.12r/fdisk/fdisksgilabel.c
old new sgi_write_table(void) { 379 379 */ 380 380 sgiinfo *info = fill_sgiinfo(); 381 381 int infostartblock = SSWAP32(sgilabel->directory[0].vol_file_start); 382 if ( ext2_llseek(fd, (long long)infostartblock*382 if (lseek(fd, (off_t) infostartblock* 383 383 SECTOR_SIZE, SEEK_SET) < 0) 384 384 fatal(unable_to_seek); 385 385 if (write(fd, info, SECTOR_SIZE) != SECTOR_SIZE) -
util-linux-2.12r
diff -pur -x '*.rej' util-linux-2.12r.orig/fdisk/sfdisk.c util-linux-2.12r/fdisk/sfdisk.c
old new fatal(char *s, ...) { 164 164 /* 165 165 * sseek: seek to specified sector - return 0 on failure 166 166 * 167 * For >4GB disks lseek needs a > 32bit arg, and we have to use llseek.168 * On the other hand, a 32 bit sector number is OK until 2TB.169 * The routines _llseek and sseek below are the only ones that170 * know about the loff_t type.171 *172 167 * Note: we use 512-byte sectors here, irrespective of the hardware ss. 173 168 */ 174 #undef use_lseek175 #if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (__s390x__)176 #define use_lseek177 #endif178 179 #ifndef use_lseek180 static __attribute__used181 _syscall5(int, _llseek, unsigned int, fd, ulong, hi, ulong, lo,182 loff_t *, res, unsigned int, wh);183 #endif184 169 185 170 static int 186 171 sseek(char *dev, unsigned int fd, unsigned long s) { 187 loff_t in, out;188 in = (( loff_t) s << 9);172 off_t in, out; 173 in = ((off_t) s << 9); 189 174 out = 1; 190 175 191 #ifndef use_lseek192 if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0) {193 #else194 176 if ((out = lseek(fd, in, SEEK_SET)) != in) { 195 #endif 196 perror("llseek"); 177 perror("lseek"); 197 178 error(_("seek error on %s - cannot seek to %lu\n"), dev, s); 198 179 return 0; 199 180 } -
util-linux-2.12r
diff -pur -x '*.rej' util-linux-2.12r.orig/partx/partx.c util-linux-2.12r/partx/partx.c
old new xmalloc (size_t size) { 330 330 return t; 331 331 } 332 332 333 /*334 * sseek: seek to specified sector335 */336 #if !defined (__alpha__) && !defined (__ia64__) && !defined (__s390x__) && !defined(__x86_64__)337 #define NEED__llseek338 #endif339 340 #ifdef NEED__llseek341 #include <linux/unistd.h> /* _syscall */342 static343 _syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo,344 long long *, res, uint, wh);345 #endif346 347 333 static int 348 334 sseek(int fd, unsigned int secnr) { 349 335 long long in, out; 350 336 in = ((long long) secnr << 9); 351 337 out = 1; 352 338 353 #ifdef NEED__llseek354 if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0355 || out != in)356 #else357 339 if ((out = lseek(fd, in, SEEK_SET)) != in) 358 #endif359 340 { 360 fprintf(stderr, "l lseek error\n");341 fprintf(stderr, "lseek error\n"); 361 342 return -1; 362 343 } 363 344 return 0;
Note:
See TracBrowser
for help on using the repository browser.