Add support for detecting FAT32 volume labels.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24996 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2008-04-17 10:04:12 +00:00
parent b8c45ca140
commit ba575e420d

View File

@ -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);
}
}