rpms/util-linux/FC-3 util-linux-2.12a-mount-ocfs2.patch, NONE, 1.1 util-linux.spec, 1.59, 1.60
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Tue Jul 12 12:06:55 UTC 2005
Author: kzak
Update of /cvs/dist/rpms/util-linux/FC-3
In directory cvs.devel.redhat.com:/tmp/cvs-serv30461
Modified Files:
util-linux.spec
Added Files:
util-linux-2.12a-mount-ocfs2.patch
Log Message:
- add support for OCFS2
util-linux-2.12a-mount-ocfs2.patch:
get_label_uuid.c | 25 ++++++++-
linux_fs.h | 14 +++++
mount.c | 140 ++++++++++++++++++++++++++++-----------------------
mount_guess_fstype.c | 20 +++++++
4 files changed, 135 insertions(+), 64 deletions(-)
--- NEW FILE util-linux-2.12a-mount-ocfs2.patch ---
--- util-linux-2.12a/mount/mount.c.ocfs2 2005-07-12 13:42:17.000000000 +0200
+++ util-linux-2.12a/mount/mount.c 2005-07-12 13:54:24.000000000 +0200
@@ -472,6 +472,61 @@
}
/*
+ * check_special_mountprog()
+ * If there is a special mount program for this type, exec it.
+ * returns: 0: no exec was done, 1: exec was done, status has result
+ */
+
+static int
+check_special_mountprog(char *spec, char *node, char *type, int flags,
+ char *extra_opts, int *status) {
+ char mountprog[120];
+ struct stat statbuf;
+ int res;
+
+ if (!external_allowed)
+ return 0;
+
+ if (type && strlen(type) < 100) {
+ sprintf(mountprog, "/sbin/mount.%s", type);
+ if (stat(mountprog, &statbuf) == 0) {
+ res = fork();
+ if (res == 0) {
+ char *oo, *mountargs[10];
+ int i = 0;
+
+ setuid(getuid());
+ setgid(getgid());
+ oo = fix_opts_string (flags, extra_opts, NULL);
+ mountargs[i++] = mountprog;
+ mountargs[i++] = spec;
+ mountargs[i++] = node;
+ if (nomtab)
+ mountargs[i++] = "-n";
+ if (verbose)
+ mountargs[i++] = "-v";
+ if (oo && *oo) {
+ mountargs[i++] = "-o";
+ mountargs[i++] = oo;
+ }
+ mountargs[i] = NULL;
+ execv(mountprog, mountargs);
+ exit(1); /* exec failed */
+ } else if (res != -1) {
+ int st;
+ wait(&st);
+ *status = (WIFEXITED(st) ? WEXITSTATUS(st) : EX_SYSERR);
+ return 1;
+ } else {
+ int errsv = errno;
+ error(_("mount: cannot fork: %s"), strerror(errsv));
+ }
+ }
+ }
+ return 0;
+}
+
+/*
* guess_fstype_and_mount()
* Mount a single file system. Guess the type when unknown.
* returns: 0: OK, -1: error in errno, 1: other error
@@ -480,9 +535,11 @@
*/
static int
guess_fstype_and_mount (char *spec, char *node, char **types,
- int flags, char *mount_opts) {
+ int flags, char *mount_opts, int *special, int *status) {
struct mountargs args = { spec, node, NULL, flags & ~MS_NOSYS, mount_opts };
+ *special = 0;
+
if (*types && strcasecmp (*types, "auto") == 0)
*types = NULL;
@@ -491,10 +548,16 @@
if (!*types && !(flags & MS_REMOUNT)) {
*types = guess_fstype(spec);
- if (*types && !strcmp(*types, "swap")) {
- error(_("%s looks like swapspace - not mounted"), spec);
- *types = NULL;
- return 1;
+ if (*types) {
+ if (!strcmp(*types, "swap")) {
+ error(_("%s looks like swapspace - not mounted"), spec);
+ *types = NULL;
+ return 1;
+ } else if (check_special_mountprog(spec, node, *types, flags,
+ mount_opts, status)) {
+ *special = 1;
+ return 0;
+ }
}
}
@@ -719,61 +782,6 @@
}
/*
- * check_special_mountprog()
- * If there is a special mount program for this type, exec it.
- * returns: 0: no exec was done, 1: exec was done, status has result
- */
-
-static int
-check_special_mountprog(char *spec, char *node, char *type, int flags,
- char *extra_opts, int *status) {
- char mountprog[120];
- struct stat statbuf;
- int res;
-
- if (!external_allowed)
- return 0;
-
- if (type && strlen(type) < 100) {
- sprintf(mountprog, "/sbin/mount.%s", type);
- if (stat(mountprog, &statbuf) == 0) {
- res = fork();
- if (res == 0) {
- char *oo, *mountargs[10];
- int i = 0;
-
- setuid(getuid());
- setgid(getgid());
- oo = fix_opts_string (flags, extra_opts, NULL);
- mountargs[i++] = mountprog;
- mountargs[i++] = spec;
- mountargs[i++] = node;
- if (nomtab)
- mountargs[i++] = "-n";
- if (verbose)
- mountargs[i++] = "-v";
- if (oo && *oo) {
- mountargs[i++] = "-o";
- mountargs[i++] = oo;
- }
- mountargs[i] = NULL;
- execv(mountprog, mountargs);
- exit(1); /* exec failed */
- } else if (res != -1) {
- int st;
- wait(&st);
- *status = (WIFEXITED(st) ? WEXITSTATUS(st) : EX_SYSERR);
- return 1;
- } else {
- int errsv = errno;
- error(_("mount: cannot fork: %s"), strerror(errsv));
- }
- }
- }
- return 0;
-}
-
-/*
* try_mount_one()
* Try to mount one file system. When "bg" is 1, this is a retry
* in the background. One additional exit code EX_BG is used here.
@@ -785,7 +793,7 @@
static int
try_mount_one (const char *spec0, const char *node0, char *types0,
const char *opts0, int freq, int pass, int bg, int ro) {
- int res, status;
+ int res, status, special;
int mnt5_res = 0; /* only for gcc */
int mnt_err;
int flags;
@@ -869,9 +877,15 @@
block_signals (SIG_BLOCK);
nosigblock:
- if (!fake)
+ if (!fake) {
mnt5_res = guess_fstype_and_mount (spec, node, &types, flags & ~MS_NOSYS,
- mount_opts);
+ mount_opts, &special, &status);
+
+ if (special) {
+ block_signals (SIG_UNBLOCK);
+ return status;
+ }
+ }
if (fake || mnt5_res == 0) {
/* Mount succeeded, report this (if verbose) and write mtab entry. */
--- util-linux-2.12a/mount/mount_guess_fstype.c.ocfs2 2004-03-05 01:28:02.000000000 +0100
+++ util-linux-2.12a/mount/mount_guess_fstype.c 2005-07-12 13:47:10.000000000 +0200
@@ -237,6 +237,7 @@
struct fat_super_block fatsb;
struct xfs_super_block xfsb;
struct cramfs_super_block cramfssb;
+ struct ocfs_volume_header ovh;
struct efs_volume_header efsvh;
struct efs_super efssb;
} xsb; /* stuff at 0 */
@@ -257,6 +258,7 @@
struct hpfs_super_block hpfssb;
struct adfs_super_block adfssb;
struct sysv_super_block svsb;
+ struct ocfs2_super_block osb;
struct stat statbuf;
/* opening and reading an arbitrary unknown path can have
@@ -286,6 +288,8 @@
type = "romfs";
else if(!strncmp(xsb.xfsb.s_magic, XFS_SUPER_MAGIC, 4))
type = "xfs";
+ else if(!strncmp(xsb.ovh.signature, OCFS_MAGIC, sizeof(OCFS_MAGIC)))
+ type = "ocfs";
else if(!strncmp(xsb.qnx4fs_magic+4, "QNX4FS", 6))
type = "qnx4";
else if(xsb.bfs_magic == 0x1badface)
@@ -464,6 +468,22 @@
}
if (!type) {
+ int blksize, blkoff;
+
+ for (blksize = OCFS2_MIN_BLOCKSIZE;
+ blksize <= OCFS2_MAX_BLOCKSIZE;
+ blksize <<= 1) {
+ blkoff = blksize * OCFS2_SUPER_BLOCK_BLKNO;
+ if (lseek(fd, blkoff, SEEK_SET) != blkoff
+ || read(fd, (char *) &osb, sizeof(osb)) != sizeof(osb))
+ goto io_error;
+ if (strncmp(osb.signature, OCFS2_SUPER_BLOCK_SIGNATURE,
+ sizeof(OCFS2_SUPER_BLOCK_SIGNATURE)) == 0)
+ type = "ocfs2";
+ }
+ }
+
+ if (!type) {
/* perhaps the user tries to mount the swap space
on a new disk; warn her before she does mke2fs on it */
int pagesize = getpagesize();
--- util-linux-2.12a/mount/linux_fs.h.ocfs2 2005-07-12 13:42:17.000000000 +0200
+++ util-linux-2.12a/mount/linux_fs.h 2005-07-12 13:47:10.000000000 +0200
@@ -227,6 +227,20 @@
#define ocfslabellen(o) assemble2le(o.label_len)
#define OCFS_MAGIC "OracleCFS"
+struct ocfs2_super_block {
+ u_char signature[8];
+ u_char s_dummy1[184];
+ u_char s_dummy2[80];
+ u_char s_label[64];
+ u_char s_uuid[16];
+};
+
+#define OCFS2_MIN_BLOCKSIZE 512
+#define OCFS2_MAX_BLOCKSIZE 4096
+#define OCFS2_SUPER_BLOCK_BLKNO 2
+#define OCFS2_SUPER_BLOCK_SIGNATURE "OCFSV2"
+
+
struct efs_volume_directory { /* size 16 */
char vd_name[8];
char vd_lbn[4];
--- util-linux-2.12a/mount/get_label_uuid.c.ocfs2 2005-07-12 13:42:17.000000000 +0200
+++ util-linux-2.12a/mount/get_label_uuid.c 2005-07-12 13:47:10.000000000 +0200
@@ -91,6 +91,7 @@
struct jfs_super_block jfssb;
struct ocfs_volume_header ovh; /* Oracle */
struct ocfs_volume_label olbl;
+ struct ocfs2_super_block osb;
union {
struct swap_header_v1_1 hdr;
char swap_data[1<<14];
@@ -161,7 +162,29 @@
*label = swap_u.hdr.volume_name[0]?strndup(swap_u.hdr.volume_name, sizeof(swap_u.hdr.volume_name)):NULL;
rv = 0;
}
-
+ else {
+ int blksize, blkoff;
+
+ for (blksize = OCFS2_MIN_BLOCKSIZE;
+ blksize <= OCFS2_MAX_BLOCKSIZE;
+ blksize <<= 1) {
+ blkoff = blksize * OCFS2_SUPER_BLOCK_BLKNO;
+ if (lseek(fd, blkoff, SEEK_SET) == blkoff
+ && read(fd, (char *) &osb, sizeof(osb))
+ == sizeof(osb)
+ && strncmp(osb.signature,
+ OCFS2_SUPER_BLOCK_SIGNATURE,
+ sizeof(OCFS2_SUPER_BLOCK_SIGNATURE))
+ == 0) {
+ memcpy(uuid, osb.s_uuid, sizeof(osb.s_uuid));
+ namesize = sizeof(osb.s_label);
+ if ((*label = calloc(namesize, 1)) != NULL)
+ memcpy(*label, osb.s_label, namesize);
+ rv = 0;
+ break;
+ }
+ }
+ }
close(fd);
return rv;
Index: util-linux.spec
===================================================================
RCS file: /cvs/dist/rpms/util-linux/FC-3/util-linux.spec,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- util-linux.spec 18 Jun 2005 09:17:01 -0000 1.59
+++ util-linux.spec 12 Jul 2005 12:06:52 -0000 1.60
@@ -21,7 +21,7 @@
Summary: A collection of basic system utilities.
Name: util-linux
Version: 2.12a
-Release: 24.3
+Release: 24.4
License: distributable
Group: System Environment/Base
@@ -126,6 +126,8 @@
Patch170: util-linux-2.12p-sfdisk-fgets.patch
# 157656 â CRM 546998 : Possible bug in vipw, changes permissions of /etc/shadow and /etc/gshadow
Patch171: util-linux-2.12p-vipw-perm.patch
+# 150914 â Add ocfs2 support to RHEL4 mount
+Patch172: util-linux-2.12a-mount-ocfs2.patch
# patches required for NFSv4 support
Patch1000: util-linux-2.12-nfsv4.patch
@@ -262,6 +264,7 @@
%patch169 -p1
%patch170 -p1
%patch171 -p1
+%patch172 -p1 -b .ocfs2
%patch1000 -p1 -b .nfsv4
%patch1001 -p1
@@ -643,6 +646,9 @@
/sbin/losetup
%changelog
+* Tue Jul 12 2005 Karel Zak <kzak at redhat.com> 2.12a-24.4
+- add support for OCFS2
+
* Thu Jun 16 2005 Karel Zak <kzak at redhat.com> 2.12a-24.3
- fix #160282, #149997 - Group passwords are not working with newgrp command
- fix #143597 - NEWGRP asks for password when switching to default GID
More information about the fedora-cvs-commits
mailing list