On Wed, Oct 24, 2007 at 07:33:53PM +0200, Stefan Krah wrote: > Karel Zak <kzak@xxxxxxxxxx> wrote: > > What about a new file lib/linux_version.c ? > > > > See linux_version_code() in mkswap. I think it's more generic > > implementation. > > > yes, that's nicer. Somehow I prefer get_linux_version() and kernel_version() > from gpt.c, so I used that. > > > Stefan Krah > > > remarks: > > - changed (%u -> %d) in sscanf() of get_linux_version() > > - added blkdev_get_sector_size() > > - took over the kernel < 2.3.3 workaround from fdisk.c, but > could not find the reason for the workaround. Thanks, applied with few changes. It seems that this code consolidation is a good step. We had duplicate code on many places. See diffstat after cleanup: configure.ac | 3 +- disk-utils/Makefile.am | 4 +- disk-utils/blockdev.c | 92 ++++---------------------------------------- disk-utils/elvtune.c | 27 ++----------- disk-utils/mkswap.c | 57 ++++++++------------------- fdisk/Makefile.am | 3 +- fdisk/cfdisk.c | 3 +- fdisk/common.h | 21 ---------- fdisk/disksize.c | 54 -------------------------- fdisk/fdisk.c | 47 ++++++---------------- fdisk/fdisksgilabel.c | 4 +- fdisk/fdisksunlabel.c | 3 +- fdisk/gpt.c | 50 +++--------------------- fdisk/partname.c | 25 ++++++++++++ fdisk/sfdisk.c | 24 ++--------- include/Makefile.am | 3 +- include/blkdev.h | 56 +++++++++++++++++++++++++++ include/linux_version.h | 14 +++++++ lib/blkdev.c | 93 +++++++++++++++++++++++++++++++++++++++++++++ lib/linux_version.c | 25 ++++++++++++ mount/Makefile.am | 5 +- mount/fsprobe.c | 1 - mount/fsprobe_volumeid.c | 5 +- mount/linux_fs.h | 15 ------- mount/loop.h | 16 +++++++- mount/mount.c | 32 +++++----------- mount/my_dev_t.h | 20 ---------- tests/helpers/Makefile.am | 6 ++- 28 files changed, 319 insertions(+), 389 deletions(-) It's still not complete. We need to clean up partx/ where is almost same GPT code like in fdisk/. Karel -- Karel Zak <kzak@xxxxxxxxxx> - 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