X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=src%2Fpartition.c;h=329a90f8bb31ea7ecb11804fac1ac32c0cc818f3;hb=6b7c9204067e37f8f2b40c35f71da53b17ac57ce;hp=da26fc27ed500ac16fef952818f293cf0f8238c1;hpb=23c77cc092dbbb1e12c47c2b0021d4476b543702;p=rrq%2Fmaintain_lilo.git diff --git a/src/partition.c b/src/partition.c index da26fc2..329a90f 100644 --- a/src/partition.c +++ b/src/partition.c @@ -1,13 +1,13 @@ -/* partition.c - Partition table handling */ -/* -Copyright 1992-1998 Werner Almesberger. -Copyright 1999-2005 John Coffman. -All rights reserved. - -Licensed under the terms contained in the file 'COPYING' in the -source directory. - -*/ +/* partition.c - Partition table handling + * + * Copyright 1992-1998 Werner Almesberger + * Copyright 1999-2005 John Coffman + * Copyright 2009-2014 Joachim Wiedorn + * All rights reserved. + * + * Licensed under the terms contained in the file 'COPYING' + * in the source directory. + */ #define _GNU_SOURCE #include @@ -56,10 +56,10 @@ source directory. #endif static -int anywhere(void *buf, char *str) +int anywhere(unsigned char *buf, char *str) { int k, n; - void *s; + char *s; k = strlen(str); n = SECTOR_SIZE-k; @@ -67,7 +67,7 @@ int anywhere(void *buf, char *str) while(s) { if (!strncmp(s, str, k)) return 1; s++; - n = SECTOR_SIZE - k - (int)(s-buf); + n = SECTOR_SIZE - k - (int)(s-(char*)buf); s = memchr(s, *str, n); } return 0; @@ -101,9 +101,9 @@ if ( !(do_md_install && extra==X_MBR_ONLY) ) { else if ( !strncmp("NTFS", bs.par_d.system, 4) || anywhere(bs.sector,"NTLDR") ) ret=PTW_NTFS; -/* check for HPFS */ - else if ( !strncmp("OS2", bs.par_d.system, 3) - || anywhere(bs.sector,"OS2LDR") ) ret=PTW_OS2; +/* do not check for obsolete OS2_HPFS */ +/* else if ( !strncmp("OS2", bs.par_d.system, 3) + || anywhere(bs.sector,"OS2LDR") ) ret=PTW_OS2; */ /* check for DOS FAT */ else if ( @@ -115,10 +115,6 @@ if ( !(do_md_install && extra==X_MBR_ONLY) ) { && (bs.par_d.bpb.sectors_per_cluster & (bs.par_d.bpb.sectors_per_cluster-1))==0 ) { ret=PTW_DOS; -#if 0 -/* this, it turns out is from Windows 98, so no caution here on NT */ - if (anywhere(bs.sector,"WINBOOT SYS")) ret+=PTW_NTFS; -#endif } /* check for SWAP -- last check, as 'bs' is overwritten */ @@ -221,21 +217,19 @@ void part_verify(int dev_nr,int type) i == PART_FAT32 || i == PART_FAT32_LBA || i == PART_FAT16_LBA || - i == PART_NTFS || - i == PART_OS2_BOOTMGR ; + i == PART_NTFS ; if (type && !Linux) { warn("partition type 0x%02X"" on device 0x%04X is a dangerous place for\n" " a boot sector.%s", part_table[part].sys_ind, dev_nr, - dos ? " A DOS/Windows/OS2 system may be rendered unbootable." + dos ? " A DOS/Windows system may be rendered unbootable." "\n The backup copy of this boot sector should be retained." : "" ); + fprintf (errstd, "I will assume that you know what you're doing and I will proceed.\n"); #if 0 if (!dos && !cfg_get_flag(cf_options,"ignore-table")) die("You may proceed by using either '-P ignore' or 'ignore-table'"); -#else - if (!yesno("\nProceed? ", 0)) exit(0); #endif } cyl = part_table[part].cyl+((part_table[part].sector >> 6) << 8); @@ -381,7 +375,7 @@ static void add_rule(unsigned char bios,unsigned char offset, int i; if (curr_prt_map == PRTMAP_SIZE) - cfg_error("Too many change rules (more than %s)",PRTMAP_SIZE); + cfg_error("Too many change rules (more than %d)",PRTMAP_SIZE); if (verbose >= 3) printf(" Adding rule: disk 0x%02x, offset 0x%x, 0x%02x -> 0x%02x\n", bios,PART_TABLE_OFFSET+offset,expect,set); @@ -557,12 +551,7 @@ void do_change(void) void preload_types(void) { -#if 0 /* don't know if it makes sense to add these too */ - add_type("Netware", 0x64, 0x74); - add_type("OS2_BM", 0x0a, 0x1a); -#endif - add_type("OS2_HPFS", 0x07, 0x17); - +/* add_type("OS2_HPFS", 0x07, 0x17); */ add_type("FAT16_lba", PART_FAT16_LBA, -1); add_type("FAT32_lba", PART_FAT32_LBA, -1); add_type("FAT32", PART_FAT32, -1);