Reiser4 support in volume_id
PATCH 1/1 Reiser4 support in volume_id
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
extras/volume_id/volume_id/reiserfs/reiserfs.c +23 -0
@@ -2,6 +2,7 @@* volume_id - reads filesystem label and uuid * * Copyright (C) 2004 Kay Sievers <[email protected]> +* Copyright (C) 2005 Tobias Klauser <[email protected]> * * 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 0x10000int 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 10 lines · Tobias Klauser
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_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel