hal/tools fstab-sync.c,1.20,1.21
David Zeuthen
david at freedesktop.org
Mon Sep 27 09:37:49 PDT 2004
Update of /cvs/hal/hal/tools
In directory gabe:/tmp/cvs-serv30713/tools
Modified Files:
fstab-sync.c
Log Message:
2004-09-27 David Zeuthen <david at fubar.dk>
* libhal/libhal.c (hal_shutdown): Remember to init error var
* tools/fstab-sync.c (add_udi): Add a whitelist so if a volume stems
from a msdos style partition table we require that type to be in the
whitelist; initially includes various FAT formats, NTFS and Linux.
(volume_new): Fix a bug in size computation
* libhal-storage/libhal-storage.h: Add prototype for
hal_volume_get_msdos_part_table_type
* libhal-storage/libhal-storage.c:
(hal_volume_get_msdos_part_table_type): New function
* hald/linux/block_class_device.c (block_class_pre_process):
Rename x86_type to msdos_part_table_type
* hald/haldaemon.in: Fixup URL
Index: fstab-sync.c
===================================================================
RCS file: /cvs/hal/hal/tools/fstab-sync.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- fstab-sync.c 19 Sep 2004 13:47:52 -0000 1.20
+++ fstab-sync.c 27 Sep 2004 16:37:47 -0000 1.21
@@ -989,8 +989,8 @@
{
Volume *volume;
char *storudi;
- dbus_int32_t num_blocks;
- dbus_int32_t block_size;
+ dbus_int64_t num_blocks;
+ dbus_int64_t block_size;
char buf[64];
if (!udi_is_volume_or_nonpartition_drive (udi))
@@ -1049,8 +1049,8 @@
if (hal_device_property_exists (hal_context, udi, "volume.block_size") &&
hal_device_property_exists (hal_context, udi, "volume.num_blocks")) {
- block_size = hal_device_get_property_int (hal_context, udi, "volume.block_size");
- num_blocks = hal_device_get_property_int (hal_context, udi, "volume.num_blocks");
+ block_size = (dbus_int64_t) hal_device_get_property_int (hal_context, udi, "volume.block_size");
+ num_blocks = (dbus_int64_t) hal_device_get_property_int (hal_context, udi, "volume.num_blocks");
volume->size = block_size * num_blocks;
} else {
volume->size = -1;
@@ -1439,6 +1439,36 @@
hal_device_get_property_bool (hal_context, udi, "block.no_partitions"))
return FALSE;
+ if (hal_device_property_exists (hal_context, udi, "volume.partition.msdos_part_table_type")) {
+ unsigned int i;
+ int msdos_type;
+ int msdos_whitelist[] = {
+ 0x01, /* FAT12 */
+ 0x04, /* FAT16 <32M */
+ 0x06, /* FAT16 */
+ 0x07, /* HPFS/NTFS */
+ 0x0b, /* W95 FAT32 */
+ 0x0c, /* W95 FAT32 (LBA) */
+ 0x0e, /* W95 FAT16 (LBA) */
+ 0x83, /* Linux */
+ 0x00};
+
+ msdos_type = hal_device_get_property_int (hal_context, udi, "volume.partition.msdos_part_table_type");
+ fstab_update_debug (_("%d: msdos_part_table_type = 0x%02x\n"), pid, msdos_type);
+
+ for (i = 0; msdos_whitelist[i] != 0x00; i++) {
+ if (msdos_type == msdos_whitelist[i]) {
+ fstab_update_debug (_("%d: in whitelist\n"), pid);
+ goto in_white_list;
+ }
+ }
+
+ fstab_update_debug (_("%d: not in whitelist; ignoring\n"), pid);
+ return FALSE;
+ }
+
+in_white_list:
+
volume = volume_new (udi);
if (volume == NULL)
More information about the hal-commit
mailing list