linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Reiser4 support in volume_id
@ 2005-02-22 14:01 Tobias Klauser
  2005-02-22 19:43 ` Kay Sievers
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Klauser @ 2005-02-22 14:01 UTC (permalink / raw)
  To: linux-hotplug

Hallo Kay

The following patch adds support for Reiser4 filesystems to volume_id.
I made the patch against the version in udev-053 and tested it here on
my external hardrive as well as on an image-file mounted via loopback
device.

I was not quite sure about the naming of the filesystem. The creators
refer to it as "Reiser4" but my patch refers to it as "T:reiserfs V:4".
If this behaviour should be changed, just let me know.

Thanks, Tobias


diff -urpN udev-053.orig/extras/volume_id/volume_id/reiserfs/reiserfs.c udev-053/extras/volume_id/volume_id/reiserfs/reiserfs.c
--- udev-053.orig/extras/volume_id/volume_id/reiserfs/reiserfs.c	2005-02-21 15:02:31.000000000 +0100
+++ udev-053/extras/volume_id/volume_id/reiserfs/reiserfs.c	2005-02-22 14:09:38.000000000 +0100
@@ -2,6 +2,7 @@
  * volume_id - reads filesystem label and uuid
  *
  * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
+ * Copyright (C) 2005 Tobias Klauser <tklauser@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,12 +56,21 @@ struct reiserfs_super_block {
 	__u8	label[16];
 } __attribute__((__packed__));
 
+struct reiser4_super_block {
+	char	magic[16];
+	__u16	dummy[2];
+	char	uuid[16];
+	char	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;
 
 	dbg("probing at offset %llu", off);
 
@@ -87,6 +97,18 @@ int volume_id_probe_reiserfs(struct volu
 		goto found;
 	}
 
+	rs4 = (struct reiser4_super_block *) volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200);
+	if (rs4 = NULL)
+		return -1;
+
+	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_v4;
+	}
+
 	return -1;
 
 found:
@@ -94,6 +116,7 @@ found:
 	volume_id_set_label_string(id, rs->label, 16);
 	volume_id_set_uuid(id, rs->uuid, UUID_DCE);
 
+found_v4:
 	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
 	id->type = "reiserfs";
 


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Reiser4 support in volume_id
  2005-02-22 14:01 [PATCH] Reiser4 support in volume_id Tobias Klauser
@ 2005-02-22 19:43 ` Kay Sievers
  0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2005-02-22 19:43 UTC (permalink / raw)
  To: linux-hotplug

On Tue, 2005-02-22 at 15:01 +0100, Tobias Klauser wrote:
>Hallo Kay
>
>The following patch adds support for Reiser4 filesystems to volume_id.
>I made the patch against the version in udev-053 and tested it here on
>my external hardrive as well as on an image-file mounted via loopback
>device.
>
>I was not quite sure about the naming of the filesystem. The creators
>refer to it as "Reiser4" but my patch refers to it as "T:reiserfs V:4".
>If this behaviour should be changed, just let me know.

That's fine, very nice. Thanks.

I've applied it to my tree and moved some stuff around in the file, so I
hope it still works. :)

Thanks,
Kay



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-02-22 19:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-22 14:01 [PATCH] Reiser4 support in volume_id Tobias Klauser
2005-02-22 19:43 ` Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).