On Fri, 2010-10-08 at 11:59 +0200, Karel Zak wrote: > On Thu, Oct 07, 2010 at 02:53:58PM -0400, Davidlohr Bueso wrote: > > > I have no time to rewrite partx right now (I'm working on libmount). > > > So I can apply your patches with mac and sun support for the next > > > release, but it's temporary solution. The final solution is to use > > > only one partitions parser in util-linux-ng -- libblkid. > > > > Ok, go ahead and apply it > > Applied. > > > and I will take a look at rewriting partx with libblkid. > > It'd be nice to have regression tests before we start to rewrite the > code (see tests/ts/blkid/lowprobe-pt for inspiration). Note that > write tests for the current partx version is tricky, because it > strictly requires block devices (so you cannot use disk images or > so). Maybe you can try to use scsi_debug kernel module (see > tests/ts/fdisk/align-* tests) or you can disable the code around > HDIO_GETGEO by "#ifdef TEST_PROGRAM" in partx.c. > > My partx wish list: > - has to be usable for regular files, e.g "partx -l file.img" > (the HDIO_GETGEO is usually unnecessary). > > - for "partx /dev/sda1 /dev/sda" the whole disk argument (the last > argument on the command line) has to be optional. It means that > commands: > > partx /dev/sda1 /dev/sda > partx /dev/sda1 > > will be identical. We are able to translate partition name to whole > disk, all necessary functions are in libblkid (blkid_probe_get_wholedisk_devno() > and blkid_devno_to_devname()). Nice feature. > > - there has to be a way how control "partx -l" output, something like > "partx -l -o SIZE,SECTORS,START,UUID,NAME" -- let use lib/tt.c :-) > > - note that libblkid is interpreting partitions tables in the same > way how Linux kernel (for example empty are ignored). I expect the > same behaviour from partx. You mean this: When using blkid we don't have to show inexistent partitions, has opposed to the original partx: original: # partx /dev/sda # 1: 2048-468520959 (468518912 sectors, 239881 MB) # 2: 468523006-488396799 ( 19873794 sectors, 10175 MB) # 3: 0- -1 ( 0 sectors, 0 MB) # 4: 0- -1 ( 0 sectors, 0 MB) # 5: 468523008-488396799 ( 19873792 sectors, 10175 MB) with libblkid: # ./partx /dev/sda # 1: 2048-468520959 (468518912 sectors, 239881 MB) # 2: 468523006-488396799 ( 19873794 sectors, 10175 MB) # 5: 468523008-488396799 ( 19873792 sectors, 10175 MB) - Davidlohr -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html