From 6ad592b8055ff0760975cda01a679c43b57c1db3 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 11 Nov 2006 09:21:57 +0000 Subject: [PATCH] old --- sys-fs/e2fsprogs/e2fsprogs-1.38-r1.ebuild | 137 ---------- .../e2fsprogs/files/digest-e2fsprogs-1.38-r1 | 3 - .../files/e2fsprogs-1.38-blkid-ext23.patch | 20 -- .../e2fsprogs-1.38-blkid-swsuspend.patch | 33 --- .../e2fsprogs-1.38-disconnected-inodes.patch | 79 ------ .../files/e2fsprogs-1.38-libintl.patch | 13 - .../files/e2fsprogs-1.38-vfat-labels.patch | 237 ------------------ 7 files changed, 522 deletions(-) delete mode 100644 sys-fs/e2fsprogs/e2fsprogs-1.38-r1.ebuild delete mode 100644 sys-fs/e2fsprogs/files/digest-e2fsprogs-1.38-r1 delete mode 100644 sys-fs/e2fsprogs/files/e2fsprogs-1.38-blkid-ext23.patch delete mode 100644 sys-fs/e2fsprogs/files/e2fsprogs-1.38-blkid-swsuspend.patch delete mode 100644 sys-fs/e2fsprogs/files/e2fsprogs-1.38-disconnected-inodes.patch delete mode 100644 sys-fs/e2fsprogs/files/e2fsprogs-1.38-libintl.patch delete mode 100644 sys-fs/e2fsprogs/files/e2fsprogs-1.38-vfat-labels.patch diff --git a/sys-fs/e2fsprogs/e2fsprogs-1.38-r1.ebuild b/sys-fs/e2fsprogs/e2fsprogs-1.38-r1.ebuild deleted file mode 100644 index 722379733f80..000000000000 --- a/sys-fs/e2fsprogs/e2fsprogs-1.38-r1.ebuild +++ /dev/null @@ -1,137 +0,0 @@ -# Copyright 1999-2006 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.14 2006/04/24 01:34:37 kumba 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} - nls? ( virtual/libintl )" -DEPEND="${RDEPEND} - nls? ( sys-devel/gettext ) - sys-apps/texinfo" - -pkg_setup() { - # sanity check for #125146 - if [[ -L ${ROOT}/usr/$(get_libdir)/libcom_err.a ]] || \ - [[ ! -e ${ROOT}/usr/$(get_libdir)/libcom_err.a ]] - then - rm -f "${ROOT}"/usr/$(get_libdir)/libcom_err.a - eerror "Your libcom_err.a is broken, please re-emerge com_err:" - eerror " # emerge com_err" - die "Mr. T pities the fool with a broken libcom_err.a" - fi -} - -src_unpack() { - unpack ${A} - cd "${S}" - # Fix locale issues while running tests #99766 - epatch "${FILESDIR}"/${P}-tests-locale.patch - # 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 - - # Fixes libintl handling on non-glibc #122368 - epatch "${FILESDIR}/${P}-libintl.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 [[ ${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" - rm -f "${D}"/usr/$(get_libdir)/libcom_err.a #125146 - 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 deleted file mode 100644 index b74c52b56bb1..000000000000 --- a/sys-fs/e2fsprogs/files/digest-e2fsprogs-1.38-r1 +++ /dev/null @@ -1,3 +0,0 @@ -MD5 d774d4412bfb80d12cf3a4fdfd59de5a e2fsprogs-1.38.tar.gz 3621193 -RMD160 492071c29e9a0adc1bed0762e795efb6b29a692c e2fsprogs-1.38.tar.gz 3621193 -SHA256 c4e482687d0cff240d02a70fcf423cc14296b6a7869cd8dd42d5404d098e0bb7 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 deleted file mode 100644 index 5bc2fc816925..000000000000 --- a/sys-fs/e2fsprogs/files/e2fsprogs-1.38-blkid-ext23.patch +++ /dev/null @@ -1,20 +0,0 @@ -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 deleted file mode 100644 index 532cc3519b15..000000000000 --- a/sys-fs/e2fsprogs/files/e2fsprogs-1.38-blkid-swsuspend.patch +++ /dev/null @@ -1,33 +0,0 @@ -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-disconnected-inodes.patch b/sys-fs/e2fsprogs/files/e2fsprogs-1.38-disconnected-inodes.patch deleted file mode 100644 index f66ca8a06dc1..000000000000 --- a/sys-fs/e2fsprogs/files/e2fsprogs-1.38-disconnected-inodes.patch +++ /dev/null @@ -1,79 +0,0 @@ -http://bugs.gentoo.org/91751 - -2005-07-04 Theodore Ts'o - - * pass2.c (e2fsck_process_bad_inode): Fixed bug which could cause - e2fsck to core dump if a disconnected inode contained an - extended attribute. This was actually caused by two bugs. - The first bug is that if the inode has been fully fixed - up, the code will attempt to remove the inode from the - inode_bad_map without checking to see if this bitmap is - present. Since it is cleared at the end of pass 2, if - e2fsck_process_bad_inode is called in pass 4 (as it is for - disconnected inodes), this would result in a core dump. - This bug was mostly hidden by a second bug, which caused - e2fsck_process_bad_inode() to consider all inodes without - an extended attribute to be not fixed. (Addresses Debian - Bug: #316736) - ---- e2fsck/pass2.c -+++ e2fsck/pass2.c -@@ -1184,27 +1184,29 @@ - pctx.inode = &inode; - - if (inode.i_file_acl && -- !(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR) && -- fix_problem(ctx, PR_2_FILE_ACL_ZERO, &pctx)) { -- inode.i_file_acl = 0; -+ !(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) { -+ if (fix_problem(ctx, PR_2_FILE_ACL_ZERO, &pctx)) { -+ inode.i_file_acl = 0; - #ifdef EXT2FS_ENABLE_SWAPFS -- /* -- * This is a special kludge to deal with long symlinks -- * on big endian systems. i_blocks had already been -- * decremented earlier in pass 1, but since i_file_acl -- * hadn't yet been cleared, ext2fs_read_inode() -- * assumed that the file was short symlink and would -- * not have byte swapped i_block[0]. Hence, we have -- * to byte-swap it here. -- */ -- if (LINUX_S_ISLNK(inode.i_mode) && -- (fs->flags & EXT2_FLAG_SWAP_BYTES) && -- (inode.i_blocks == fs->blocksize >> 9)) -- inode.i_block[0] = ext2fs_swab32(inode.i_block[0]); -+ /* -+ * This is a special kludge to deal with long -+ * symlinks on big endian systems. i_blocks -+ * had already been decremented earlier in -+ * pass 1, but since i_file_acl hadn't yet -+ * been cleared, ext2fs_read_inode() assumed -+ * that the file was short symlink and would -+ * not have byte swapped i_block[0]. Hence, -+ * we have to byte-swap it here. -+ */ -+ if (LINUX_S_ISLNK(inode.i_mode) && -+ (fs->flags & EXT2_FLAG_SWAP_BYTES) && -+ (inode.i_blocks == fs->blocksize >> 9)) -+ inode.i_block[0] = ext2fs_swab32(inode.i_block[0]); - #endif -- inode_modified++; -- } else -- not_fixed++; -+ inode_modified++; -+ } else -+ not_fixed++; -+ } - - if (!LINUX_S_ISDIR(inode.i_mode) && !LINUX_S_ISREG(inode.i_mode) && - !LINUX_S_ISCHR(inode.i_mode) && !LINUX_S_ISBLK(inode.i_mode) && -@@ -1302,7 +1304,7 @@ - - if (inode_modified) - e2fsck_write_inode(ctx, ino, &inode, "process_bad_inode"); -- if (!not_fixed) -+ if (!not_fixed && ctx->inode_bad_map) - ext2fs_unmark_inode_bitmap(ctx->inode_bad_map, ino); - return 0; - } - diff --git a/sys-fs/e2fsprogs/files/e2fsprogs-1.38-libintl.patch b/sys-fs/e2fsprogs/files/e2fsprogs-1.38-libintl.patch deleted file mode 100644 index af526b1c8f5a..000000000000 --- a/sys-fs/e2fsprogs/files/e2fsprogs-1.38-libintl.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: e2fsprogs-1.38/MCONFIG.in -=================================================================== ---- e2fsprogs-1.38.orig/MCONFIG.in -+++ e2fsprogs-1.38/MCONFIG.in -@@ -71,7 +71,7 @@ LIBE2P = $(LIB)/libe2p@LIB_EXT@ - LIBEXT2FS = $(LIB)/libext2fs@LIB_EXT@ - LIBUUID = $(LIB)/libuuid@LIB_EXT@ @SOCKET_LIB@ - LIBBLKID = $(LIB)/libblkid@LIB_EXT@ --LIBINTL = @LIBINTL@ -+LIBINTL = @LTLIBINTL@ - DEPLIBUUID = $(LIB)/libuuid@LIB_EXT@ - - STATIC_LIBSS = $(LIB)/libss@STATIC_LIB_EXT@ diff --git a/sys-fs/e2fsprogs/files/e2fsprogs-1.38-vfat-labels.patch b/sys-fs/e2fsprogs/files/e2fsprogs-1.38-vfat-labels.patch deleted file mode 100644 index ad21b30cde4e..000000000000 --- a/sys-fs/e2fsprogs/files/e2fsprogs-1.38-vfat-labels.patch +++ /dev/null @@ -1,237 +0,0 @@ -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; - } -- 2.26.2