hal/volume_id cramfs.c, 1.6, 1.7 ext.c, 1.7, 1.8 fat.c, 1.10, 1.11 hfs.c, 1.7, 1.8 highpoint.c, 1.8, 1.9 hpfs.c, 1.6, 1.7 iso9660.c, 1.8, 1.9 isw_raid.c, 1.6, 1.7 jfs.c, 1.7, 1.8 linux_raid.c, 1.8, 1.9 linux_swap.c, 1.7, 1.8 lsi_raid.c, 1.5, 1.6 lvm.c, 1.8, 1.9 mac.c, 1.8, 1.9 minix.c, 1.5, 1.6 msdos.c, 1.7, 1.8 ntfs.c, 1.8, 1.9 nvidia_raid.c, 1.5, 1.6 ocfs.c, 1.2, 1.3 promise_raid.c, 1.5, 1.6 reiserfs.c, 1.9, 1.10 romfs.c, 1.7, 1.8 silicon_raid.c, 1.5, 1.6 sysv.c, 1.7, 1.8 udf.c, 1.7, 1.8 ufs.c, 1.7, 1.8 via_raid.c, 1.5, 1.6 volume_id.c, 1.13, 1.14 volume_id.h, 1.13, 1.14 vxfs.c, 1.2, 1.3 xfs.c, 1.7, 1.8

Kay Sievers kay at kemper.freedesktop.org
Tue Feb 21 11:15:19 PST 2006


Update of /cvs/hal/hal/volume_id
In directory kemper:/tmp/cvs-serv7318/volume_id

Modified Files:
	cramfs.c ext.c fat.c hfs.c highpoint.c hpfs.c iso9660.c 
	isw_raid.c jfs.c linux_raid.c linux_swap.c lsi_raid.c lvm.c 
	mac.c minix.c msdos.c ntfs.c nvidia_raid.c ocfs.c 
	promise_raid.c reiserfs.c romfs.c silicon_raid.c sysv.c udf.c 
	ufs.c via_raid.c volume_id.c volume_id.h vxfs.c xfs.c 
Log Message:
2006-02-21  Kay Sievers  <kay.sievers at vrfy.org>

        Sync volume_id with udev version.


Index: cramfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/cramfs.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- cramfs.c	15 Nov 2005 03:32:36 -0000	1.6
+++ cramfs.c	21 Feb 2006 19:15:17 -0000	1.7
@@ -38,9 +38,9 @@
 		uint32_t	edition;
 		uint32_t	blocks;
 		uint32_t	files;
-	} __attribute__((__packed__)) info;
+	} PACKED info;
 	uint8_t		name[16];
-} __attribute__((__packed__));
+} PACKED;
 
 int volume_id_probe_cramfs(struct volume_id *id, uint64_t off)
 {
@@ -52,7 +52,7 @@
 	if (cs == NULL)
 		return -1;
 
-	if (memcmp(cs->magic, "\x45\x3d\xcd\x28", 4) == 0) {
+	if (memcmp(cs->magic, "\x45\x3d\xcd\x28", 4) == 0 || memcmp(cs->magic, "\x28\xcd\x3d\x45", 4) == 0) {
 		volume_id_set_label_raw(id, cs->name, 16);
 		volume_id_set_label_string(id, cs->name, 16);
 

Index: ext.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/ext.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ext.c	15 Nov 2005 03:32:36 -0000	1.7
+++ ext.c	21 Feb 2006 19:15:17 -0000	1.8
@@ -61,7 +61,7 @@
 	uint32_t	s_feature_ro_compat;
 	uint8_t		s_uuid[16];
 	uint8_t		s_volume_name[16];
-} __attribute__((__packed__));
+} PACKED;
 
 #define EXT_SUPER_MAGIC				0xEF53
 #define EXT3_FEATURE_COMPAT_HAS_JOURNAL		0x00000004

Index: fat.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/fat.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- fat.c	21 Nov 2005 17:55:13 -0000	1.10
+++ fat.c	21 Feb 2006 19:15:17 -0000	1.11
@@ -58,7 +58,7 @@
 			uint8_t		magic[8];
 			uint8_t		dummy2[192];
 			uint8_t		pmagic[2];
-		} __attribute__((__packed__)) fat;
+		} PACKED fat;
 		struct fat32_super_block {
 			uint32_t	fat32_length;
 			uint16_t	flags;
@@ -73,9 +73,9 @@
 			uint8_t		magic[8];
 			uint8_t		dummy2[164];
 			uint8_t		pmagic[2];
-		} __attribute__((__packed__)) fat32;
-	} __attribute__((__packed__)) type;
-} __attribute__((__packed__));
+		} PACKED fat32;
+	} PACKED type;
+} PACKED;
 
 struct vfat_dir_entry {
 	uint8_t		name[11];
@@ -89,7 +89,7 @@
 	uint16_t	date_write;
 	uint16_t	cluster_low;
 	uint32_t	size;
-} __attribute__((__packed__));
+} PACKED;
 
 static uint8_t *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int count)
 {

Index: hfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/hfs.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- hfs.c	15 Nov 2005 03:32:36 -0000	1.7
+++ hfs.c	21 Feb 2006 19:15:17 -0000	1.8
@@ -35,7 +35,7 @@
 	uint32_t	reserved;
 	uint32_t	osx_folder;
 	uint8_t		id[8];
-} __attribute__((__packed__));
+} PACKED;
 
 struct hfs_mdb {
 	uint8_t		signature[2];
@@ -65,7 +65,7 @@
 	uint8_t		embed_sig[2];
 	uint16_t	embed_startblock;
 	uint16_t	embed_blockcount;
-} __attribute__((__packed__)) *hfs;
+} PACKED *hfs;
 
 struct hfsplus_bnode_descriptor {
 	uint32_t	next;
@@ -74,7 +74,7 @@
 	uint8_t		height;
 	uint16_t	num_recs;
 	uint16_t	reserved;
-} __attribute__((__packed__));
+} PACKED;
 
 struct hfsplus_bheader_record {
 	uint16_t	depth;
@@ -83,19 +83,19 @@
 	uint32_t	leaf_head;
 	uint32_t	leaf_tail;
 	uint16_t	node_size;
-} __attribute__((__packed__));
+} PACKED;
 
 struct hfsplus_catalog_key {
 	uint16_t	key_len;
 	uint32_t	parent_id;
 	uint16_t	unicode_len;
 	uint8_t		unicode[255 * 2];
-} __attribute__((__packed__));
+} PACKED;
 
 struct hfsplus_extent {
 	uint32_t	start_block;
 	uint32_t	block_count;
-} __attribute__((__packed__));
+} PACKED;
 
 #define HFSPLUS_EXTENT_COUNT		8
 struct hfsplus_fork {
@@ -103,7 +103,7 @@
 	uint32_t	clump_size;
 	uint32_t	total_blocks;
 	struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT];
-} __attribute__((__packed__));
+} PACKED;
 
 struct hfsplus_vol_header {
 	uint8_t		signature[2];
@@ -132,7 +132,7 @@
 	struct hfsplus_fork cat_file;
 	struct hfsplus_fork attr_file;
 	struct hfsplus_fork start_file;
-} __attribute__((__packed__)) *hfsplus;
+} PACKED *hfsplus;
 
 #define HFS_SUPERBLOCK_OFFSET		0x400
 #define HFS_NODE_LEAF			0xff

Index: highpoint.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/highpoint.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- highpoint.c	15 Nov 2005 03:32:36 -0000	1.8
+++ highpoint.c	21 Feb 2006 19:15:17 -0000	1.9
@@ -30,11 +30,11 @@
 struct hpt37x_meta {
 	uint8_t		filler1[32];
 	uint32_t	magic;
-} __attribute__((packed));
+} PACKED;
 
 struct hpt45x_meta {
 	uint32_t	magic;
-} __attribute__((packed));
+} PACKED;
 
 #define HPT37X_CONFIG_OFF		0x1200
 #define HPT37X_MAGIC_OK			0x5a7816f0

Index: hpfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/hpfs.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- hpfs.c	15 Nov 2005 03:32:36 -0000	1.6
+++ hpfs.c	21 Feb 2006 19:15:17 -0000	1.7
@@ -31,7 +31,7 @@
 {
 	uint8_t		magic[4];
 	uint8_t		version;
-} __attribute__((__packed__));
+} PACKED;
 
 #define HPFS_SUPERBLOCK_OFFSET			0x2000
 

Index: iso9660.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/iso9660.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- iso9660.c	15 Nov 2005 03:32:36 -0000	1.8
+++ iso9660.c	21 Feb 2006 19:15:17 -0000	1.9
@@ -45,14 +45,14 @@
 	uint8_t		unused[8];
 	uint8_t		space_size[8];
 	uint8_t		escape_sequences[8];
-} __attribute__((__packed__));
+} PACKED;
 
 struct high_sierra_volume_descriptor {
 	uint8_t		foo[8];
 	uint8_t		type;
 	uint8_t		id[4];
 	uint8_t		version;
-} __attribute__((__packed__));
+} PACKED;
 
 int volume_id_probe_iso9660(struct volume_id *id, uint64_t off)
 {

Index: isw_raid.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/isw_raid.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- isw_raid.c	15 Nov 2005 03:32:36 -0000	1.6
+++ isw_raid.c	21 Feb 2006 19:15:17 -0000	1.7
@@ -33,7 +33,7 @@
 	uint32_t	mpb_size;
 	uint32_t	family_num;
 	uint32_t	generation_num;
-} __attribute__((packed));
+} PACKED;
 
 #define ISW_SIGNATURE		"Intel Raid ISM Cfg Sig. "
 

Index: jfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/jfs.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- jfs.c	15 Nov 2005 03:32:36 -0000	1.7
+++ jfs.c	21 Feb 2006 19:15:17 -0000	1.8
@@ -38,7 +38,7 @@
 	uint8_t		uuid[16];
 	uint8_t		label[16];
 	uint8_t		loguuid[16];
-} __attribute__((__packed__));
+} PACKED;
 
 #define JFS_SUPERBLOCK_OFFSET			0x8000
 

Index: linux_raid.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/linux_raid.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- linux_raid.c	15 Nov 2005 03:32:36 -0000	1.8
+++ linux_raid.c	21 Feb 2006 19:15:17 -0000	1.9
@@ -44,7 +44,7 @@
 	uint32_t	set_uuid1;
 	uint32_t	set_uuid2;
 	uint32_t	set_uuid3;
-} __attribute__((packed)) *mdp;
+} PACKED *mdp;
 
 #define MD_RESERVED_BYTES		0x10000
 #define MD_MAGIC			0xa92b4efc

Index: linux_swap.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/linux_swap.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- linux_swap.c	15 Nov 2005 03:32:36 -0000	1.7
+++ linux_swap.c	21 Feb 2006 19:15:17 -0000	1.8
@@ -34,7 +34,7 @@
 	uint32_t	nr_badpages;
 	uint8_t		uuid[16];
 	uint8_t		volume_name[16];
-} __attribute__((__packed__)) *sw;
+} PACKED *sw;
 
 #define LARGEST_PAGESIZE			0x4000
 

Index: lsi_raid.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/lsi_raid.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- lsi_raid.c	15 Nov 2005 03:32:36 -0000	1.5
+++ lsi_raid.c	21 Feb 2006 19:15:17 -0000	1.6
@@ -29,7 +29,7 @@
 
 struct lsi_meta {
 	uint8_t		sig[6];
-} __attribute__((packed));
+} PACKED;
 
 #define LSI_SIGNATURE		"$XIDE$"
 

Index: lvm.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/lvm.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- lvm.c	15 Nov 2005 03:32:36 -0000	1.8
+++ lvm.c	21 Feb 2006 19:15:17 -0000	1.9
@@ -29,7 +29,7 @@
 
 struct lvm1_super_block {
 	uint8_t	id[2];
-} __attribute__((packed));
+} PACKED;
 
 struct lvm2_super_block {
 	uint8_t		id[8];
@@ -37,7 +37,7 @@
 	uint32_t	crc_xl;
 	uint32_t	offset_xl;
 	uint8_t		type[8];
-} __attribute__((packed));
+} PACKED;
 
 #define LVM1_SB_OFF			0x400
 #define LVM1_MAGIC			"HM"

Index: mac.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/mac.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- mac.c	15 Nov 2005 03:32:36 -0000	1.8
+++ mac.c	21 Feb 2006 19:15:17 -0000	1.9
@@ -31,7 +31,7 @@
 	uint8_t		signature[2];
 	uint16_t	block_size;
 	uint32_t	block_count;
-} __attribute__((__packed__));
+} PACKED;
 
 struct mac_partition {
 	uint8_t		signature[2];
@@ -41,7 +41,7 @@
 	uint32_t	block_count;
 	uint8_t		name[32];
 	uint8_t		type[32];
-} __attribute__((__packed__));
+} PACKED;
 
 int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off)
 {
@@ -84,14 +84,15 @@
 
 		part_count = be32_to_cpu(part->map_count);
 		dbg("expecting %d partition entries", part_count);
+		if (part_count < 1 || part_count > 256)
+			return -1;
 
 		if (id->partitions != NULL)
 			free(id->partitions);
-		id->partitions =
-			malloc(part_count * sizeof(struct volume_id_partition));
+		id->partitions = malloc(part_count * sizeof(struct volume_id_partition));
 		if (id->partitions == NULL)
 			return -1;
-		memset(id->partitions, 0x00, sizeof(struct volume_id_partition));
+		memset(id->partitions, 0x00, part_count * sizeof(struct volume_id_partition));
 
 		id->partition_count = part_count;
 

Index: minix.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/minix.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- minix.c	15 Nov 2005 03:32:36 -0000	1.5
+++ minix.c	21 Feb 2006 19:15:17 -0000	1.6
@@ -39,7 +39,7 @@
 	uint16_t	s_magic;
 	uint16_t	s_state;
 	uint32_t	s_zones;
-} __attribute__((__packed__));
+} PACKED;
 
 #define MINIX_SUPERBLOCK_OFFSET			0x400
 

Index: msdos.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/msdos.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- msdos.c	15 Nov 2005 03:32:36 -0000	1.7
+++ msdos.c	21 Feb 2006 19:15:17 -0000	1.8
@@ -38,7 +38,7 @@
 	uint8_t		end_cyl;
 	uint32_t	start_sect;
 	uint32_t	nr_sects;
-} __attribute__((packed));
+} PACKED;
 
 #define MSDOS_MAGIC			"\x55\xaa"
 #define MSDOS_PARTTABLE_OFFSET		0x1be

Index: ntfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/ntfs.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- ntfs.c	15 Nov 2005 03:32:36 -0000	1.8
+++ ntfs.c	21 Feb 2006 19:15:17 -0000	1.9
@@ -52,7 +52,7 @@
 	uint8_t		reserved2[3];
 	uint8_t		volume_serial[8];
 	uint16_t	checksum;
-} __attribute__((__packed__)) *ns;
+} PACKED *ns;
 
 struct master_file_table_record {
 	uint8_t		magic[4];
@@ -65,7 +65,7 @@
 	uint16_t	flags;
 	uint32_t	bytes_in_use;
 	uint32_t	bytes_allocated;
-} __attribute__((__packed__)) *mftr;
+} PACKED *mftr;
 
 struct file_attribute {
 	uint32_t	type;
@@ -77,13 +77,13 @@
 	uint16_t	instance;
 	uint32_t	value_len;
 	uint16_t	value_offset;
-} __attribute__((__packed__)) *attr;
+} PACKED *attr;
 
 struct volume_info {
 	uint64_t	reserved;
 	uint8_t		major_ver;
 	uint8_t		minor_ver;
-} __attribute__((__packed__)) *info;
+} PACKED *info;
 
 #define MFT_RECORD_VOLUME			3
 #define MFT_RECORD_ATTR_VOLUME_NAME		0x60

Index: nvidia_raid.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/nvidia_raid.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- nvidia_raid.c	15 Nov 2005 03:32:36 -0000	1.5
+++ nvidia_raid.c	21 Feb 2006 19:15:17 -0000	1.6
@@ -32,7 +32,7 @@
 	uint32_t	size;
 	uint32_t	chksum;
 	uint16_t	version;
-} __attribute__((packed));
+} PACKED;
 
 #define NVIDIA_SIGNATURE		"NVIDIA"
 

Index: ocfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/ocfs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ocfs.c	15 Nov 2005 03:32:36 -0000	1.2
+++ ocfs.c	21 Feb 2006 19:15:17 -0000	1.3
@@ -56,7 +56,7 @@
 	uint64_t	new_cfg_off;
 	uint32_t	prot_bits;
 	int32_t		excl_mount;
-} __attribute__((__packed__));
+} PACKED;
 
 struct ocfs1_super_block_label {
 	struct ocfs1_disk_lock {
@@ -69,14 +69,14 @@
 		uint32_t	reader_node_num;
 		uint64_t	oin_node_map;
 		uint64_t	dlock_seq_num;
-	} disk_lock __attribute__((__packed__));
+	} PACKED disk_lock;
 	uint8_t		label[64];
 	uint16_t	label_len;
 	uint8_t		vol_id[16];
 	uint16_t	vol_id_len;
 	uint8_t		cluster_name[64];
 	uint16_t	cluster_name_len;
-} __attribute__((__packed__));
+} PACKED;
 
 struct ocfs2_super_block {
 	uint8_t		i_signature[8];
@@ -125,7 +125,7 @@
 	uint64_t	s_first_cluster_group;
 	uint8_t		s_label[64];
 	uint8_t		s_uuid[16];
-} __attribute__((__packed__));
+} PACKED;
 
 int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off)
 {

Index: promise_raid.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/promise_raid.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- promise_raid.c	15 Nov 2005 03:32:36 -0000	1.5
+++ promise_raid.c	21 Feb 2006 19:15:17 -0000	1.6
@@ -29,7 +29,7 @@
 
 struct promise_meta {
 	uint8_t	sig[24];
-} __attribute__((packed));
+} PACKED;
 
 #define PDC_CONFIG_OFF		0x1200
 #define PDC_SIGNATURE		"Promise Technology, Inc."

Index: reiserfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/reiserfs.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- reiserfs.c	15 Nov 2005 03:32:36 -0000	1.9
+++ reiserfs.c	21 Feb 2006 19:15:17 -0000	1.10
@@ -42,7 +42,7 @@
 	uint32_t	dummy4[5];
 	uint8_t		uuid[16];
 	uint8_t		label[16];
-} __attribute__((__packed__));
+} PACKED;
 
 struct reiser4_super_block {
 	uint8_t		magic[16];
@@ -50,7 +50,7 @@
 	uint8_t		uuid[16];
 	uint8_t		label[16];
 	uint64_t	dummy2;
-} __attribute__((__packed__));
+} PACKED;
 
 #define REISERFS1_SUPERBLOCK_OFFSET		0x2000
 #define REISERFS_SUPERBLOCK_OFFSET		0x10000

Index: romfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/romfs.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- romfs.c	15 Nov 2005 03:32:36 -0000	1.7
+++ romfs.c	21 Feb 2006 19:15:17 -0000	1.8
@@ -32,7 +32,7 @@
 	uint32_t size;
 	uint32_t checksum;
 	uint8_t name[0];
-} __attribute__((__packed__));
+} PACKED;
 
 int volume_id_probe_romfs(struct volume_id *id, uint64_t off)
 {

Index: silicon_raid.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/silicon_raid.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- silicon_raid.c	15 Nov 2005 03:32:36 -0000	1.5
+++ silicon_raid.c	21 Feb 2006 19:15:17 -0000	1.6
@@ -44,7 +44,7 @@
 	uint16_t	vendor_id;
 	uint16_t	minor_ver;
 	uint16_t	major_ver;
-} __attribute__((packed));
+} PACKED;
 
 #define SILICON_MAGIC		0x2F000000
 

Index: sysv.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/sysv.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- sysv.c	15 Nov 2005 03:32:36 -0000	1.7
+++ sysv.c	21 Feb 2006 19:15:17 -0000	1.8
@@ -56,7 +56,7 @@
 	uint32_t	s_state;
 	uint32_t	s_magic;
 	uint32_t	s_type;
-} __attribute__((__packed__));
+} PACKED;
 
 #define XENIX_NICINOD				100
 #define XENIX_NICFREE				100
@@ -82,7 +82,7 @@
 	uint8_t		s_fill[371];
 	uint32_t	s_magic;
 	uint32_t	s_type;
-} __attribute__((__packed__));
+} PACKED;
 
 #define SYSV_SUPERBLOCK_BLOCK			0x01
 #define SYSV_MAGIC				0xfd187e20

Index: udf.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/udf.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- udf.c	15 Nov 2005 03:32:36 -0000	1.7
+++ udf.c	21 Feb 2006 19:15:17 -0000	1.8
@@ -37,28 +37,28 @@
 		uint16_t	crc;
 		uint16_t	crc_len;
 		uint32_t	location;
-	} __attribute__((__packed__)) tag;
+	} PACKED tag;
 	union {
 		struct anchor_descriptor {
 			uint32_t	length;
 			uint32_t	location;
-		} __attribute__((__packed__)) anchor;
+		} PACKED anchor;
 		struct primary_descriptor {
 			uint32_t	seq_num;
 			uint32_t	desc_num;
 			struct dstring {
 				uint8_t	clen;
 				uint8_t	c[31];
-			} __attribute__((__packed__)) ident;
-		} __attribute__((__packed__)) primary;
-	} __attribute__((__packed__)) type;
-} __attribute__((__packed__));
+			} PACKED ident;
+		} PACKED primary;
+	} PACKED type;
+} PACKED;
 
 struct volume_structure_descriptor {
 	uint8_t		type;
 	uint8_t		id[5];
 	uint8_t		version;
-} __attribute__((__packed__));
+} PACKED;
 
 #define UDF_VSD_OFFSET			0x8000
 

Index: ufs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/ufs.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- ufs.c	15 Nov 2005 03:32:36 -0000	1.7
+++ ufs.c	21 Feb 2006 19:15:17 -0000	1.8
@@ -80,7 +80,7 @@
 		uint32_t	cs_nbfree;
 		uint32_t	cs_nifree;
 		uint32_t	cs_nffree;
-	} __attribute__((__packed__)) fs_cstotal;
+	} PACKED fs_cstotal;
 	int8_t		fs_fmod;
 	int8_t		fs_clean;
 	int8_t		fs_ronly;
@@ -93,7 +93,7 @@
 			uint32_t	fs_maxcluster;
 			uint32_t	fs_cpc;
 			uint16_t	fs_opostbl[16][8];
-		} __attribute__((__packed__)) fs_u1;
+		} PACKED fs_u1;
 		struct {
 			int8_t		fs_fsmnt[468];
 			uint8_t		fs_volname[32];
@@ -116,17 +116,17 @@
 				uint64_t	cs_nffree;
 				uint64_t	cs_numclusters;
 				uint64_t	cs_spare[3];
-			} __attribute__((__packed__)) fs_cstotal;
+			} PACKED fs_cstotal;
 			struct ufs_timeval {
 				int32_t		tv_sec;
 				int32_t		tv_usec;
-			} __attribute__((__packed__)) fs_time;
+			} PACKED fs_time;
 			int64_t		fs_size;
 			int64_t		fs_dsize;
 			uint64_t	fs_csaddr;
 			int64_t		fs_pendingblocks;
 			int32_t		fs_pendinginodes;
-		} __attribute__((__packed__)) fs_u2;
+		} PACKED fs_u2;
 	}  fs_u11;
 	union {
 		struct {
@@ -136,7 +136,7 @@
 			int32_t		fs_state;
 			uint32_t	fs_qbmask[2];
 			uint32_t	fs_qfmask[2];
-		} __attribute__((__packed__)) fs_sun;
+		} PACKED fs_sun;
 		struct {
 			int32_t		fs_sparecon[53];
 			int32_t		fs_reclaim;
@@ -144,7 +144,7 @@
 			uint32_t	fs_npsect;
 			uint32_t	fs_qbmask[2];
 			uint32_t	fs_qfmask[2];
-		} __attribute__((__packed__)) fs_sunx86;
+		} PACKED fs_sunx86;
 		struct {
 			int32_t		fs_sparecon[50];
 			int32_t		fs_contigsumsize;
@@ -154,7 +154,7 @@
 			uint32_t	fs_qbmask[2];
 			uint32_t	fs_qfmask[2];
 			int32_t		fs_state;
-		} __attribute__((__packed__)) fs_44;
+		} PACKED fs_44;
 	} fs_u2;
 	int32_t		fs_postblformat;
 	int32_t		fs_nrpos;
@@ -162,7 +162,7 @@
 	int32_t		fs_rotbloff;
 	uint32_t	fs_magic;
 	uint8_t		fs_space[1];
-} __attribute__((__packed__));
+} PACKED;
 
 #define UFS_MAGIC			0x00011954
 #define UFS2_MAGIC			0x19540119

Index: via_raid.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/via_raid.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- via_raid.c	15 Nov 2005 03:32:36 -0000	1.5
+++ via_raid.c	21 Feb 2006 19:15:17 -0000	1.6
@@ -36,10 +36,10 @@
 		uint32_t	capacity_low;
 		uint32_t	capacity_high;
 		uint32_t	serial_checksum;
-	} __attribute((packed)) array;
+	} PACKED array;
 	uint32_t	serial_checksum[8];
 	uint8_t		checksum;
-} __attribute__((packed));
+} PACKED;
 
 #define VIA_SIGNATURE		0xAA55
 

Index: volume_id.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/volume_id.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- volume_id.c	15 Nov 2005 03:32:36 -0000	1.13
+++ volume_id.c	21 Feb 2006 19:15:17 -0000	1.14
@@ -31,7 +31,7 @@
 #include "util.h"
 
 
-int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size)
+int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size)
 {
 	if (id == NULL)
 		return -EINVAL;
@@ -39,113 +39,138 @@
 	/* probe for raid first, cause fs probes may be successful on raid members */
 	if (size) {
 		if (volume_id_probe_linux_raid(id, off, size) == 0)
-			goto exit;
+			goto found;
 
 		if (volume_id_probe_intel_software_raid(id, off, size) == 0)
-			goto exit;
+			goto found;
 
 		if (volume_id_probe_lsi_mega_raid(id, off, size) == 0)
-			goto exit;
+			goto found;
 
 		if (volume_id_probe_via_raid(id, off, size) == 0)
-			goto exit;
+			goto found;
 
 		if (volume_id_probe_silicon_medley_raid(id, off, size) == 0)
-			goto exit;
+			goto found;
 
 		if (volume_id_probe_nvidia_raid(id, off, size) == 0)
-			goto exit;
+			goto found;
 
 		if (volume_id_probe_promise_fasttrack_raid(id, off, size) == 0)
-			goto exit;
+			goto found;
 
 		if (volume_id_probe_highpoint_45x_raid(id, off, size) == 0)
-			goto exit;
+			goto found;
 	}
 
 	if (volume_id_probe_lvm1(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_lvm2(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_highpoint_37x_raid(id, off) == 0)
-		goto exit;
+		goto found;
+
+	return -1;
+
+found:
+	/* If recognized, we free the allocated buffers */
+	volume_id_free_buffer(id);
+	return 0;
+}
+
+int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	if (id == NULL)
+		return -EINVAL;
 
 	if (volume_id_probe_luks(id, off) == 0)
-		goto exit;
+		goto found;
 
 	/* signature in the first block, only small buffer needed */
 	if (volume_id_probe_vfat(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_xfs(id, off) == 0)
-		goto exit;
+		goto found;
 
 	/* fill buffer with maximum */
 	volume_id_get_buffer(id, 0, SB_BUFFER_SIZE);
 
 	if (volume_id_probe_linux_swap(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_ext(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_reiserfs(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_jfs(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_udf(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_iso9660(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_hfs_hfsplus(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_ufs(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_ntfs(id, off)  == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_cramfs(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_romfs(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_hpfs(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_sysv(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_minix(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_ocfs1(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_ocfs2(id, off) == 0)
-		goto exit;
+		goto found;
 
 	if (volume_id_probe_vxfs(id, off) == 0)
-		goto exit;
+		goto found;
 
 	return -1;
 
-exit:
-	/* If the filestystem in recognized, we free the allocated buffers,
-	   otherwise they will stay in place for the possible next probe call */
+found:
+	/* If recognized, we free the allocated buffers */
 	volume_id_free_buffer(id);
-
 	return 0;
 }
 
+int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size)
+{
+	if (id == NULL)
+		return -EINVAL;
+
+	if (volume_id_probe_raid(id, off, size) == 0)
+		return 0;
+
+	if (volume_id_probe_filesystem(id, off, size) == 0)
+		return 0;
+
+	return -1;
+}
+
 /* open volume by already open file descriptor */
 struct volume_id *volume_id_open_fd(int fd)
 {

Index: volume_id.h
===================================================================
RCS file: /cvs/hal/hal/volume_id/volume_id.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- volume_id.h	21 Nov 2005 17:55:13 -0000	1.13
+++ volume_id.h	21 Feb 2006 19:15:17 -0000	1.14
@@ -14,7 +14,11 @@
 #include <stdint.h>
 #include <stddef.h>
 
-#define VOLUME_ID_VERSION		55
+#define VOLUME_ID_VERSION		58
+
+#ifndef PACKED
+#define PACKED				__attribute__((packed))
+#endif
 
 #define VOLUME_ID_LABEL_SIZE		64
 #define VOLUME_ID_UUID_SIZE		36
@@ -69,6 +73,8 @@
 extern struct volume_id *volume_id_open_fd(int fd);
 extern struct volume_id *volume_id_open_node(const char *path);
 extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size);
+extern int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size);
 extern void volume_id_close(struct volume_id *id);
 
 /* filesystems */

Index: vxfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/vxfs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- vxfs.c	15 Nov 2005 03:32:36 -0000	1.2
+++ vxfs.c	21 Feb 2006 19:15:17 -0000	1.3
@@ -32,7 +32,7 @@
 struct vxfs_super {
 	uint32_t		vs_magic;
 	int32_t			vs_version;
-} __attribute__((__packed__));
+} PACKED;
 
 int volume_id_probe_vxfs(struct volume_id *id, uint64_t off)
 {

Index: xfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/xfs.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- xfs.c	15 Nov 2005 03:32:36 -0000	1.7
+++ xfs.c	21 Feb 2006 19:15:17 -0000	1.8
@@ -40,7 +40,7 @@
 	uint64_t	icount;
 	uint64_t	ifree;
 	uint64_t	fdblocks;
-} __attribute__((__packed__));
+} PACKED;
 
 int volume_id_probe_xfs(struct volume_id *id, uint64_t off)
 {




More information about the hal-commit mailing list