Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 121963 Details for
Bug 181685
=sys-apps/mkinitrd-6.0.93 has been released
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
files/mkinitrd-nash-reiserfs-label.patch
mkinitrd-nash-reiserfs-label.patch (text/plain), 5.00 KB, created by
Sergey Belyashov
on 2007-06-13 20:24:39 UTC
(
hide
)
Description:
files/mkinitrd-nash-reiserfs-label.patch
Filename:
MIME Type:
Creator:
Sergey Belyashov
Created:
2007-06-13 20:24:39 UTC
Size:
5.00 KB
patch
obsolete
>diff -ruN mkinitrd-4.2.1.10.diet/nash/linux_fs.h mkinitrd-4.2.1.10/nash/linux_fs.h >--- mkinitrd-4.2.1.10.diet/nash/linux_fs.h 2002-01-14 04:40:14.000000000 +0300 >+++ mkinitrd-4.2.1.10/nash/linux_fs.h 2007-06-13 23:04:06.000000000 +0400 >@@ -80,10 +80,19 @@ > unsigned char s_oid_maxsize[2]; > unsigned char s_oid_cursize[2]; > unsigned char s_state[2]; >- unsigned char s_magic[12]; >+ unsigned char s_magic[10]; >+ unsigned char s_dummy1[10]; >+ unsigned char s_version[2]; /* only valid with relocated journal */ >+ >+ /* only valid in 3.6.x format --mason@suse.com */ >+ unsigned char s_dummy2[10]; >+ unsigned char s_uuid[16]; >+ unsigned char s_label[16]; > }; > #define REISERFS_SUPER_MAGIC_STRING "ReIsErFs" > #define REISER2FS_SUPER_MAGIC_STRING "ReIsEr2Fs" >+/* also known as REISER2FS_JR_SUPER_MAGIC_STRING */ >+#define REISER3FS_SUPER_MAGIC_STRING "ReIsEr3Fs" > #define REISERFS_DISK_OFFSET_IN_BYTES (64 * 1024) > /* the spot for the super in versions 3.5 - 3.5.10 (inclusive) */ > #define REISERFS_OLD_DISK_OFFSET_IN_BYTES (8 * 1024) >diff -ruN mkinitrd-4.2.1.10.diet/nash/mount_by_label.c mkinitrd-4.2.1.10/nash/mount_by_label.c >--- mkinitrd-4.2.1.10.diet/nash/mount_by_label.c 2007-06-13 23:02:17.000000000 +0400 >+++ mkinitrd-4.2.1.10/nash/mount_by_label.c 2007-06-13 23:04:06.000000000 +0400 >@@ -37,39 +37,103 @@ > int major, minor; > } *uuidCache = NULL; > >-/* for now, only ext2, ext3 and xfs are supported */ >-static int >-get_label_uuid(const char *device, char **label, char *uuid) { >+typedef int (*GetLabelUuidProc)(int fd, char **label, char *uuid); > >- /* start with ext2/3 and xfs tests, taken from mount_guess_fstype */ >- /* should merge these later */ >- int fd; >- int rv = 1; >- size_t namesize; >+static int get_label_uuid_ext2(int fd, char **label, char *uuid); >+static int get_label_uuid_xfs(int fd, char **label, char *uuid); >+static int get_label_uuid_reiserfs(int fd, char **label, char *uuid); >+ >+/* for now, only ext2, ext3, reiserfs and xfs are supported */ >+static const >+GetLabelUuidProc get_label_uuid_proc_table[] = >+{ >+ get_label_uuid_ext2, >+ get_label_uuid_reiserfs, >+ get_label_uuid_xfs, >+ NULL >+}; >+ >+static int >+get_label_uuid_ext2(int fd, char **label, char *uuid) >+{ > struct ext2_super_block e2sb; >- struct xfs_super_block xfsb; >- >- fd = open(device, O_RDONLY); >- if (fd < 0) >- return rv; >- >- if (lseek(fd, 1024, SEEK_SET) == 1024 >- && read(fd, (char *) &e2sb, sizeof(e2sb)) == sizeof(e2sb) >- && (ext2magic(e2sb) == EXT2_SUPER_MAGIC)) { >+ if ( ( lseek(fd, 1024, SEEK_SET) == 1024 ) >+ && read(fd, (char *) &e2sb, sizeof(e2sb)) == sizeof(e2sb) >+ && (ext2magic(e2sb) == EXT2_SUPER_MAGIC)) { >+ size_t namesize; > memcpy(uuid, e2sb.s_uuid, sizeof(e2sb.s_uuid)); > namesize = sizeof(e2sb.s_volume_name); > if ((*label = calloc(namesize + 1, 1)) != NULL) > memcpy(*label, e2sb.s_volume_name, namesize); >- rv = 0; >+ return 0; > } >- else if (lseek(fd, 0, SEEK_SET) == 0 >- && read(fd, (char *) &xfsb, sizeof(xfsb)) == sizeof(xfsb) >- && (strncmp((const char*)xfsb.s_magic, XFS_SUPER_MAGIC, 4) == 0)) { >+ return 1; >+} >+ >+static int >+get_label_uuid_xfs(int fd, char **label, char *uuid) >+{ >+ struct xfs_super_block xfsb; >+ if ( (lseek(fd, 0, SEEK_SET) == 0) >+ && (read(fd, (char *) &xfsb, sizeof(xfsb)) == sizeof(xfsb) ) >+ && (strncmp((const char*)xfsb.s_magic, XFS_SUPER_MAGIC, 4) == 0) ) { >+ size_t namesize; > memcpy(uuid, xfsb.s_uuid, sizeof(xfsb.s_uuid)); > namesize = sizeof(xfsb.s_fname); > if ((*label = calloc(namesize + 1, 1)) != NULL) > memcpy(*label, xfsb.s_fname, namesize); >- rv = 0; >+ return 0; >+ } >+ return 1; >+} >+ >+static inline int reiserfs_magic_version(const char *magic) >+{ >+ int rc = 0; >+ if ( !strncmp(magic, REISERFS_SUPER_MAGIC_STRING, strlen(REISERFS_SUPER_MAGIC_STRING)) ) >+ rc = 1; >+ if ( !strncmp(magic, REISER2FS_SUPER_MAGIC_STRING, strlen(REISER2FS_SUPER_MAGIC_STRING)) ) >+ rc = 2; >+ if ( !strncmp(magic, REISER3FS_SUPER_MAGIC_STRING, strlen(REISER3FS_SUPER_MAGIC_STRING)) ) >+ rc = 3; >+ return rc; >+} >+ >+static int >+get_label_uuid_reiserfs(int fd, char **label, char *uuid) >+{ >+ struct reiserfs_super_block reiserfssb; >+ if ( (lseek(fd, REISERFS_DISK_OFFSET_IN_BYTES, SEEK_SET) == REISERFS_DISK_OFFSET_IN_BYTES) >+ && ( read(fd, (char *) &reiserfssb, sizeof(reiserfssb)) == sizeof(reiserfssb) ) >+ /* Only 3.6.x format supers have labels or uuids. >+ Label and UUID can be set by reiserfstune -l/-u. */ >+ && (reiserfs_magic_version((const char*)reiserfssb.s_magic) > 1) ) { >+ size_t namesize; >+ memcpy(uuid, reiserfssb.s_uuid, sizeof(reiserfssb.s_uuid)); >+ namesize = sizeof(reiserfssb.s_label); >+ if ((*label = calloc(namesize + 1, 1)) != NULL) >+ memcpy(*label, reiserfssb.s_label, namesize); >+ return 0; >+ } >+ return 1; >+} >+ >+static int >+get_label_uuid(const char *device, char **label, char *uuid) >+{ >+ int fd; >+ int rv = 1; >+ const GetLabelUuidProc *proc = get_label_uuid_proc_table; >+ >+ fd = open(device, O_RDONLY); >+ if (fd < 0) >+ return rv; >+ >+ while(*proc) { >+ rv = (*proc)(fd, label, uuid); >+ if ( !rv ) >+ break; >+ ++proc; > } > > close(fd);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 181685
:
121754
|
121755
|
121756
|
121758
|
121766
|
121960
|
121961
| 121963 |
121965
|
212529
|
212530
|
212734
|
212736
|
212737