source: clfs-sysroot/patches/util-linux-2.12r-missing_lseek-1.patch@ a6fcbd5

Last change on this file since a6fcbd5 was 8f3d581, checked in by Joe Ciccone <jciccone@…>, 18 years ago

Add all of the patches needed for clfs-sysroot.

  • Property mode set to 100644
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  
    3939endif
    4040endif
    4141
    42 cfdisk: cfdisk.o llseek.o disksize.o i386_sys_types.o $(LIB)/xstrncpy.o
     42cfdisk: cfdisk.o disksize.o i386_sys_types.o $(LIB)/xstrncpy.o
    4343ifeq "$(HAVE_SLANG)" "yes"
    4444        $(CC) $(LDFLAGS) $^ -o $@ $(LIBSLANG)
    4545else
    activate: sfdisk  
    5555        rm -f activate
    5656        ln -s sfdisk activate
    5757
    58 fdisk: fdisk.o llseek.o disksize.o fdiskbsdlabel.o fdisksgilabel.o \
     58fdisk: fdisk.o disksize.o fdiskbsdlabel.o fdisksgilabel.o \
    5959        fdisksunlabel.o fdiskaixlabel.o i386_sys_types.o partname.o
    6060fdisk.o: fdisk.c fdisk.h
    6161fdiskbsdlabel.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  
    8484#include "xstrncpy.h"
    8585#include "common.h"
    8686
    87 extern long long ext2_llseek(unsigned int fd, long long offset,
    88                              unsigned int origin);
    89 
    9087#define VERSION UTIL_LINUX_VERSION
    9188
    9289#define DEFAULT_DEVICE "/dev/hda"
    die_x(int ret) {  
    552549
    553550static void
    554551read_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)
    556553        fatal(_("Cannot seek on disk drive"), 2);
    557554    if (read(fd, buffer, SECTOR_SIZE) != SECTOR_SIZE)
    558555        fatal(_("Cannot read disk drive"), 2);
    read_sector(char *buffer, long long sect  
    560557
    561558static void
    562559write_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)
    564561        fatal(_("Cannot seek on disk drive"), 2);
    565562    if (write(fd, buffer, SECTOR_SIZE) != SECTOR_SIZE)
    566563        fatal(_("Cannot write disk drive"), 2);
    get_dos_label(int i) {  
    587584        long long offset;
    588585
    589586        offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE;
    590         if (ext2_llseek(fd, offset, SEEK_SET) == offset
     587        if (lseek(fd, offset, SEEK_SET) == offset
    591588            && read(fd, &sector, sizeof(sector)) == sizeof(sector)) {
    592589                dos_copy_to_info(p_info[i].ostype, OSTYPESZ,
    593590                                 sector+DOS_OSTYPE_OFFSET, DOS_OSTYPE_SZ);
    get_linux_label(int i) {  
    672669
    673670        offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE
    674671                + 1024;
    675         if (ext2_llseek(fd, offset, SEEK_SET) == offset
     672        if (lseek(fd, offset, SEEK_SET) == offset
    676673            && read(fd, &e2fsb, sizeof(e2fsb)) == sizeof(e2fsb)
    677674            && e2fsb.s_magic[0] + (e2fsb.s_magic[1]<<8) == EXT2_SUPER_MAGIC) {
    678675                label = e2fsb.s_volume_name;
    get_linux_label(int i) {  
    688685        }
    689686
    690687        offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE + 0;
    691         if (ext2_llseek(fd, offset, SEEK_SET) == offset
     688        if (lseek(fd, offset, SEEK_SET) == offset
    692689            && read(fd, &xfsb, sizeof(xfsb)) == sizeof(xfsb)
    693690            && !strncmp(xfsb.s_magic, XFS_SUPER_MAGIC, 4)) {
    694691                label = xfsb.s_fname;
    get_linux_label(int i) {  
    702699        /* jfs? */
    703700        offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE
    704701                + JFS_SUPER1_OFF;
    705         if (ext2_llseek(fd, offset, SEEK_SET) == offset
     702        if (lseek(fd, offset, SEEK_SET) == offset
    706703            && read(fd, &jfsb, sizeof(jfsb)) == sizeof(jfsb)
    707704            && !strncmp(jfsb.s_magic, JFS_MAGIC, strlen(JFS_MAGIC))) {
    708705                label = jfsb.s_label;
    get_linux_label(int i) {  
    716713        /* reiserfs? */
    717714        offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE
    718715                + REISERFS_DISK_OFFSET_IN_BYTES;
    719         if (ext2_llseek(fd, offset, SEEK_SET) == offset
     716        if (lseek(fd, offset, SEEK_SET) == offset
    720717            && read(fd, &reiserfsb, sizeof(reiserfsb)) == sizeof(reiserfsb)
    721718            && has_reiserfs_magic_string(&reiserfsb, &reiserfs_is_3_6)) {
    722719                if (reiserfs_is_3_6) {
    write_part_table(void) {  
    18601857
    18611858         while (!done) {
    18621859              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 "
    18641861                       "to disk? (yes or no): "));
    18651862              len = get_string(response, LINE_LENGTH, NULL);
    18661863              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) {  
    239239
    240240static void
    241241seek_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)
    244244                fatal(unable_to_seek);
    245245}
    246246
  • 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  
    2626#define cround(n)       (display_in_cyl_units ? ((n)/units_per_sector)+1 : (n))
    2727#define scround(x)      (((x)+units_per_sector-1)/units_per_sector)
    2828
    29 extern long long ext2_llseek(unsigned int fd, long long offset,
    30                              unsigned int origin);
    31 
    3229#if defined(__GNUC__) && (defined(__arm__) || defined(__alpha__))
    3330# define PACKED __attribute__ ((packed))
    3431#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)  
    566566  sector = get_start_sect(xbsd_part);
    567567#endif
    568568
    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)
    570570    fatal (unable_to_seek);
    571571  if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE))
    572572    fatal (unable_to_write);
    xbsd_readlabel (struct partition *p, str  
    735735        sector = 0;
    736736#endif
    737737
    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)
    739739                fatal (unable_to_seek);
    740740        if (BSD_BBSIZE != read (fd, disklabelbuffer, BSD_BBSIZE))
    741741                fatal (unable_to_read);
    xbsd_writelabel (struct partition *p, st  
    781781
    782782#if defined (__alpha__) && BSD_LABELSECTOR == 0
    783783  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)
    785785    fatal (unable_to_seek);
    786786  if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE))
    787787    fatal (unable_to_write);
    788788#else
    789   if (ext2_llseek (fd, (long long) sector * SECTOR_SIZE + BSD_LABELOFFSET,
     789  if (lseek (fd, (off_t) sector * SECTOR_SIZE + BSD_LABELOFFSET,
    790790                   SEEK_SET) == -1)
    791791    fatal (unable_to_seek);
    792792  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) {  
    379379                 */
    380380                sgiinfo *info = fill_sgiinfo();
    381381                int infostartblock = SSWAP32(sgilabel->directory[0].vol_file_start);
    382                 if (ext2_llseek(fd, (long long)infostartblock*
     382                if (lseek(fd, (off_t) infostartblock*
    383383                                SECTOR_SIZE, SEEK_SET) < 0)
    384384                        fatal(unable_to_seek);
    385385                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, ...) {  
    164164/*
    165165 * sseek: seek to specified sector - return 0 on failure
    166166 *
    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 that
    170  * know about the loff_t type.
    171  *
    172167 * Note: we use 512-byte sectors here, irrespective of the hardware ss.
    173168 */
    174 #undef use_lseek
    175 #if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (__s390x__)
    176 #define use_lseek
    177 #endif
    178 
    179 #ifndef use_lseek
    180 static __attribute__used
    181 _syscall5(int,  _llseek,  unsigned int,  fd, ulong, hi, ulong, lo,
    182        loff_t *, res, unsigned int, wh);
    183 #endif
    184169
    185170static int
    186171sseek(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);
    189174    out = 1;
    190175
    191 #ifndef use_lseek
    192     if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0) {
    193 #else
    194176    if ((out = lseek(fd, in, SEEK_SET)) != in) {
    195 #endif
    196         perror("llseek");
     177        perror("lseek");
    197178        error(_("seek error on %s - cannot seek to %lu\n"), dev, s);
    198179        return 0;
    199180    }
  • 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) {  
    330330        return t;
    331331}
    332332
    333 /*
    334  * sseek: seek to specified sector
    335  */
    336 #if !defined (__alpha__) && !defined (__ia64__) && !defined (__s390x__) && !defined(__x86_64__)
    337 #define NEED__llseek
    338 #endif
    339 
    340 #ifdef NEED__llseek
    341 #include <linux/unistd.h>       /* _syscall */
    342 static
    343 _syscall5(int,  _llseek,  uint,  fd, ulong, hi, ulong, lo,
    344           long long *, res, uint, wh);
    345 #endif
    346 
    347333static int
    348334sseek(int fd, unsigned int secnr) {
    349335        long long in, out;
    350336        in = ((long long) secnr << 9);
    351337        out = 1;
    352338
    353 #ifdef NEED__llseek
    354         if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0
    355             || out != in)
    356 #else
    357339        if ((out = lseek(fd, in, SEEK_SET)) != in)
    358 #endif
    359340        {
    360                 fprintf(stderr, "llseek error\n");
     341                fprintf(stderr, "lseek error\n");
    361342                return -1;
    362343        }
    363344        return 0;
Note: See TracBrowser for help on using the repository browser.