From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tobias Klauser Date: Tue, 22 Feb 2005 14:01:46 +0000 Subject: [PATCH] Reiser4 support in volume_id Message-Id: <20050222140145.GA1078@neon> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org 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 + * Copyright (C) 2005 Tobias Klauser * * 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_id396&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