From: Christophe Varoqui Date: Thu, 1 Dec 2005 20:54:15 +0000 (+0100) Subject: [kpartx] bug fixes for dos extended partition [2/4] X-Git-Tag: 0.4.7~85 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=09e06d94d7796ae05a3978891a8766e02cad96d3;p=platform%2Fupstream%2Fmultipath-tools.git [kpartx] bug fixes for dos extended partition [2/4] kpartx usually doesn't create a mapping for extended partition. However, it does if it's empty. It's harmless but not consistent. Attached patch makes it consistent by not creating a mapping even when the extended partition is empty. Please consider to apply. If you have logical partitions in extended partition: # parted /dev/sdc p Disk geometry for /dev/sdc: 0.000-34686.000 megabytes Disk label type: msdos Minor Start End Type Filesystem Flags 1 7.844 31.376 extended 5 7.875 23.532 logical No mapping is created for extended partition: # dmsetup table|grep sdc|sort sdc5: 0 32067 linear 8:32 16128 However, if the extended partition is empty: # parted /dev/sdc p Disk geometry for /dev/sdc: 0.000-34686.000 megabytes Disk label type: msdos Minor Start End Type Filesystem Flags 1 7.844 31.376 extended The following mapping is created: # dmsetup table|grep sdc|sort sdc1: 0 48195 linear 8:32 16065 Jun'ichi Nomura, NEC --- diff --git a/kpartx/dos.c b/kpartx/dos.c index 445a7d9..ffa0f84 100644 --- a/kpartx/dos.c +++ b/kpartx/dos.c @@ -98,8 +98,11 @@ read_dos_pt(int fd, struct slice all, struct slice *sp, int ns) { "dos_partition: too many slices\n"); break; } - if (is_extended(p.sys_type)) + if (is_extended(p.sys_type)) { n += read_extended_partition(fd, &p, sp+n, ns-n); + /* hide the extended partition itself */ + sp[i].size = 0; + } } return n; }