From ba575e420d6d0da3df6f4394e65d89670c8b301c Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Thu, 17 Apr 2008 10:04:12 +0000 Subject: [PATCH] Add support for detecting FAT32 volume labels. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24996 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/fat/dosfs.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/add-ons/kernel/file_systems/fat/dosfs.c b/src/add-ons/kernel/file_systems/fat/dosfs.c index 5a51542283..50721fe8c8 100644 --- a/src/add-ons/kernel/file_systems/fat/dosfs.c +++ b/src/add-ons/kernel/file_systems/fat/dosfs.c @@ -626,6 +626,12 @@ dosfs_identify_partition(int fd, partition_data *partition, void **_cookie) sectors_per_fat = read16(buf,0x16); if (sectors_per_fat == 0) { total_sectors = read32(buf,0x20); + + if (buf[0x42] == 0x29) { + // fill in FAT32 volume label + if (memcmp(buf + 0x47, " ", 11) != 0) + memcpy(name, buf + 0x47, 11); + } } else { total_sectors = read16(buf,0x13); // partition size if (total_sectors == 0) @@ -633,9 +639,8 @@ dosfs_identify_partition(int fd, partition_data *partition, void **_cookie) if (buf[0x26] == 0x29) { // fill in the volume label - if (memcmp(buf+0x2b, " ", 11)) { - memcpy(name, buf+0x2b, 11); - } + if (memcmp(buf + 0x2b, " ", 11) != 0) + memcpy(name, buf + 0x2b, 11); } }