X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=src%2Fpartition.c;h=dcd6dedd49bc78776f8da4336de0830f68ec6aad;hb=HEAD;hp=7dbbc5d99261a2772aa630fedcfa278cfa6c1181;hpb=0a7ead9db7967764f0d93d30f9a83c94cb6fc358;p=rrq%2Fmaintain_lilo.git diff --git a/src/partition.c b/src/partition.c index 7dbbc5d..dcd6ded 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-2015 Joachim Wiedorn + * All rights reserved. + * + * Licensed under the terms contained in the file 'COPYING' + * in the source directory. + */ #define _GNU_SOURCE #include @@ -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); @@ -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); @@ -586,7 +575,7 @@ void do_activate(char *part, char *which) #if 1 int part_max, count, number, fd; struct partition pt [PART_MAX_MAX+1]; - long long daddr [PART_MAX_MAX+1]; + int64_t daddr [PART_MAX_MAX+1]; int modify=0; part_max = read_partitions(part, extended_pt ? PART_MAX_MAX : 0, @@ -694,7 +683,7 @@ void do_install_mbr(char *part, char *what) if (fstat(fd,&st) < 0) die("stat: %s : %s", part,strerror(errno)); if (!S_ISBLK(st.st_mode) && !force_fs) die("%s not a block device",part); if (st.st_rdev != (st.st_rdev & has_partitions(st.st_rdev))) - die("%s is not a master device with a primary parition table",part); + die("%s is not a master device with a primary partition table",part); if (read(fd,&buf,SECTOR_SIZE) != SECTOR_SIZE) die("read %s: %s",part, strerror(errno)); cp = cfg_get_strg(cf_options,"force-backup"); @@ -751,7 +740,7 @@ void do_install_mbr(char *part, char *what) /* partition table read */ int read_partitions(char *part, int max, int *volid, - struct partition *p, long long *where) + struct partition *p, int64_t *where) { int fd, i; unsigned int second, base; @@ -759,7 +748,7 @@ int read_partitions(char *part, int max, int *volid, struct partition pt[PART_MAX]; BOOT_PARAMS_1 hdr; struct stat st; - long long daddr; + int64_t daddr; if ((fd=open(part,O_RDONLY))<0) die("Cannot open '%s'", part); if (fstat(fd,&st)<0) die("Cannot fstat '%s'", part);