hal/hald/linux/volume_id volume_id.c, 1.43, 1.44 volume_id.h, 1.22, 1.23

Kay Sievers kay at freedesktop.org
Sun Oct 24 19:57:29 PDT 2004


Update of /cvs/hal/hal/hald/linux/volume_id
In directory gabe:/tmp/cvs-serv10552/hald/linux/volume_id

Modified Files:
	volume_id.c volume_id.h 
Log Message:
2004-10-25  Kay Sievers  <kay.sievers at vrfy.org>

        * hald/linux/volume_id/volume_id.c: (probe_highpoint_ataraid),
        (volume_id_probe), (volume_id_open_node): Add recognition for
        highpoint ataraid volumes.



Index: volume_id.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/volume_id/volume_id.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- volume_id.c	15 Oct 2004 20:39:51 -0000	1.43
+++ volume_id.c	25 Oct 2004 02:57:27 -0000	1.44
@@ -263,6 +263,36 @@
 	}
 }
 
+#define HPT37X_CONFIG_OFF		0x1200
+#define HPT37X_MAGIC_OK			0x5a7816f0
+#define HPT37X_MAGIC_BAD		0x5a7816fd
+static int probe_highpoint_ataraid(struct volume_id *id, __u64 off)
+{
+	struct hpt37x {
+		__u8	filler1[32];
+		__u32	magic;
+		__u32	magic_0;
+		__u32	magic_1;
+	} __attribute__((packed)) *hpt;
+
+	const __u8 *buf;
+
+	buf = get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200);
+	if (buf == NULL)
+		return -1;
+
+	hpt = (struct hpt37x *) buf;
+
+	if (hpt->magic != HPT37X_MAGIC_OK && hpt->magic != HPT37X_MAGIC_BAD)
+		return -1;
+
+	id->usage_id = VOLUME_ID_RAID;
+	id->type_id = VOLUME_ID_HPTRAID;
+	id->type = "hpt_ataraid_member";
+
+	return 0;
+}
+
 #define LVM1_SB_OFF			0x400
 #define LVM1_MAGIC			"HM"
 static int probe_lvm1(struct volume_id *id, __u64 off)
@@ -2038,6 +2068,9 @@
 	case VOLUME_ID_LVM2:
 		rc = probe_lvm2(id, off);
 		break;
+	case VOLUME_ID_HPTRAID:
+		rc = probe_highpoint_ataraid(id, off);
+		break;
 	case VOLUME_ID_ALL:
 	default:
 		/* probe for raid first, cause fs probes may be successful on raid members */
@@ -2050,6 +2083,9 @@
 		rc = probe_lvm2(id, off);
 		if (rc == 0)
 			break;
+		rc = probe_highpoint_ataraid(id, off);
+		if (rc == 0)
+			break;
 
 		/* signature in the first block, only small buffer needed */
 		rc = probe_msdos_part_table(id, off);
@@ -2128,7 +2164,7 @@
 	struct volume_id *id;
 	int fd;
 
-	fd = open(path, O_RDONLY /*| O_NONBLOCK */);
+	fd = open(path, O_RDONLY);
 	if (fd < 0) {
 		dbg("unable to open '%s'", path);
 		return NULL;

Index: volume_id.h
===================================================================
RCS file: /cvs/hal/hal/hald/linux/volume_id/volume_id.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- volume_id.h	20 Sep 2004 14:35:51 -0000	1.22
+++ volume_id.h	25 Oct 2004 02:57:27 -0000	1.23
@@ -21,7 +21,7 @@
 #ifndef _VOLUME_ID_H_
 #define _VOLUME_ID_H_
 
-#define VOLUME_ID_VERSION		25
+#define VOLUME_ID_VERSION		26
 
 #define VOLUME_ID_LABEL_SIZE		64
 #define VOLUME_ID_UUID_SIZE		16
@@ -36,7 +36,7 @@
 	VOLUME_ID_OTHER,
 	VOLUME_ID_FILESYSTEM,
 	VOLUME_ID_PARTITIONTABLE,
-	VOLUME_ID_RAID
+	VOLUME_ID_RAID,
 };
 
 enum volume_id_type {
@@ -59,7 +59,8 @@
 	VOLUME_ID_UFS,
 	VOLUME_ID_LINUX_RAID,
 	VOLUME_ID_LVM1,
-	VOLUME_ID_LVM2
+	VOLUME_ID_LVM2,
+	VOLUME_ID_HPTRAID,
 };
 
 struct volume_id_partition {




More information about the hal-commit mailing list