hal/hald/linux/volume_id volume_id.c,1.45.2.5,1.45.2.6
Kay Sievers
kay at freedesktop.org
Mon Jan 17 07:25:02 PST 2005
Update of /cvs/hal/hal/hald/linux/volume_id
In directory gabe:/tmp/cvs-serv26211/hald/linux/volume_id
Modified Files:
Tag: hal-0_4-stable-branch
volume_id.c
Log Message:
2005-01-17 Kay Sievers <kay.sievers at vrfy.org>
* hald/linux/volume_id/volume_id.c: (probe_vfat): Thanks to
Schupp Roderich for fixing a off-by-one error and the suggestion
to skip FAT long names while searching for the label.
Index: volume_id.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/volume_id/volume_id.c,v
retrieving revision 1.45.2.5
retrieving revision 1.45.2.6
diff -u -d -r1.45.2.5 -r1.45.2.6
--- volume_id.c 17 Jan 2005 11:25:17 -0000 1.45.2.5
+++ volume_id.c 17 Jan 2005 15:25:00 -0000 1.45.2.6
@@ -774,6 +774,8 @@
#define FAT16_MAX 0xfff5
#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 int probe_vfat(struct volume_id *id, __u64 off)
{
@@ -959,7 +961,7 @@
dir = (struct vfat_dir_entry*) buf;
- for (i = 0; i <= root_dir_entries; i++) {
+ for (i = 0; i < root_dir_entries; i++) {
/* end marker */
if (dir[i].name[0] == 0x00) {
dbg("end of dir");
@@ -970,8 +972,15 @@
if (dir[i].name[0] == FAT_ENTRY_FREE)
continue;
- if (((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) &&
- dir[i].cluster_high == 0 && dir[i].cluster_low == 0) {
+ /* long name */
+ if ((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) {
+ /* labels do not have file data */
+ if (dir[i].cluster_high != 0 || dir[i].cluster_low != 0)
+ continue;
+
dbg("found ATTR_VOLUME_ID id in root dir");
label = dir[i].name;
break;
@@ -1023,7 +1032,7 @@
count = buf_size / sizeof(struct vfat_dir_entry);
dbg("expected entries 0x%x", count);
- for (i = 0; i <= count; i++) {
+ for (i = 0; i < count; i++) {
/* end marker */
if (dir[i].name[0] == 0x00) {
dbg("end of dir");
@@ -1034,8 +1043,15 @@
if (dir[i].name[0] == FAT_ENTRY_FREE)
continue;
- if (((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) &&
- dir[i].cluster_high == 0 && dir[i].cluster_low == 0) {
+ /* long name */
+ if ((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) {
+ /* labels do not have file data */
+ if (dir[i].cluster_high != 0 || dir[i].cluster_low != 0)
+ continue;
+
dbg("found ATTR_VOLUME_ID id in root dir");
label = dir[i].name;
goto fat32_label;
More information about the hal-commit
mailing list