hal/volume_id logging.h, 1.2, 1.3 luks.c, 1.1, 1.2 luks.h, 1.1, 1.2 reiserfs.c, 1.2, 1.3 volume_id.c, 1.3, 1.4 volume_id.h, 1.4, 1.5

Kay Sievers kay at freedesktop.org
Fri Feb 25 09:21:50 PST 2005


Update of /cvs/hal/hal/volume_id
In directory gabe:/tmp/cvs-serv23156/volume_id

Modified Files:
	logging.h luks.c luks.h reiserfs.c volume_id.c volume_id.h 
Log Message:
2005-02-25  Kay Sievers  <kay.sievers at vrfy.org>

        * volume_id/logging.h: Move HAL specific logging to this file.

        * volume_id/luks.c: (volume_id_probe_luks): Remove unused stuff.

        * volume_id/luks.h: Fix typo and copyright.

        * volume_id/reiserfs.c: (volume_id_probe_reiserfs): Support reiser4.

        * volume_id/volume_id.c: Include luks.h.

        * volume_id/volume_id.h: Version 36. Remove HAL specific logging.



Index: logging.h
===================================================================
RCS file: /cvs/hal/hal/volume_id/logging.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- logging.h	16 Feb 2005 22:25:20 -0000	1.2
+++ logging.h	25 Feb 2005 17:21:48 -0000	1.3
@@ -15,6 +15,11 @@
 #include <config.h>
 #endif
 
+/* User of this library is supposed to export the volume_id_log symbol
+ * if sources are built with -DDEBUG
+ */
+extern void volume_id_log (const char *format, ...);
+
 #ifdef DEBUG
 #define dbg(format, arg...)							\
 	do {									\

Index: luks.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/luks.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- luks.c	16 Feb 2005 22:25:20 -0000	1.1
+++ luks.c	25 Feb 2005 17:21:48 -0000	1.2
@@ -40,10 +40,6 @@
 #include "logging.h"
 #include "luks.h"
 
-/* FIXME: this contains a lot of copy and pasted code.  One alternative
- * would be to fork/exec cryptsetup isLuks and cryptsetup luksUUID.  Another
- * would be to write a LUKS library */
-
 /* from cryptsetup-luks internal.h */
 #define SECTOR_SHIFT            9
 #define SECTOR_SIZE             (1 << SECTOR_SHIFT)
@@ -68,8 +64,6 @@
 
 int volume_id_probe_luks(struct volume_id *id, __u64 off)
 {
-	int i;
-
 	/* from cryptsetup-luks luks.h */
 	struct luks_phdr {
 		char            magic[LUKS_MAGIC_L];
@@ -83,7 +77,6 @@
 		char            mkDigestSalt[LUKS_SALTSIZE];
 		uint32_t        mkDigestIterations;
 		char            uuid[UUID_STRING_L];
-
 		struct {
 			uint32_t active;
 

Index: luks.h
===================================================================
RCS file: /cvs/hal/hal/volume_id/luks.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- luks.h	16 Feb 2005 22:25:20 -0000	1.1
+++ luks.h	25 Feb 2005 17:21:48 -0000	1.2
@@ -1,7 +1,7 @@
 /*
  * volume_id - reads filesystem label and uuid
  *
- * Copyright (C) 2004 Kay Sievers <kay.sievers at vrfy.org>
+ * Copyright (C) 2005 W. Michael Petullo <mike at flyn.org>
  *
  *	This library is free software; you can redistribute it and/or
  *	modify it under the terms of the GNU Lesser General Public
@@ -18,8 +18,8 @@
  *	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
-#ifndef _VOLUME_ID_EXT_
-#define _VOLUME_ID_EXT_
+#ifndef _VOLUME_ID_LUKS_
+#define _VOLUME_ID_LUKS_
 
 extern int volume_id_probe_luks(struct volume_id *id, __u64 off);
 

Index: reiserfs.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/reiserfs.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- reiserfs.c	16 Feb 2005 22:40:47 -0000	1.2
+++ reiserfs.c	25 Feb 2005 17:21:48 -0000	1.3
@@ -2,6 +2,7 @@
  * volume_id - reads filesystem label and uuid
  *
  * Copyright (C) 2004 Kay Sievers <kay.sievers at vrfy.org>
+ * Copyright (C) 2005 Tobias Klauser <tklauser at access.unizh.ch>
  *
  *	This library is free software; you can redistribute it and/or
  *	modify it under the terms of the GNU Lesser General Public
@@ -55,26 +56,45 @@
 	__u8	label[16];
 } __attribute__((__packed__));
 
+struct reiser4_super_block {
+	__u8	magic[16];
+	__u16	dummy[2];
+	__u8	uuid[16];
+	__u8	label[16];
+	__u64	dummy2;
+} __attribute__((__packed__));
+
 #define REISERFS1_SUPERBLOCK_OFFSET		0x2000
 #define REISERFS_SUPERBLOCK_OFFSET		0x10000
 
 int volume_id_probe_reiserfs(struct volume_id *id, __u64 off)
 {
 	struct reiserfs_super_block *rs;
+	struct reiser4_super_block *rs4;
+	__u8 *buf;
 
 	dbg("probing at offset %llu", off);
 
-	rs = (struct reiserfs_super_block *) volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200);
-	if (rs == NULL)
+	buf = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200);
+	if (buf == NULL)
 		return -1;
 
+	rs = (struct reiserfs_super_block *) buf;;
 	if (memcmp(rs->magic, "ReIsEr2Fs", 9) == 0) {
 		strcpy(id->type_version, "3.6");
-		goto found;
+		goto found_v3;
 	}
-
 	if (memcmp(rs->magic, "ReIsEr3Fs", 9) == 0) {
 		strcpy(id->type_version, "JR");
+		goto found_v3;
+	}
+
+	rs4 = (struct reiser4_super_block *) buf;
+	if (memcmp(rs4->magic, "ReIsEr4", 7) == 0) {
+		strcpy(id->type_version, "4");
+		volume_id_set_label_raw(id, rs4->label, 16);
+		volume_id_set_label_string(id, rs4->label, 16);
+		volume_id_set_uuid(id, rs4->uuid, UUID_DCE);
 		goto found;
 	}
 
@@ -84,16 +104,17 @@
 
 	if (memcmp(rs->magic, "ReIsErFs", 8) == 0) {
 		strcpy(id->type_version, "3.5");
-		goto found;
+		goto found_v3;
 	}
 
 	return -1;
 
-found:
+found_v3:
 	volume_id_set_label_raw(id, rs->label, 16);
 	volume_id_set_label_string(id, rs->label, 16);
 	volume_id_set_uuid(id, rs->uuid, UUID_DCE);
 
+found:
 	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
 	id->type = "reiserfs";
 

Index: volume_id.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/volume_id.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- volume_id.c	16 Feb 2005 22:40:47 -0000	1.3
+++ volume_id.c	25 Feb 2005 17:21:48 -0000	1.4
@@ -60,6 +60,7 @@
 #include "hpfs.h"
 #include "romfs.h"
 #include "sysv.h"
+#include "luks.h"
 #include "mac.h"
 #include "msdos.h"
 

Index: volume_id.h
===================================================================
RCS file: /cvs/hal/hal/volume_id/volume_id.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- volume_id.h	16 Feb 2005 22:40:47 -0000	1.4
+++ volume_id.h	25 Feb 2005 17:21:48 -0000	1.5
@@ -21,7 +21,7 @@
 #ifndef _VOLUME_ID_H_
 #define _VOLUME_ID_H_
 
-#define VOLUME_ID_VERSION		34
+#define VOLUME_ID_VERSION		36
 
 #define VOLUME_ID_LABEL_SIZE		64
 #define VOLUME_ID_UUID_SIZE		16
@@ -79,9 +79,4 @@
 extern int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned long long size);
 extern void volume_id_close(struct volume_id *id);
 
-/* User of this library is supposed to export the volume_id_log symbol
- * if sources are built with -DDEBUG
- */
-extern void volume_id_log (const char *format, ...);
-
 #endif




More information about the hal-commit mailing list