--- lilo-22.4.1.orig/activate.c 1997-04-30 10:30:42 +0400 +++ lilo-22.4.1.orig/activate.c 2004-12-29 00:44:42 +0300 @@ -3,6 +3,7 @@ /* Copyright 1992-1995 Werner Almesberger. See file COPYING for details. */ +#define _GNU_SOURCE #include #include #include --- lilo-22.4.1.orig/bitmap.h 2002-02-27 00:07:51 +0300 +++ lilo-22.4.1.orig/bitmap.h 2004-12-29 00:45:21 +0300 @@ -12,8 +12,8 @@ #ifndef BITMAP_H #define BITMAP_H -typedef unsigned long bm_uint32; -typedef signed long bm_sint32; +typedef unsigned int bm_uint32; +typedef signed int bm_sint32; typedef unsigned short bm_uint16; typedef signed short bm_sint16; typedef unsigned char bm_byte; --- lilo-22.4.1.orig/boot.c 2002-04-08 07:45:34 +0400 +++ lilo-22.4.1.orig/boot.c 2004-12-29 00:47:08 +0300 @@ -10,6 +10,7 @@ */ +#define _GNU_SOURCE #include #include #include @@ -77,7 +78,7 @@ check_size(spec,setup,sectors); else { if (hdr.start % PAGE_SIZE) - die("Can't load kernel at mis-aligned address 0x%08lx\n",hdr.start); + die("Can't load kernel at mis-aligned address 0x%08x\n",hdr.start); #if 0 descr->start_page = hdr.start/PAGE_SIZE; /* load kernel high */ #endif @@ -97,7 +98,7 @@ fd = geo_open(&geo,initrd,O_RDONLY); if (fstat(fd,&st) < 0) die("fstat %s: %s",initrd,strerror(errno)); #if 1 - *(unsigned long *) descr->rd_size = st.st_size; + *(unsigned int *) descr->rd_size = st.st_size; #else descr->rd_size = (st.st_size + SECTOR_SIZE - 1)/SECTOR_SIZE; #endif @@ -325,7 +326,7 @@ if (fstat(b_fd,&st) < 0) die("fstat %s: %s",boot,strerror(errno)); if (!geo.file) part_verify(st.st_rdev,0); - if (lseek(b_fd,(long) BOOT_SIG_OFFSET,SEEK_SET) < 0) + if (lseek(b_fd,(int) BOOT_SIG_OFFSET,SEEK_SET) < 0) die("lseek %s: %s",boot,strerror(errno)); if ((size = read(b_fd, (char *)&magic, 2)) != 2) { if (size < 0) die("read %s: %s",boot,strerror(errno)); @@ -357,7 +358,7 @@ else { if ((p_fd = open(part,O_RDONLY)) < 0) die("open %s: %s",part,strerror(errno)); - if (lseek(p_fd,(long) PART_TABLE_OFFSET,0) < 0) + if (lseek(p_fd,(int) PART_TABLE_OFFSET,0) < 0) die("lseek %s: %s",part,strerror(errno)); if (read(p_fd,(char *) buff[0].par_c.ptable,PART_TABLE_SIZE) != PART_TABLE_SIZE) --- lilo-22.4.1.orig/bsect.c 2002-11-05 08:27:27 +0300 +++ lilo-22.4.1.orig/bsect.c 2004-12-29 01:21:57 +0300 @@ -10,13 +10,14 @@ */ +#define _GNU_SOURCE #include #include -#include #include #include #include #include +#include #ifdef _SYS_STATFS_H #define _I386_STATFS_H /* two versions of statfs is not good ... */ @@ -73,7 +74,7 @@ static char *getval_user; typedef struct Pass { - long crc[MAX_PW_CRC]; + int crc[MAX_PW_CRC]; char *unique; char *label; struct Pass *next; @@ -254,7 +256,7 @@ for (walk=pwsave; walk; walk=walk->next) { fprintf(pw_file, "label=<\"%s\">", walk->label); - for (i=0; icrc[i]); + for (i=0; icrc[i]); fprintf(pw_file, "\n"); } } @@ -295,12 +297,12 @@ if (verbose >=5) printf("end pw_fill_cache\n"); } -static void hash_password(char *password, long crcval[]) +static void hash_password(char *password, int crcval[]) { #ifdef CRC_PASSWORDS - static long poly[] = {CRC_POLY1, CRC_POLY2, CRC_POLY3, CRC_POLY4, CRC_POLY5}; + static int poly[] = {CRC_POLY1, CRC_POLY2, CRC_POLY3, CRC_POLY4, CRC_POLY5}; #endif - long crc; + int crc; int j; int i = strlen(password); @@ -320,7 +322,7 @@ #endif if(verbose >= 2) { if (j==0) printf("Password " PWTYPE " ="); - printf(" %08lX", crc); + printf(" %08X", crc); } } if (verbose >= 2) printf("\n"); @@ -364,7 +366,7 @@ } #endif -static void pw_get(char *pass, long crcval[], int option) +static void pw_get(char *pass, int crcval[], int option) { PASSWORD *walk; char *pass2; @@ -379,7 +381,7 @@ for (walk=pwsave; walk; walk=walk->next) { if (pass == walk->unique || (!walk->unique && !strcmp(walk->label,label) && (walk->unique=pass)) ) { - memcpy(crcval, walk->crc, MAX_PW_CRC*sizeof(long)); + memcpy(crcval, walk->crc, MAX_PW_CRC*sizeof(int)); return; } } @@ -407,11 +409,11 @@ pw_wipe(pass2); hash_password(pass, walk->crc); pw_wipe(pass); - memcpy(crcval, walk->crc, MAX_PW_CRC*sizeof(long)); + memcpy(crcval, walk->crc, MAX_PW_CRC*sizeof(int)); } -static void retrieve_crc(long crcval[]) +static void retrieve_crc(int crcval[]) { int i; char *pass; @@ -425,7 +427,7 @@ if (verbose >= 1) { printf("Password found is"); - for (i=0; iat_text); for (i=0; i<4 && *scheme; i++) { @@ -529,7 +531,7 @@ void bsect_open(char *boot_dev,char *map_file,char *install,int delay, - int timeout, long raid_offset) + int timeout, int raid_offset) { static char coms[] = "0123"; static char parity[] = "NnOoEe"; @@ -546,7 +548,7 @@ BITMAPFILEHEADER fhv; BITMAPHEADER bmhv; BITMAPLILOHEADER lhv; - unsigned long timestamp; + unsigned int timestamp; #ifdef LCF_BUILTIN BUILTIN_FILE *loader; #else @@ -1054,9 +1056,9 @@ ( (password = cfg_get_strg(cf_options,"password")) && !cfg_get_flag(cf_all,"bypass") ) ) { if (!*password) { /* null password triggers interaction */ - retrieve_crc((long*)descr->password_crc); + retrieve_crc((int*)descr->password_crc); } else { - hash_password(password, (long*)descr->password_crc ); + hash_password(password, (int*)descr->password_crc ); } descr->flags |= FLAG_PASSWORD; } @@ -1110,7 +1112,7 @@ } #if 0 #if 1 - *(unsigned long *) descr->rd_size = 0; /* no RAM disk */ + *(unsigned int *) descr->rd_size = 0; /* no RAM disk */ #else descr->rd_size = 0; /* no RAM disk */ #endif @@ -1235,7 +1237,7 @@ /* map_descrs(&descrs, bsect.par_1.descr, &bsect.par_1.dflcmd); */ map_descrs(&descrs, menu->mt_descr, &bsect.par_1.dflcmd); - ((long*)table)[SECTOR_SIZE/sizeof(long)-2] = crc32(table, SECTOR_SIZE-2*sizeof(long), CRC_POLY1); + ((int*)table)[SECTOR_SIZE/sizeof(int)-2] = crc32(table, SECTOR_SIZE-2*sizeof(int), CRC_POLY1); map_begin_section(); map_add_sector(table); (void) map_write(&bsect.par_1.keytab,1,0); @@ -1435,7 +1437,7 @@ } -void bsect_raid_update(char *boot_dev, unsigned long raid_offset, +void bsect_raid_update(char *boot_dev, unsigned int raid_offset, char *backup_file, int force_backup, int pass) { BOOT_SECTOR bsect_save; --- lilo-22.4.1.orig/bsect.h 2002-03-03 08:09:56 +0300 +++ lilo-22.4.1.orig/bsect.h 2004-12-29 00:58:44 +0300 @@ -29,7 +29,7 @@ /* Read the boot sector stored on BOOT_DEV into BUFFER. */ void bsect_open(char *boot_dev,char *map_file,char *install,int delay, - int timeout, long raid_offset); + int timeout, int raid_offset); /* Loads the boot sector of the specified device and merges it with a new boot sector (if install != NULL). Sets the boot delay to 'delay' 1/10 sec. @@ -48,7 +48,7 @@ /* Updates the boot sector and the map file. */ -void bsect_raid_update(char *boot_dev, unsigned long raid_offset, +void bsect_raid_update(char *boot_dev, unsigned int raid_offset, char *backup_file, int force_backup, int pass); /* Update the boot sector and the map file, with RAID considerations */ --- lilo-22.4.1.orig/cfg.c 2002-11-12 22:56:00 +0300 +++ lilo-22.4.1.orig/cfg.c 2004-12-29 00:59:03 +0300 @@ -10,6 +10,7 @@ */ +#define _GNU_SOURCE #include #include #include --- lilo-22.4.1.orig/common.c 2002-04-19 02:17:27 +0400 +++ lilo-22.4.1.orig/common.c 2004-12-29 01:00:37 +0300 @@ -10,6 +10,7 @@ */ +#define _GNU_SOURCE #include #include #include @@ -27,7 +28,7 @@ unsigned short drv_map[DRVMAP_SIZE+1]; /* fixup maps ... */ int curr_drv_map; -unsigned long prt_map[PRTMAP_SIZE+1]; +unsigned int prt_map[PRTMAP_SIZE+1]; int curr_prt_map; #if 0 unsigned long crc_polynomial[MAX_PW_CRC] = { @@ -138,9 +139,9 @@ /* calculate a CRC-32 polynomial */ -unsigned long crc32 (unsigned char *cp, int nsize, unsigned long polynomial) +unsigned int crc32 (unsigned char *cp, int nsize, unsigned int polynomial) { - unsigned long poly, crc; + unsigned int poly, crc; int i; unsigned char ch; --- lilo-22.4.1.orig/common.h 2002-04-19 02:17:09 +0400 +++ lilo-22.4.1.orig/common.h 2004-12-29 01:05:38 +0300 @@ -48,7 +48,7 @@ block 0 ;*/ char name[MAX_IMAGE_NAME+1]; /* image name, NUL terminated id_name: .blkb MAX_IMAGE_NAME_asm+1 -;*/ unsigned short password_crc[MAX_PW_CRC*(sizeof(long)/sizeof(short))]; /* 4 password CRC-32 values +;*/ unsigned short password_crc[MAX_PW_CRC*(sizeof(int)/sizeof(short))]; /* 4 password CRC-32 values id_password_crc:.blkb MAX_PW_CRC_asm*4 ;*/ unsigned short rd_size[2]; /* RAM disk size in sectors, 0 if none id_rd_size: .blkb 4 ;don't change the order !!! @@ -81,9 +81,9 @@ ;*/ unsigned char ser_param; /* RS-232 parameters, must be 0 if unused par1_port: .blkb 1 ; referenced together par1_ser_param: .blkb 1 ; ** -;*/ unsigned long raid_offset; /* raid partition/partition offset +;*/ unsigned int raid_offset; /* raid partition/partition offset par1_raid_offset: .blkb 4 -;*/ unsigned long timestamp; /* timestamp for restoration +;*/ unsigned int timestamp; /* timestamp for restoration par1_timestamp: .blkb 4 ;*/ unsigned short timeout; /* 54 msec delay until input time-out, 0xffff: never @@ -221,8 +221,8 @@ } d; unsigned char sector[SECTOR_SIZE*MAX_DESCR_SECS]; struct { - unsigned long sector[SECTOR_SIZE/4*MAX_DESCR_SECS - 1]; - unsigned long checksum; + unsigned int sector[SECTOR_SIZE/4*MAX_DESCR_SECS - 1]; + unsigned int checksum; } l; } DESCR_SECTORS; @@ -246,14 +246,14 @@ unsigned char loader; /* 16: loader type */ unsigned char flags; /* 17: loader flags */ unsigned short a; /* 18: more LOADLIN hacks */ - unsigned long start; /* 20: kernel start, filled in by loader */ - unsigned long ramdisk; /* 24: RAM disk start address */ - unsigned long ramdisk_size; /* 28: RAM disk size */ + unsigned int start; /* 20: kernel start, filled in by loader */ + unsigned int ramdisk; /* 24: RAM disk start address */ + unsigned int ramdisk_size; /* 28: RAM disk size */ unsigned short b,c; /* 32: bzImage hacks */ unsigned short heap_end_ptr;/* 36: 2.01 end of free area after setup code */ unsigned char d; /* 38: padding */ - unsigned long cmd_line_ptr; /* 40: 2.02 address32 of command line */ - unsigned long ramdisk_max; /* 44: 2.03 address32 of highest mem. for ramdisk */ + unsigned int cmd_line_ptr; /* 40: 2.02 address32 of command line */ + unsigned int ramdisk_max; /* 44: 2.03 address32 of highest mem. for ramdisk */ } SETUP_HDR; #define alloc_t(t) ((t *) alloc(sizeof(t))) @@ -266,7 +266,7 @@ extern int boot_dev_nr,raid_flags,do_md_install,zflag,eflag; extern unsigned short drv_map[DRVMAP_SIZE+1]; /* needed for fixup maps */ extern int curr_drv_map; -extern unsigned long prt_map[PRTMAP_SIZE+1]; +extern unsigned int prt_map[PRTMAP_SIZE+1]; extern int curr_prt_map, config_read; #if 0 extern unsigned long crc_polynomial[MAX_PW_CRC]; @@ -308,7 +308,7 @@ the same file, zero if they don't. */ -unsigned long crc32 (unsigned char *cp, int nsize, unsigned long polynomial); +unsigned int crc32 (unsigned char *cp, int nsize, unsigned int polynomial); /* calculate a CRC-32 polynomial */ --- lilo-22.4.1.orig/edit.c 2002-11-20 22:19:35 +0300 +++ lilo-22.4.1.orig/edit.c 2004-12-29 01:10:17 +0300 @@ -104,7 +105,7 @@ n = bmh->numBitPlanes = bmh2.numBitPlanes; n *= bmh->numBitsPerPlane = bmh2.numBitsPerPlane; bmh->numColorsUsed = bmh->numImportantColors = 1 << n; - bmh->sizeImageData = *(long*)(fh->size) - *(long*)(fh->offsetToBits); + bmh->sizeImageData = *(int*)(fh->size) - *(int*)(fh->offsetToBits); bmh->size = sizeof(*bmh); /* new size!! */ n = sizeof(RGB2); } @@ -123,7 +124,7 @@ if (read(fd, &palette[i], n) != n) return -1; if (n==sizeof(RGB2)) palette[i].null = 0; } - if (*(long*)(fh->offsetToBits) == sizeof(BITMAPFILEHEADER) + + if (*(int*)(fh->offsetToBits) == sizeof(BITMAPFILEHEADER) + sizeof(BITMAPHEADER) + sizeof(BITMAPLILOHEADER) + npal*sizeof(RGB) ) /* test will fail for OS/2 bitmaps */ { /* get probable BITMAPLILOHEADER */ @@ -131,7 +132,7 @@ if (size != sizeof(BITMAPLILOHEADER)) return 4; if (read(fd, (void*)lh+sizeof(size), sizeof(*lh)-sizeof(size)) != sizeof(*lh)-sizeof(size)) return -1; - *(long*)(lh->size) = size; + *(int*)(lh->size) = size; if (strncmp(lh->magic, "LILO", 4) != 0) return 5; } else { /* there is no BITMAPLILOHEADER present */ #ifdef STANDALONE @@ -169,10 +170,10 @@ else if (n<0) printf("Error reading input\n"); } while (n>0); bmh->sizeImageData = total; - *(long*)(fh->offsetToBits) = n = sizeof(BITMAPFILEHEADER) + + *(int*)(fh->offsetToBits) = n = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPHEADER) + sizeof(BITMAPLILOHEADER) + npalette*sizeof(RGB); - *(long*)(fh->size) = total + n; + *(int*)(fh->size) = total + n; lseek(fd, 0, SEEK_SET); write(fd, fh, sizeof(*fh)); write(fd, bmh, sizeof(*bmh)); @@ -191,7 +192,7 @@ } tm; static MENUTABLE *menu = &tm.mt; static BITMAPLILOHEADER *lh = (void*)tm.buffer + - ((int)&tm.mt.row - (int)&tm.bmlh.row); + ((long)&tm.mt.row - (long)&tm.bmlh.row); /* a convenience definition */ #define mn tm.mt --- lilo-22.4.1.orig/geometry.c 2004-12-29 01:54:26 +0300 +++ lilo-22.4.1.orig/geometry.c 2004-12-29 01:54:34 +0300 @@ -17,7 +17,6 @@ #include #ifdef LCF_REISERFS -#include #ifdef _SYS_STATFS_H #define _I386_STATFS_H /* two versions of statfs is not good ... */ --- lilo-22.4.1.orig/identify.c 2002-06-10 06:18:52 +0400 +++ lilo-22.4.1.orig/identify.c 2004-12-29 01:12:29 +0300 @@ -11,6 +11,7 @@ */ +#define _GNU_SOURCE #include #include #include --- lilo-22.4.1.orig/lilo.c 2002-11-12 23:34:58 +0300 +++ lilo-22.4.1.orig/lilo.c 2004-12-29 01:20:14 +0300 @@ -10,6 +10,7 @@ */ +#define _GNU_SOURCE #include #include #include @@ -18,6 +19,7 @@ #include #include #include +#include #include @@ -42,7 +44,7 @@ static md_array_info_t md_array_info; static DT_ENTRY *md_disk; static DT_ENTRY *disk; -static unsigned long raid_base, raid_offset[MAX_RAID]; +static unsigned int raid_base, raid_offset[MAX_RAID]; static char *raid_mbr[MAX_RAID]; static int raid_device[MAX_RAID+1]; static int raid_bios[MAX_RAID+1]; @@ -179,7 +181,7 @@ index = lowest; } - if (verbose>=2) printf("Specifed partition: %s raid offset = %08lX\n", + if (verbose>=2) printf("Specifed partition: %s raid offset = %08X\n", raid_list[pass], raid_offset[index]); if (!test) { @@ -219,7 +221,7 @@ } -static long raid_setup(void) +static int raid_setup(void) { int pass, mask; struct stat st; @@ -228,7 +230,7 @@ GEOMETRY geo; char *boot, *extrap; int ro_set, all_pri_eq, pri_index; - long pri_offset; + int pri_offset; int raid_limit; if ((boot=cfg_get_strg(cf_options,"boot")) != NULL && @@ -360,8 +362,8 @@ disktab = disk; if (verbose >= 2 && do_md_install) { - printf("disk->start = %d\t\traid_offset = %ld (%08lX)\n", - disk->start, (long)raid_offset[ndisk], (long)raid_offset[ndisk]); + printf("disk->start = %d\t\traid_offset = %d (%08X)\n", + disk->start, (int)raid_offset[ndisk], (int)raid_offset[ndisk]); } /* derive the MBR name, which may be needed later */ @@ -709,10 +711,10 @@ else printf(" Kernel is loaded \"high\"\n"); #endif #if 1 - if (!*(unsigned long *) descrs.d.descr[image].rd_size) + if (!*(unsigned int *) descrs.d.descr[image].rd_size) printf(" No initial RAM disk\n"); - else printf(" Initial RAM disk is %ld bytes\n", - *(unsigned long *) descrs.d.descr[image].rd_size); + else printf(" Initial RAM disk is %d bytes\n", + *(unsigned int *) descrs.d.descr[image].rd_size); #else if (!descrs.d.descr[image].rd_size) printf(" No initial RAM disk\n"); @@ -808,7 +810,7 @@ int query,more,version,uninstall,validate,activate,instmbr,geom; struct stat st; int fd; - long raid_offset; + int raid_offset; errstd = stderr; config_file = DFL_CONFIG; @@ -1004,8 +1006,8 @@ "-DCODE_START_1=%d -DCODE_START_2=%d " "\n" , - sizeof(BOOT_PARAMS_1), - sizeof(BOOT_PARAMS_2) + (int)sizeof(BOOT_PARAMS_1), + (int)sizeof(BOOT_PARAMS_2) ); #if 1 { @@ -1014,17 +1016,17 @@ RGB2 pal2[16]; printf("\nBMFH=%d BMH=%d BMH2=%d RGB=%d(%d) RGB2=%d(%d) LH=%d\n", - sizeof(BITMAPFILEHEADER), - sizeof(BITMAPHEADER), - sizeof(BITMAPHEADER2), - sizeof(RGB), - sizeof(pal), - sizeof(RGB2), - sizeof(pal2), - sizeof(BITMAPLILOHEADER) ); + (int)sizeof(BITMAPFILEHEADER), + (int)sizeof(BITMAPHEADER), + (int)sizeof(BITMAPHEADER2), + (int)sizeof(RGB), + (int)sizeof(pal), + (int)sizeof(RGB2), + (int)sizeof(pal2), + (int)sizeof(BITMAPLILOHEADER) ); printf("\nBPB=%d BP_DOS=%d\n", - sizeof(BIOS_PARAMETER_BLOCK), - sizeof(BOOT_PARAMS_DOS) + (int)sizeof(BIOS_PARAMETER_BLOCK), + (int)sizeof(BOOT_PARAMS_DOS) ); } #endif @@ -1113,7 +1115,7 @@ /* test for a RAID installation */ raid_offset = raid_setup(); if (verbose >= 2) - printf("raid_setup returns offset = %08lX ndisk = %d\n", raid_offset, ndisk); + printf("raid_setup returns offset = %08X ndisk = %d\n", raid_offset, ndisk); if (uninstall) bsect_uninstall(uninst_dev ? uninst_dev : cfg_get_strg(cf_options, --- lilo-22.4.1.orig/lilo.h 2002-11-02 01:59:52 +0300 +++ lilo-22.4.1.orig/lilo.h 2004-12-29 01:20:57 +0300 @@ -105,7 +105,7 @@ #if MAX_DESCR_SECS > MAX_DESCR_SECTORS # error "Maximum DSECS=x exceeded." #endif -#define MAX_IMAGES ((SECTOR_SIZE*MAX_DESCR_SECS-sizeof(long)-1)/sizeof(IMAGE_DESCR)) +#define MAX_IMAGES ((int)(SECTOR_SIZE*MAX_DESCR_SECS-sizeof(int)-1)/sizeof(IMAGE_DESCR)) /* maximum number of images */ #define SECTOR_SIZE 512 /* disk sector size */ --- lilo-22.4.1.orig/map.c 2002-04-08 05:30:34 +0400 +++ lilo-22.4.1.orig/map.c 2004-12-29 01:23:29 +0300 @@ -10,6 +10,7 @@ */ +#define _GNU_SOURCE #include #include #include @@ -142,7 +143,7 @@ if (verbose >= 2) { if (fstat(map_file,&st) < 0) pdie("fstat map file"); - printf("Map file size: %ld bytes.\n",(long) st.st_size); + printf("Map file size: %ld bytes.\n",(int) st.st_size); } if (last!=lseek(map_file, last, SEEK_SET)) pdie("lseek map file to end"); } --- lilo-22.4.1.orig/partition.c 2002-04-19 08:45:30 +0400 +++ lilo-22.4.1.orig/partition.c 2004-12-29 01:29:06 +0300 @@ -10,8 +10,8 @@ */ +#define _GNU_SOURCE #include -#include #include #include #include @@ -22,8 +22,8 @@ #include #include #define _LINUX_STRING_H_ -#include #include +#include #include "config.h" #include "lilo.h" #include "common.h" @@ -34,24 +34,31 @@ #include "boot.h" #include "loader.h" - +#if __GLIBC__ < 2 || __GLIBC_MINOR__ < 1 +#if defined(_syscall5) && defined(__NR__llseek) - _syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, - loff_t *, res, uint, wh); + _syscall5(int, _llseek, uint, fd, uint, hi, uint, lo, + lloff_t *, res, uint, wh); - int _llseek(unsigned int fd, unsigned long offset_high, - unsigned long offset_low, loff_t * result, unsigned int + int _llseek(unsigned int fd, unsigned int offset_high, + unsigned int offset_low, lloff_t * result, unsigned int whence); - loff_t llseek(unsigned int fd, loff_t offs, unsigned int whence) - { loff_t res; + loff_t lseek64(unsigned int fd, lloff_t offs, unsigned int whence) + { lloff_t res; return _llseek(fd, offs>>32, offs, &res, whence) < 0 ? - (loff_t)(-1) : res; + (lloff_t)(-1) : res; } - - - +#else +/* last ditch attempt on small disks, and very old systems */ +# warning "*****************************************" +# warning "***** no 64 bit lseek is available ******" +# warning "***** using 23 bit sector addresses *****" +# warning "*****************************************" +# define lseek64 lseek +#endif +#endif /* identify partitions which would be destroyed if the boot block is overwritten: @@ -90,7 +97,7 @@ ) ret=1; /* check for SWAP -- last check, as 'bs' is overwritten */ - else if (*(long*)bs.sector == 0xFFFFFFFEUL) { + else if (*(int*)bs.sector == 0xFFFFFFFEU) { if (lseek(fd, (PAGE_SIZE)-SECTOR_SIZE, SEEK_SET) != (PAGE_SIZE)-SECTOR_SIZE) pdie("part_nowrite lseek:"); if (SECTOR_SIZE != read(fd, bs.sector, sizeof(bs)) ) pdie("part_nowrite swap check:"); @@ -119,7 +126,7 @@ DEVICE dev; char backup_file[PATH_MAX+1]; int fd, bck_file, part, size, lin_3d, cyl; - unsigned long second, base; + unsigned int second, base; struct partition part_table[PART_MAX]; int mask, i, pe, Linux, dos; unsigned short boot_sig; @@ -153,8 +160,8 @@ } i=5; while (i<=pe && base) { - if (llseek(fd, LLSECTORSIZE*(base+second) + PART_TABLE_OFFSET, SEEK_SET) < 0) - die("secondary llseek failed"); + if (lseek64(fd, LLSECTORSIZE*(base+second) + PART_TABLE_OFFSET, SEEK_SET) < 0) + die("secondary lseek64 failed"); if (read(fd, part_table, sizeof(part_table)) != sizeof(part_table)) die("secondary read pt failed"); if ( read(fd, &boot_sig, sizeof(boot_sig)) != sizeof(boot_sig) || boot_sig != BOOT_SIGNATURE ) die("read second boot signature failed"); @@ -262,7 +269,7 @@ static unsigned char cvt_byte(const char *s) { char *end; - unsigned long value; + unsigned int value; value = strtoul(s,&end,0); if (value > 255 || *end) cfg_error("\"%s\" is not a byte value",s); --- lilo-22.4.1.orig/partition.h 2002-04-18 23:38:08 +0400 +++ lilo-22.4.1.orig/partition.h 2004-12-29 01:31:17 +0300 @@ -16,11 +16,15 @@ enum {PTW_OKAY=0, PTW_DOS=1, PTW_OS2=2, PTW_SWAP, PTW_XFS, PTW_mask=7, PTW_NTFS=8}; -#if 1 #define LLSECTORSIZE ((long long)SECTOR_SIZE) - loff_t llseek(unsigned int fd, loff_t offs, unsigned int whence); +#if __GLIBC__ < 2 || __GLIBC_MINOR__ < 1 +typedef long long lloff_t; + +#ifdef _syscall5 + lloff_t lseek64(unsigned int fd, lloff_t offs, unsigned int whence); +#endif #endif --- lilo-22.4.1.orig/probe.c 2002-12-07 00:45:04 +0300 +++ lilo-22.4.1.orig/probe.c 2004-12-29 01:33:00 +0300 @@ -11,6 +11,7 @@ /*#define DEBUG*/ #define VIDEO 1 +#define _GNU_SOURCE #include #include #include @@ -185,7 +186,7 @@ buf.s.version > (short)(PROBE_VERSION)) return 3; got = buf.s.length; if (got > sizeof(buf.b) || got < sizeof(buf.s)) return 4; - if (*(long*)buf.s.checksum != crc32((char*)&buf.s + 4, got-4, CRC_POLY1)) + if (*(int*)buf.s.checksum != crc32((char*)&buf.s + 4, got-4, CRC_POLY1)) return 5; buf_valid = 1; @@ -555,8 +555,8 @@ } i=5; while (verbose>0 && base) { - if (llseek(fd, LLSECTORSIZE*(base+second) + PART_TABLE_OFFSET, SEEK_SET) < 0) - die("secondary llseek failed"); + if (lseek64(fd, LLSECTORSIZE*(base+second) + PART_TABLE_OFFSET, SEEK_SET) < 0) + die("secondary lseek64 failed"); if (read(fd, pt, sizeof(pt)) != sizeof(pt)) die("secondary read pt failed"); if ( read(fd, &boot_sig, sizeof(boot_sig)) != sizeof(boot_sig) || boot_sig != BOOT_SIGNATURE ) die("read second boot signature failed"); @@ -844,8 +844,8 @@ while (--bios >= 0x80) { get_geom(bios, &bdata); if (verbose>=4) { - printf("bios_dev: (0x%02X) S/N=%08X *PT=%08X\n", - bios, bdata.serial_no, (int)bdata.pt); + printf("bios_dev: (0x%02X) S/N=%08X *PT=%08lX\n", + bios, bdata.serial_no, (long)bdata.pt); #ifdef DEBUG dump_pt((void*)bdata.pt); #endif @@ -864,7 +865,7 @@ get_geom(bios1, &bdata); if ( (geo->sectors && geo->sectors!=bdata.n_sect) || (geo->heads && geo->heads!=bdata.n_head) ) { - unsigned long nblocks = geo->cylinders * geo->heads * geo->sectors; + unsigned int nblocks = geo->cylinders * geo->heads * geo->sectors; if (!nowarn && !(warned[bios1-0x80]&2) ) { fprintf(errstd,"Warning: Kernel & BIOS return differing head/sector geometries for device 0x%02X\n", bios1); --- lilo-22.4.1.orig/probe.h 2001-08-12 01:23:18 +0400 +++ lilo-22.4.1.orig/probe.h 2004-12-29 01:33:54 +0300 @@ -7,7 +7,7 @@ struct disk_geom { - unsigned long n_total_blocks; + unsigned int n_total_blocks; int n_sect; int n_head; int n_cyl; @@ -25,12 +25,12 @@ struct disk_param { short size; short flags; - unsigned long n_cyl; - unsigned long n_head; - unsigned long n_sect; + unsigned int n_cyl; + unsigned int n_head; + unsigned int n_sect; long long n_sectors; short n_byte; - unsigned long edd_config_ptr; + unsigned int edd_config_ptr; }; #endif @@ -134,9 +134,9 @@ struct Edd { unsigned short size; /* 26 or 30 */ unsigned short info; - unsigned long cylinders; - unsigned long heads; - unsigned long sectors; + unsigned int cylinders; + unsigned int heads; + unsigned int sectors; long long total_sectors; unsigned short sector_size; --- lilo-22.4.1.orig/shs2.c 2001-10-19 03:48:57 +0400 +++ lilo-22.4.1.orig/shs2.c 2004-12-29 01:35:19 +0300 @@ -9,6 +9,7 @@ */ +#define _GNU_SOURCE #include #include --- lilo-22.4.1.orig/shs2.h 2001-10-18 23:39:27 +0400 +++ lilo-22.4.1.orig/shs2.h 2004-12-29 01:35:32 +0300 @@ -13,7 +13,7 @@ /* Useful typedef's & defines */ typedef unsigned char BYTE; -typedef unsigned long LONG; +typedef unsigned int LONG; /* The SHS block size and message digest sizes, in bytes */