diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-12-19 03:15:33 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-12-19 03:15:33 +0000 |
commit | 3acc117cc46fe5a4312ac5c951a9059a35744fb5 (patch) | |
tree | aaa9ab80482438ad0997b26de1afdb2e0f3e5620 /sys-fs/e2fsprogs | |
parent | Stable on amd64. See bug #115982. (diff) | |
download | historical-3acc117cc46fe5a4312ac5c951a9059a35744fb5.tar.gz historical-3acc117cc46fe5a4312ac5c951a9059a35744fb5.tar.bz2 historical-3acc117cc46fe5a4312ac5c951a9059a35744fb5.zip |
Add support for parsing of vfat labels #77692 by Evgeniy and some other upstream fixes.
Package-Manager: portage-2.0.53
Diffstat (limited to 'sys-fs/e2fsprogs')
-rw-r--r-- | sys-fs/e2fsprogs/ChangeLog | 11 | ||||
-rw-r--r-- | sys-fs/e2fsprogs/Manifest | 13 | ||||
-rw-r--r-- | sys-fs/e2fsprogs/e2fsprogs-1.38-r1.ebuild | 117 | ||||
-rw-r--r-- | sys-fs/e2fsprogs/files/digest-e2fsprogs-1.38-r1 | 1 | ||||
-rw-r--r-- | sys-fs/e2fsprogs/files/e2fsprogs-1.38-blkid-ext23.patch | 20 | ||||
-rw-r--r-- | sys-fs/e2fsprogs/files/e2fsprogs-1.38-blkid-swsuspend.patch | 33 | ||||
-rw-r--r-- | sys-fs/e2fsprogs/files/e2fsprogs-1.38-vfat-labels.patch | 237 |
7 files changed, 427 insertions, 5 deletions
diff --git a/sys-fs/e2fsprogs/ChangeLog b/sys-fs/e2fsprogs/ChangeLog index ffd0cfb4d371..86c57a36a1be 100644 --- a/sys-fs/e2fsprogs/ChangeLog +++ b/sys-fs/e2fsprogs/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for sys-fs/e2fsprogs # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/e2fsprogs/ChangeLog,v 1.76 2005/09/08 17:09:21 ka0ttic Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/e2fsprogs/ChangeLog,v 1.77 2005/12/19 03:15:33 vapier Exp $ + +*e2fsprogs-1.38-r1 (19 Dec 2005) + + 19 Dec 2005; Mike Frysinger <vapier@gentoo.org> + +files/e2fsprogs-1.38-blkid-ext23.patch, + +files/e2fsprogs-1.38-blkid-swsuspend.patch, + +files/e2fsprogs-1.38-vfat-labels.patch, +e2fsprogs-1.38-r1.ebuild: + Add support for parsing of vfat labels #77692 by Evgeniy and some other + upstream fixes. 08 Sep 2005; Aaron Walker <ka0ttic@gentoo.org> e2fsprogs-1.38.ebuild: Stable on mips. diff --git a/sys-fs/e2fsprogs/Manifest b/sys-fs/e2fsprogs/Manifest index ec3fead68558..a016db05322d 100644 --- a/sys-fs/e2fsprogs/Manifest +++ b/sys-fs/e2fsprogs/Manifest @@ -1,26 +1,31 @@ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 -MD5 84243bd9d25301bcbbb58599a2dd9f5d ChangeLog 13071 +MD5 11dedec635601b2936af6de0badeb3bd ChangeLog 13407 MD5 85f36b5553a8d70e2fea0709edbc74f1 e2fsprogs-1.35-r1.ebuild 3271 MD5 7110400b8107690e0f1ec51538148f9b e2fsprogs-1.36-r2.ebuild 2519 MD5 fa9189b7073d4c93726ab05bfa396db4 e2fsprogs-1.37-r1.ebuild 3297 +MD5 34e3a97192749384522a21dd8e795a7d e2fsprogs-1.38-r1.ebuild 3866 MD5 d73f86d05b5b726d16729639ccaa33b9 e2fsprogs-1.38.ebuild 3688 MD5 3d9735f2397680a4978124f6805219ae files/digest-e2fsprogs-1.35-r1 67 MD5 e86bf4d241506baff5f647cbd30ae7a0 files/digest-e2fsprogs-1.36-r2 67 MD5 65689a8be4c1b58f8e64f22165313292 files/digest-e2fsprogs-1.37-r1 67 MD5 0911aedd4968aa4053139791a961e2a2 files/digest-e2fsprogs-1.38 67 +MD5 0911aedd4968aa4053139791a961e2a2 files/digest-e2fsprogs-1.38-r1 67 MD5 1a896f2697b055d4b8b4139c3482ac9e files/e2fsprogs-1.32-mk_cmds-cosmetic.patch 316 MD5 c5e6ed46f8a6b9f75273863110887b22 files/e2fsprogs-1.36-makefile.patch 3546 MD5 4a7d54ccac4002d10462c40660712a72 files/e2fsprogs-1.36-sed-locale.patch 2142 MD5 e49935e8abf94d6e906bad2d068d43c3 files/e2fsprogs-1.37-e2p-test.patch 380 +MD5 ebeacdb9470e8d7ad33a259a71164672 files/e2fsprogs-1.38-blkid-ext23.patch 714 +MD5 478cd49f138b6b047fb1c465c9d05c80 files/e2fsprogs-1.38-blkid-swsuspend.patch 1772 MD5 e85d057f99af6c980acf9a8697da9dd7 files/e2fsprogs-1.38-disconnected-inodes.patch 2881 +MD5 71ae8634de714335ebbc93dc0bbbd643 files/e2fsprogs-1.38-vfat-labels.patch 6667 MD5 f079047f6885f762f6fa838b55236cb2 files/e2fsprogs-sed-locale.patch 5989 MD5 9a09f8d531c582e78977dbfd96edc1f2 metadata.xml 164 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) -iD8DBQFDcsV1gIKl8Uu19MoRAgfpAJ9EIbR5XFJcMJbeZiPX0k0D1eQNTQCeNg1e -WAZQFDvZl+vE5M5I1GRqrgc= -=OEsD +iD8DBQFDpiX72+ySkm8kpY0RAoEiAKCNHW28hCVm4cp8uQWY8Z+9dUtlkwCfdKdC +Dl6uOQ12h45m4iuZbpNJcZg= +=BNfF -----END PGP SIGNATURE----- diff --git a/sys-fs/e2fsprogs/e2fsprogs-1.38-r1.ebuild b/sys-fs/e2fsprogs/e2fsprogs-1.38-r1.ebuild new file mode 100644 index 000000000000..98ee9424251e --- /dev/null +++ b/sys-fs/e2fsprogs/e2fsprogs-1.38-r1.ebuild @@ -0,0 +1,117 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/e2fsprogs/e2fsprogs-1.38-r1.ebuild,v 1.1 2005/12/19 03:15:33 vapier Exp $ + +inherit eutils flag-o-matic toolchain-funcs + +DESCRIPTION="Standard EXT2 and EXT3 filesystem utilities" +HOMEPAGE="http://e2fsprogs.sourceforge.net/" +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" +IUSE="nls static" + +RDEPEND="~sys-libs/com_err-${PV} + ~sys-libs/ss-${PV}" +DEPEND="${RDEPEND} + nls? ( sys-devel/gettext ) + sys-apps/texinfo" + +src_unpack() { + unpack ${A}; cd "${S}" + # Fix a cosmetic error in mk_cmds's help output. + epatch "${FILESDIR}"/e2fsprogs-1.32-mk_cmds-cosmetic.patch + chmod u+w po/*.po # Userpriv fix #27348 + # Clean up makefile to suck less + epatch "${FILESDIR}"/e2fsprogs-1.36-makefile.patch + # Fix segfault with disconnected inodes #91751 + epatch "${FILESDIR}"/${P}-disconnected-inodes.patch + + # Fixes from upstream + epatch "${FILESDIR}"/${P}-blkid-ext23.patch + epatch "${FILESDIR}"/${P}-blkid-swsuspend.patch + epatch "${FILESDIR}"/${P}-vfat-labels.patch + + # kernel headers use the same defines as e2fsprogs and can cause issues #48829 + sed -i \ + -e 's:CONFIG_JBD_DEBUG:__CONFIG_JBD_DEBUG__E2FS:g' \ + $(grep -rl CONFIG_JBD_DEBUG *) \ + || die "sed jbd debug failed" + + # building e2fsprogs on sparc results in silo breaking + [[ ${ARCH} == "sparc" ]] && filter-flags -fstack-protector + + # fake out files we forked into sep packages + sed -i \ + -e '/^LIB_SUBDIRS/s:lib/et::' \ + -e '/^LIB_SUBDIRS/s:lib/ss::' \ + Makefile.in || die "remove subdirs" + ln -s "${ROOT}"/usr/$(get_libdir)/libcom_err.a lib/libcom_err.a + ln -s "${ROOT}"/$(get_libdir)/libcom_err.so lib/libcom_err.so + ln -s /usr/bin/mk_cmds lib/ss/mk_cmds + ln -s "${ROOT}"/usr/include/ss/ss_err.h lib/ss/ + ln -s "${ROOT}"/$(get_libdir)/libss.so lib/libss.so + + # sanity check for Bug 105304 + if [[ -z ${USERLAND} ]] ; then + eerror "You just hit Bug 105304, please post your 'emerge info' here:" + eerror "http://bugs.gentoo.org/105304" + die "Aborting to prevent screwing your system" + fi +} + +src_compile() { + # Keep the package from doing silly things + export LDCONFIG=/bin/true + export CC=$(tc-getCC) + export STRIP=/bin/true + + econf \ + --bindir=/bin \ + --sbindir=/sbin \ + --enable-elf-shlibs \ + --with-ldopts="${LDFLAGS}" \ + $(use_enable !static dynamic-e2fsck) \ + --without-included-gettext \ + $(use_enable nls) \ + $(use_enable userland_GNU fsck) \ + || die + if [[ ${CTARGET:-${CHOST}} != *-uclibc ]] && grep -qs 'USE_INCLUDED_LIBINTL.*yes' config.{log,status} ; then + eerror "INTL sanity check failed, aborting build." + eerror "Please post your ${S}/config.log file as an" + eerror "attachment to http://bugs.gentoo.org/show_bug.cgi?id=81096" + die "Preventing included intl cruft from building" + fi + mkdir -p lib/{blkid,e2p,et,ext2fs,ss,uuid}/{checker,elfshared,pic,profiled} #102412 + # Parallel make sometimes fails + emake -j1 COMPILE_ET=compile_et || die +} + +src_install() { + make DESTDIR="${D}" install || die + dodoc ChangeLog README RELEASE-NOTES SHLIBS + docinto e2fsck + dodoc e2fsck/ChangeLog e2fsck/CHANGES + + # Move shared libraries to /lib/, install static libraries to /usr/lib/, + # and install linker scripts to /usr/lib/. + dodir /$(get_libdir) + mv "${D}"/usr/$(get_libdir)/*.so* "${D}"/$(get_libdir)/ + dolib.a lib/*.a || die "dolib.a" + local x + cd "${D}"/$(get_libdir) + for x in *.so ; do + gen_usr_ldscript ${x} || die "gen ldscript ${x}" + done + + # move 'useless' stuff to /usr/ + dosbin "${D}"/sbin/mklost+found + rm -f "${D}"/sbin/mklost+found + + # these manpages are already provided by FreeBSD libc + use elibc_FreeBSD && \ + rm -f "${D}"/usr/share/man/man3/{uuid,uuid_compare}.3 \ + "${D}"/usr/share/man/man1/uuidgen.1 +} diff --git a/sys-fs/e2fsprogs/files/digest-e2fsprogs-1.38-r1 b/sys-fs/e2fsprogs/files/digest-e2fsprogs-1.38-r1 new file mode 100644 index 000000000000..c0fafc30b051 --- /dev/null +++ b/sys-fs/e2fsprogs/files/digest-e2fsprogs-1.38-r1 @@ -0,0 +1 @@ +MD5 d774d4412bfb80d12cf3a4fdfd59de5a e2fsprogs-1.38.tar.gz 3621193 diff --git a/sys-fs/e2fsprogs/files/e2fsprogs-1.38-blkid-ext23.patch b/sys-fs/e2fsprogs/files/e2fsprogs-1.38-blkid-ext23.patch new file mode 100644 index 000000000000..5bc2fc816925 --- /dev/null +++ b/sys-fs/e2fsprogs/files/e2fsprogs-1.38-blkid-ext23.patch @@ -0,0 +1,20 @@ +changeset: 1792:6949f7a75122 +user: tytso@mit.edu +date: Tue Sep 6 06:26:45 2005 -0400 +summary: Fix blkid library so that the cache validation notices ext2 to ext3 conversion + +diff -r 85a387fcad67 -r 6949f7a75122 lib/blkid/probe.c +--- a/lib/blkid/probe.c Tue Sep 6 09:59:52 2005 ++++ b/lib/blkid/probe.c Tue Sep 6 10:26:45 2005 +@@ -135,6 +135,11 @@ + /* Distinguish between jbd and ext2/3 fs */ + if (blkid_le32(es->s_feature_incompat) & + EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) ++ return -BLKID_ERR_PARAM; ++ ++ /* Distinguish between ext3 and ext2 */ ++ if ((blkid_le32(es->s_feature_compat) & ++ EXT3_FEATURE_COMPAT_HAS_JOURNAL)) + return -BLKID_ERR_PARAM; + + get_ext2_info(dev, buf); diff --git a/sys-fs/e2fsprogs/files/e2fsprogs-1.38-blkid-swsuspend.patch b/sys-fs/e2fsprogs/files/e2fsprogs-1.38-blkid-swsuspend.patch new file mode 100644 index 000000000000..532cc3519b15 --- /dev/null +++ b/sys-fs/e2fsprogs/files/e2fsprogs-1.38-blkid-swsuspend.patch @@ -0,0 +1,33 @@ +changeset: 1793:c3d82278a098 +user: tytso@mit.edu +date: Tue Sep 6 06:42:49 2005 -0400 +summary: Add support for detecting software suspend partitions to blkid + +diff -r 6949f7a75122 -r c3d82278a098 lib/blkid/probe.c +--- a/lib/blkid/probe.c Tue Sep 6 10:26:45 2005 ++++ b/lib/blkid/probe.c Tue Sep 6 10:42:49 2005 +@@ -529,14 +529,24 @@ + { "sysv", 0, 0x3f8, 4, "\020~\030\375", 0 }, + { "swap", 0, 0xff6, 10, "SWAP-SPACE", probe_swap0 }, + { "swap", 0, 0xff6, 10, "SWAPSPACE2", probe_swap1 }, ++ { "swsuspend", 0, 0xff6, 9, "S1SUSPEND", probe_swap1 }, ++ { "swsuspend", 0, 0xff6, 9, "S2SUSPEND", probe_swap1 }, + { "swap", 0, 0x1ff6, 10, "SWAP-SPACE", probe_swap0 }, + { "swap", 0, 0x1ff6, 10, "SWAPSPACE2", probe_swap1 }, ++ { "swsuspend", 0, 0x1ff6, 9, "S1SUSPEND", probe_swap1 }, ++ { "swsuspend", 0, 0x1ff6, 9, "S2SUSPEND", probe_swap1 }, + { "swap", 0, 0x3ff6, 10, "SWAP-SPACE", probe_swap0 }, + { "swap", 0, 0x3ff6, 10, "SWAPSPACE2", probe_swap1 }, ++ { "swsuspend", 0, 0x3ff6, 9, "S1SUSPEND", probe_swap1 }, ++ { "swsuspend", 0, 0x3ff6, 9, "S2SUSPEND", probe_swap1 }, + { "swap", 0, 0x7ff6, 10, "SWAP-SPACE", probe_swap0 }, + { "swap", 0, 0x7ff6, 10, "SWAPSPACE2", probe_swap1 }, ++ { "swsuspend", 0, 0x7ff6, 9, "S1SUSPEND", probe_swap1 }, ++ { "swsuspend", 0, 0x7ff6, 9, "S2SUSPEND", probe_swap1 }, + { "swap", 0, 0xfff6, 10, "SWAP-SPACE", probe_swap0 }, + { "swap", 0, 0xfff6, 10, "SWAPSPACE2", probe_swap1 }, ++ { "swsuspend", 0, 0xfff6, 9, "S1SUSPEND", probe_swap1 }, ++ { "swsuspend", 0, 0xfff6, 9, "S2SUSPEND", probe_swap1 }, + { "ocfs", 0, 8, 9, "OracleCFS", probe_ocfs }, + { "ocfs2", 1, 0, 6, "OCFSV2", probe_ocfs2 }, + { "ocfs2", 2, 0, 6, "OCFSV2", probe_ocfs2 }, diff --git a/sys-fs/e2fsprogs/files/e2fsprogs-1.38-vfat-labels.patch b/sys-fs/e2fsprogs/files/e2fsprogs-1.38-vfat-labels.patch new file mode 100644 index 000000000000..ad21b30cde4e --- /dev/null +++ b/sys-fs/e2fsprogs/files/e2fsprogs-1.38-vfat-labels.patch @@ -0,0 +1,237 @@ +Add support for reading vfat labels +http://bugs.gentoo.org/77692 + +this is part of upstream commits: + +changeset: 1800:3541b8928702 +user: tytso@mit.edu +date: Sat Sep 10 21:07:23 2005 -0400 +summary: Generic blkid library cleanup + +changeset: 1801:892782b13179 +user: tytso@mit.edu +date: Sat Sep 10 21:51:20 2005 -0400 +summary: Search the root directory of FAT filesystems for the label information + +--- e2fsprogs-1.38/lib/blkid/probe.c ++++ e2fsprogs-1.38/lib/blkid/probe.c +@@ -159,36 +159,204 @@ + return 0; + } + +-static int probe_vfat(int fd __BLKID_ATTR((unused)), ++static unsigned char *get_buffer(int fd, unsigned char **prevbuf, unsigned off, size_t len) ++{ ++ ssize_t ret_read; ++ unsigned char *newbuf; ++ ++ *prevbuf=newbuf = realloc(*prevbuf, len); ++ if (newbuf == NULL) ++ return NULL; ++ ++ if (lseek(fd, off, SEEK_SET) < 0) ++ return NULL; ++ ++ ret_read = read(fd, newbuf, len); ++ if (ret_read != (ssize_t) len) ++ return NULL; ++ ++ ++ return newbuf; ++} ++ ++/* maximum number of clusters */ ++#define FAT12_MAX 0xFF4 ++#define FAT16_MAX 0xFFF4 ++#define FAT32_MAX 0x0FFFFFF6 ++ ++#define FAT_ATTR_VOLUME_ID 0x08 ++#define FAT_ATTR_DIR 0x10 ++#define FAT_ATTR_LONG_NAME 0x0f ++#define FAT_ATTR_MASK 0x3f ++#define FAT_ENTRY_FREE 0xe5 ++ ++static char *no_name = "NO NAME "; ++ ++struct vfat_dir_entry { ++ __u8 name[11]; ++ __u8 attr; ++ __u16 time_creat; ++ __u16 date_creat; ++ __u16 time_acc; ++ __u16 date_acc; ++ __u16 cluster_high; ++ __u16 time_write; ++ __u16 date_write; ++ __u16 cluster_low; ++ __u32 size; ++}; ++ ++static unsigned char *search_fat_label(struct vfat_dir_entry *dir, int count) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < count; i++) { ++ if (dir[i].name[0] == 0x00) ++ break; ++ ++ if ((dir[i].name[0] == FAT_ENTRY_FREE) || ++ (dir[i].cluster_high != 0 || dir[i].cluster_low != 0) || ++ ((dir[i].attr & FAT_ATTR_MASK) == FAT_ATTR_LONG_NAME)) ++ continue; ++ ++ if ((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == ++ FAT_ATTR_VOLUME_ID) { ++ return dir[i].name; ++ } ++ } ++ return 0; ++} ++ ++static int figure_label_len(const unsigned char *label, int len) ++{ ++ const unsigned char *end = label + len - 1; ++ ++ while ((*end == ' ' || *end == 0) && end >= label) ++ --end; ++ if (end >= label) { ++ label = label; ++ return end - label + 1; ++ } ++ return 0; ++} ++ ++static int probe_vfat(int fd, + blkid_cache cache __BLKID_ATTR((unused)), + blkid_dev dev, + struct blkid_magic *id __BLKID_ATTR((unused)), + unsigned char *buf) + { +- struct vfat_super_block *vs; ++ struct vfat_super_block *vs = (struct vfat_super_block *) buf; ++ struct msdos_super_block *ms = (struct msdos_super_block *) buf; ++ struct vfat_dir_entry *dir; + char serno[10]; +- const char *label = 0; +- int label_len = 0; ++ const unsigned char *label = 0, *vol_label = 0; ++ unsigned char *vol_serno; ++ int label_len = 0, maxloop = 100; ++ __u16 sector_size, dir_entries, reserved; ++ __u32 sect_count, fat_size, dir_size, cluster_count, fat_length; ++ __u32 buf_size, start_data_sect, next, root_start, root_dir_entries; ++ unsigned char *mybuf=NULL; ++ ++ /* sector size check */ ++ sector_size = blkid_le16(*((__u16 *) &ms->ms_sector_size)); ++ if (sector_size != 0x200 && sector_size != 0x400 && ++ sector_size != 0x800 && sector_size != 0x1000) ++ return 1; + +- vs = (struct vfat_super_block *)buf; ++ dir_entries = blkid_le16(*((__u16 *) &ms->ms_dir_entries)); ++ reserved = blkid_le16(ms->ms_reserved); ++ sect_count = blkid_le16(*((__u16 *) &ms->ms_sectors)); ++ if (sect_count == 0) ++ sect_count = blkid_le32(ms->ms_total_sect); ++ ++ fat_length = blkid_le16(ms->ms_fat_length); ++ if (fat_length == 0) ++ fat_length = blkid_le32(vs->vs_fat32_length); ++ ++ fat_size = fat_length * ms->ms_fats; ++ dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) + ++ (sector_size-1)) / sector_size; + +- if (strncmp(vs->vs_label, "NO NAME", 7)) { +- char *end = vs->vs_label + sizeof(vs->vs_label) - 1; ++ cluster_count = sect_count - (reserved + fat_size + dir_size); ++ cluster_count /= ms->ms_cluster_size; + +- while (*end == ' ' && end >= vs->vs_label) +- --end; +- if (end >= vs->vs_label) { +- label = vs->vs_label; +- label_len = end - vs->vs_label + 1; ++ if (cluster_count > FAT32_MAX) ++ return 1; ++ ++ if (ms->ms_fat_length) { ++ /* the label may be an attribute in the root directory */ ++ root_start = (reserved + fat_size) * sector_size; ++ root_dir_entries = vs->vs_dir_entries[0] + ++ (vs->vs_dir_entries[1] << 8); ++ ++ buf_size = root_dir_entries * sizeof(struct vfat_dir_entry); ++ dir = (struct vfat_dir_entry *) get_buffer(fd, &mybuf, root_start, ++ buf_size); ++ if (dir) ++ vol_label = search_fat_label(dir, root_dir_entries); ++ ++ if (!vol_label || !memcmp(vol_label, no_name, 11)) ++ vol_label = ms->ms_label; ++ vol_serno = ms->ms_serno; ++ blkid_set_tag(dev, "SEC_TYPE", "msdos", sizeof("msdos")); ++ } else { ++ /* Search the FAT32 root dir for the label attribute */ ++ buf_size = vs->vs_cluster_size * sector_size; ++ start_data_sect = reserved + fat_size; ++ ++ next = blkid_le32(vs->vs_root_cluster); ++ while (next && --maxloop) { ++ __u32 next_sect_off; ++ __u64 next_off, fat_entry_off; ++ int count; ++ ++ next_sect_off = (next - 2) * vs->vs_cluster_size; ++ next_off = (start_data_sect + next_sect_off) * ++ sector_size; ++ ++ dir = (struct vfat_dir_entry *)get_buffer(fd, &mybuf, next_off, buf_size); ++ if (dir == NULL) ++ break; ++ ++ count = buf_size / sizeof(struct vfat_dir_entry); ++ ++ vol_label = search_fat_label(dir, count); ++ ++ ++ if (vol_label) ++ break; ++ ++ /* get FAT entry */ ++ fat_entry_off = (reserved * sector_size) + ++ (next * sizeof(__u32)); ++ ++ buf = get_buffer(fd, &mybuf, fat_entry_off, buf_size); ++ if (buf == NULL) ++ break; ++ ++ /* set next cluster */ ++ next = blkid_le32(*((__u32 *) buf) & 0x0fffffff); + } ++ ++ if (!vol_label || !memcmp(vol_label, no_name, 11)) ++ vol_label = vs->vs_label; ++ vol_serno = vs->vs_serno; ++ } ++ ++ if (vol_label && memcmp(vol_label, no_name, 11)) { ++ label = vol_label; ++ label_len = figure_label_len(vol_label, 11); + } + + /* We can't just print them as %04X, because they are unaligned */ +- sprintf(serno, "%02X%02X-%02X%02X", vs->vs_serno[3], vs->vs_serno[2], +- vs->vs_serno[1], vs->vs_serno[0]); +- blkid_set_tag(dev, "LABEL", label, label_len); +- blkid_set_tag(dev, "UUID", serno, sizeof(serno)); ++ sprintf(serno, "%02X%02X-%02X%02X", vol_serno[3], vol_serno[2], ++ vol_serno[1], vol_serno[0]); + ++ blkid_set_tag(dev, "LABEL", (const char *) label, label_len); ++ blkid_set_tag(dev, "UUID", serno, sizeof(serno)-1); ++ if (mybuf) ++ free(mybuf); + return 0; + } |