linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tobias Klauser <tklauser@access.unizh.ch>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH] Reiser4 support in volume_id
Date: Tue, 22 Feb 2005 14:01:46 +0000	[thread overview]
Message-ID: <20050222140145.GA1078@neon> (raw)

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

             reply	other threads:[~2005-02-22 14:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-22 14:01 Tobias Klauser [this message]
2005-02-22 19:43 ` [PATCH] Reiser4 support in volume_id Kay Sievers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050222140145.GA1078@neon \
    --to=tklauser@access.unizh.ch \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).