hal/hald/linux/volume_id volume_id.c,1.18,1.19 volume_id.h,1.8,1.9

David Zeuthen david at freedesktop.org
Wed Aug 11 11:53:53 PDT 2004


Update of /cvs/hal/hal/hald/linux/volume_id
In directory pdx:/tmp/cvs-serv15046/hald/linux/volume_id

Modified Files:
	volume_id.c volume_id.h 
Log Message:
2004-08-11  David Zeuthen  <david at fubar.dk>

	* doc/spec/hal-spec.xml.in: Add docs for block.have_scanned,
	volume.is_filesystem, Device Conditions on volume device
	objects (now with new names), 'unknown' value for
	volume.disc.type, 'platform' value for storage.bus, rename
	storage.automount_enabled to storage.automount_enabled_hint. Add
	property storage.no_partitions_hint

	* hald/hald.conf:
	* hald/hald_conf.[ch]:
	Rename storage.automount_enabled to storage.automount_enabled_hint
	and remove storage.cdrom_eject_check_enabled.

	* hald/linux/common.[ch]:

	* hald/linux/platform_bus_device.c: (platform_device_pre_process):

	* hald/property.c (hal_property_get_bool): Return FALSE instead of
	-1 if property not found.

	* hald/linux/block_class_device.c: (set_volume_id_values),
	(get_child_device_gdl), (get_child_device_tdl),
	(block_class_visit), (cdrom_get_properties), (force_unmount),
	(force_unmount_of_all_childs), (get_first_valid_partition),
	(detect_disc), (detect_media), (block_class_pre_process),
	(mtab_handle_storage), (mtab_handle_volume):
	Unified codepaths for handling optical discs and other removable
	storage. Handle media with no partition table much nicer
	
	* hald/linux/volume_id/volume_id.c: (set_label_string),
	(set_label_unicode16), (set_uuid), (get_buffer),
	(probe_msdos_part_table), (probe_ext), (probe_reiser), (probe_xfs),
	(probe_jfs), (probe_vfat), (probe_msdos), (probe_udf),
	(probe_iso9660), (probe_ufs), (probe_mac_partition_map),
	(probe_hfs_hfsplus), (probe_ntfs), (probe_swap), (volume_id_probe),
	(volume_id_close):
	* hald/linux/volume_id/volume_id.h:
	Add support for parsing partition tables from Kay Sievers 
	<kay.sievers at vrfy.org>. Change 'reiser' to 'reiserfs' because
	the that's the name on Linux.



Index: volume_id.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/volume_id/volume_id.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- volume_id.c	1 Aug 2004 23:17:02 -0000	1.18
+++ volume_id.c	11 Aug 2004 18:53:50 -0000	1.19
@@ -101,15 +101,15 @@
 {
 	unsigned int i;
 
-	memcpy(id->label_string, buf, count);
+	memcpy(id->label, buf, count);
 
 	/* remove trailing whitespace */
-	i = strnlen(id->label_string, count);
+	i = strnlen(id->label, count);
 	while (i--) {
-		if (! isspace(id->label_string[i]))
[...965 lines suppressed...]
+		rc = probe_mac_partition_map(id, off);
 		if (rc == 0)
 			break;
-		rc = probe_ufs(id);
+		rc = probe_hfs_hfsplus(id, off);
+		if (rc == 0)
+			break;
+		rc = probe_ufs(id, off);
 		if (rc == 0)
 			break;
 		rc = -1;
@@ -1565,5 +1686,8 @@
 
 	free_buffer(id);
 
+	if (id->partitions != NULL)
+		free(id->partitions);
+
 	free(id);
 }

Index: volume_id.h
===================================================================
RCS file: /cvs/hal/hal/hald/linux/volume_id/volume_id.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- volume_id.h	1 Aug 2004 23:17:02 -0000	1.8
+++ volume_id.h	11 Aug 2004 18:53:50 -0000	1.9
@@ -21,16 +21,22 @@
 #ifndef _VOLUME_ID_H_
 #define _VOLUME_ID_H_
 
-#define VOLUME_ID_VERSION		007
+#define VOLUME_ID_VERSION		009
 
 #define VOLUME_ID_LABEL_SIZE		64
 #define VOLUME_ID_UUID_SIZE		16
 #define VOLUME_ID_UUID_STRING_SIZE	37
 #define VOLUME_ID_PATH_MAX		255
 
+enum volume_id_type {
+	VOLUME_ID_OTHER,
+	VOLUME_ID_FILESYSTEM,
+	VOLUME_ID_PARTITIONTABLE
+};
 
-enum filesystem_type {
+enum volume_id_format {
 	VOLUME_ID_ALL,
+	VOLUME_ID_MSDOSPARTTABLE,
 	VOLUME_ID_SWAP,
 	VOLUME_ID_EXT2,
 	VOLUME_ID_EXT3,
@@ -42,25 +48,33 @@
 	VOLUME_ID_UDF,
 	VOLUME_ID_ISO9660,
 	VOLUME_ID_NTFS,
+	VOLUME_ID_MACPARTMAP,
 	VOLUME_ID_HFS,
 	VOLUME_ID_HFSPLUS,
-	VOLUME_ID_MACPARTMAP,
 	VOLUME_ID_UFS
 };
 
+struct volume_id_partition {
+	unsigned long long	off;
+	unsigned long long	len;
+};
+
 struct volume_id {
 	unsigned char	label_raw[VOLUME_ID_LABEL_SIZE];
 	unsigned int	label_raw_len;
-	char		label_string[VOLUME_ID_LABEL_SIZE+1];
-	unsigned char	uuid[VOLUME_ID_UUID_SIZE];
-	char		uuid_string[VOLUME_ID_UUID_STRING_SIZE];
-	enum		filesystem_type fs_type;
-	char		*fs_name;
+	char		label[VOLUME_ID_LABEL_SIZE+1];
+	unsigned char	uuid_raw[VOLUME_ID_UUID_SIZE];
+	char		uuid[VOLUME_ID_UUID_STRING_SIZE];
+	enum		volume_id_type type_id;
+	enum		volume_id_format format_id;
+	char		*format;
+	struct volume_id_partition *partitions;
+	unsigned int	partition_count;
 	int		fd;
 	unsigned char	*sbbuf;
 	unsigned int	sbbuf_len;
 	unsigned char	*seekbuf;
-	unsigned long	seekbuf_off;
+	unsigned long long seekbuf_off;
 	unsigned int	seekbuf_len;
 	int		fd_close;
 };
@@ -75,7 +89,8 @@
 extern struct volume_id *volume_id_open_dev_t(dev_t devt);
 
 /* probe volume for filesystem type and try to read label/uuid */
-extern int volume_id_probe(struct volume_id *id, enum filesystem_type fs_type);
+extern int volume_id_probe(struct volume_id *id, enum volume_id_type type,
+			   unsigned long long off);
 
 /* free allocated device info */
 extern void volume_id_close(struct volume_id *id);




More information about the hal-commit mailing list