diff options
author | Karel Zak | 2006-12-07 00:26:02 +0100 |
---|---|---|
committer | Karel Zak | 2006-12-07 00:26:02 +0100 |
commit | 0e6f4a203d8715710ff09683390be2897cca3804 (patch) | |
tree | 982a4e50be23b6c30245c61bfed170c592b34e41 /mount | |
parent | Imported from util-linux-2.11u tarball. (diff) | |
download | kernel-qcow2-util-linux-0e6f4a203d8715710ff09683390be2897cca3804.tar.gz kernel-qcow2-util-linux-0e6f4a203d8715710ff09683390be2897cca3804.tar.xz kernel-qcow2-util-linux-0e6f4a203d8715710ff09683390be2897cca3804.zip |
Imported from util-linux-2.11v tarball.
Diffstat (limited to 'mount')
-rw-r--r-- | mount/linux_fs.h | 16 | ||||
-rw-r--r-- | mount/mount.c | 2 | ||||
-rw-r--r-- | mount/mount_by_label.c | 37 | ||||
-rw-r--r-- | mount/mount_guess_fstype.c | 3 | ||||
-rw-r--r-- | mount/umount.c | 2 |
5 files changed, 50 insertions, 10 deletions
diff --git a/mount/linux_fs.h b/mount/linux_fs.h index d14070b22..310f79649 100644 --- a/mount/linux_fs.h +++ b/mount/linux_fs.h @@ -141,6 +141,7 @@ struct xfs_super_block { }; #define CRAMFS_SUPER_MAGIC 0x28cd3d45 +#define CRAMFS_SUPER_MAGIC_BE 0x453dcd28 struct cramfs_super_block { u_char s_magic[4]; u_char s_dummy[12]; @@ -205,6 +206,21 @@ struct mdp_super_block { #define MD_SB_MAGIC 0xa92b4efc #define mdsbmagic(s) assemble4le(s.md_magic) +struct ocfs_volume_header { + u_char minor_version[4]; + u_char major_version[4]; + u_char signature[128]; +}; + +struct ocfs_volume_label { + u_char disk_lock[48]; + u_char label[64]; + u_char label_len[2]; +}; + +#define ocfslabellen(o) assemble2le(o.label_len) +#define OCFS_MAGIC "OracleCFS" + static inline int assemble2le(unsigned char *p) { return (p[0] | (p[1] << 8)); diff --git a/mount/mount.c b/mount/mount.c index fb1ca716f..1f9fc6e62 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -1411,6 +1411,8 @@ main (int argc, char *argv[]) { bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + umask(033); + /* People report that a mount called from init without console writes error messages to /etc/mtab Let us try to avoid getting fd's 0,1,2 */ diff --git a/mount/mount_by_label.c b/mount/mount_by_label.c index 1a5763b5e..da5c5a79a 100644 --- a/mount/mount_by_label.c +++ b/mount/mount_by_label.c @@ -48,9 +48,15 @@ static struct uuidCache_s { /* * See whether this device has (the magic of) a RAID superblock at the end. * If so, it probably is, or has been, part of a RAID array. + * + * For the moment this test is switched off - it causes problems. + * "Checking for a disk label should only be done on the full raid, + * not on the disks that form the raid array. This test causes a lot of + * problems when run on my striped promise fasttrak 100 array." */ static int is_raid_partition(int fd) { +#if 0 struct mdp_super_block mdsb; int n; @@ -67,20 +73,22 @@ is_raid_partition(int fd) { if (read(fd, &mdsb, n) != n) return 1; /* error */ return (mdsbmagic(mdsb) == MD_SB_MAGIC); +#else + return 0; +#endif } -/* for now, only ext2, ext3 and xfs are supported */ +/* for now, only ext2, ext3, xfs, ocfs are supported */ static int get_label_uuid(const char *device, 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; struct ext2_super_block e2sb; struct xfs_super_block xfsb; struct jfs_super_block jfssb; + struct ocfs_volume_header ovh; /* Oracle */ + struct ocfs_volume_label olbl; fd = open(device, O_RDONLY); if (fd < 0) @@ -110,23 +118,34 @@ get_label_uuid(const char *device, char **label, char *uuid) { memcpy(*label, xfsb.s_fname, namesize); rv = 0; } + else if (lseek(fd, 0, SEEK_SET) == 0 + && read(fd, (char *) &ovh, sizeof(ovh)) == sizeof(ovh) + && (strncmp(ovh.signature, OCFS_MAGIC, sizeof(OCFS_MAGIC)) == 0) + && (lseek(fd, 512, SEEK_SET) == 512) + && read(fd, (char *) &olbl, sizeof(olbl)) == sizeof(olbl)) { + uuid[0] = '\0'; + namesize = ocfslabellen(olbl); + if ((*label = calloc(namesize + 1, 1)) != NULL) + memcpy(*label, olbl.label, namesize); + rv = 0; + } else if (lseek(fd, JFS_SUPER1_OFF, SEEK_SET) == JFS_SUPER1_OFF && read(fd, (char *) &jfssb, sizeof(jfssb)) == sizeof(jfssb) - && (strncmp(jfssb.s_magic, JFS_MAGIC, 4) == 0)) { - if (assemble4le(jfssb.s_version) == 1) { + && (strncmp(jfssb.s_magic, JFS_MAGIC, 4) == 0)) { + if (assemble4le(jfssb.s_version) == 1) { /* old (OS/2 compatible) jfs filesystems don't have UUIDs and only have a very small label. */ memset(uuid, 0, 16); namesize = sizeof(jfssb.s_fpack); if ((*label = calloc(namesize + 1, 1)) != NULL) memcpy(*label, jfssb.s_fpack, namesize); - } else { + } else { memcpy(uuid, jfssb.s_uuid, sizeof(jfssb.s_uuid)); namesize = sizeof(jfssb.s_label); if ((*label = calloc(namesize + 1, 1)) != NULL) memcpy(*label, jfssb.s_label, namesize); - } - rv = 0; + } + rv = 0; } close(fd); diff --git a/mount/mount_guess_fstype.c b/mount/mount_guess_fstype.c index be01c88b0..a096a262f 100644 --- a/mount/mount_guess_fstype.c +++ b/mount/mount_guess_fstype.c @@ -290,7 +290,8 @@ do_guess_fstype(const char *device) { else if(!strncmp(xsb.ntfssb.s_magic, NTFS_SUPER_MAGIC, sizeof(xsb.ntfssb.s_magic))) type = "ntfs"; - else if(cramfsmagic(xsb.cramfssb) == CRAMFS_SUPER_MAGIC) + else if(cramfsmagic(xsb.cramfssb) == CRAMFS_SUPER_MAGIC || + cramfsmagic(xsb.cramfssb) == CRAMFS_SUPER_MAGIC_BE) type = "cramfs"; else if ((!strncmp(xsb.fatsb.s_os, "MSDOS", 5) || !strncmp(xsb.fatsb.s_os, "MSWIN", 5) || diff --git a/mount/umount.c b/mount/umount.c index ba7f35a49..39c8385ed 100644 --- a/mount/umount.c +++ b/mount/umount.c @@ -614,6 +614,8 @@ main (int argc, char *argv[]) { bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + umask(033); + while ((c = getopt_long (argc, argv, "adfhlnrt:vV", longopts, NULL)) != -1) switch (c) { |