diff --git a/nfsboot b/nfsboot deleted file mode 100644 index 62e284e..0000000 --- a/nfsboot +++ /dev/null @@ -1,50 +0,0 @@ -#! /bin/sh -# Copyright (c) 2004 SuSE AG, Nuernberg, Germany. All rights reserved. -# -# Author: Mads Martin Joergensen -# -# /etc/init.d/nfsboot -# -# System startup script for service(s) needed with NFS -# -### BEGIN INIT INFO -# Provides: nfsboot -# Required-Start: $network $portmap -# Required-Stop: -# Default-Start: 3 5 -# Default-Stop: -# Description: Service(s) needed with NFS -### END INIT INFO - -SMNOTIFYBIN=/sbin/sm-notify -OPTIONS=" -q" -test -x $SMNOTIFYBIN || exit 5 - -. /etc/rc.status - -rc_reset - -case "$1" in - # It's a one shot binary notifying clients, so the below is - # ok in this special case. - start|restart|try-restart|reload|force-reload) - echo -n "Starting nfsboot (`/bin/basename $SMNOTIFYBIN`) " - $SMNOTIFYBIN $OPTIONS - rc_status -v - ;; - stop) - # we had rc_reset above, so we return 0 anyway - ;; - status) - # sm-notify is not a daemon, but a one-shot binary - # nothing to be checked, status is unknown - rc_failed 4 - rc_status -v - ;; - *) - echo "Usage: $0 {start|stop|restart|try-restart|reload|force-reload|status}" - exit 1 - ;; -esac -rc_exit - diff --git a/renice.8 b/renice.8 deleted file mode 100644 index 1aab359..0000000 --- a/renice.8 +++ /dev/null @@ -1,136 +0,0 @@ -.\" Copyright (c) 1983, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)renice.8 8.1 (Berkeley) 6/9/93 -.\" -.Dd June 9, 1993 -.Dt RENICE 8 -.Os BSD 4 -.Sh NAME -.Nm renice -.Nd alter priority of running processes -.Sh SYNOPSIS -.Nm renice -.Ar priority -.Oo -.Op Fl p -.Ar pid ... -.Oc -.Oo -.Op Fl g -.Ar pgrp ... -.Oc -.Oo -.Op Fl u -.Ar user ... -.Oc -.Sh DESCRIPTION -.Nm Renice -alters the -scheduling priority of one or more running processes. -The following -.Ar who -parameters are interpreted as process ID's, process group -ID's, or user names. -.Nm Renice Ns 'ing -a process group causes all processes in the process group -to have their scheduling priority altered. -.Nm Renice Ns 'ing -a user causes all processes owned by the user to have -their scheduling priority altered. -By default, the processes to be affected are specified by -their process ID's. -.Pp -Options supported by -.Nm renice : -.Bl -tag -width Ds -.It Fl g -Force -.Ar who -parameters to be interpreted as process group ID's. -.It Fl u -Force the -.Ar who -parameters to be interpreted as user names. -.It Fl p -Resets the -.Ar who -interpretation to be (the default) process ID's. -.El -.Pp -For example, -.Bd -literal -offset -renice +1 987 -u daemon root -p 32 -.Ed -.Pp -would change the priority of process ID's 987 and 32, and -all processes owned by users daemon and root. -.Pp -Users other than the super-user may only alter the priority of -processes they own, -and can only monotonically increase their ``nice value'' -within the range 0 to -.Dv PRIO_MAX -(20). -(This prevents overriding administrative fiats.) -The super-user -may alter the priority of any process -and set the priority to any value in the range -.Dv PRIO_MIN -(\-20) -to -.Dv PRIO_MAX . -Useful priorities are: -20 (the affected processes will run only when nothing else -in the system wants to), -0 (the ``base'' scheduling priority), -anything negative (to make things go very fast). -.Sh FILES -.Bl -tag -width /etc/passwd -compact -.It Pa /etc/passwd -to map user names to user ID's -.El -.Sh SEE ALSO -.Xr getpriority 2 , -.Xr setpriority 2 -.Sh BUGS -Non super-users can not increase scheduling priorities of their own processes, -even if they were the ones that decreased the priorities in the first place. -.br -The Linux kernel (at least version 2.0.0) and linux libc (at least -version 5.2.18) does not agree entirely on what the specifics of the -systemcall interface to set nice values is. Thus causes renice to -report bogus previous nice values. -.Sh HISTORY -The -.Nm -command appeared in -.Bx 4.0 . diff --git a/sm-notify-20060111.tar.bz2 b/sm-notify-20060111.tar.bz2 deleted file mode 100644 index e5cf4a7..0000000 --- a/sm-notify-20060111.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ffe524be61389246a7ebb71832bf3f750834dbf8e5a38d4cc1548e267a8fb853 -size 5843 diff --git a/util-linux-2.11u-mount_nfs_mount_acl.patch b/util-linux-2.11u-mount_nfs_mount_acl.patch deleted file mode 100644 index 83a4cca..0000000 --- a/util-linux-2.11u-mount_nfs_mount_acl.patch +++ /dev/null @@ -1,93 +0,0 @@ -Adds the [no]acl NFS mount option that was added to the kernel. This -change has been discussed and accepted by Trond Myklebust - and Olaf Kirch . - - -- Andreas Gruenbacher - -================================================================================ -Index: util-linux-ng-2.12r+2.13pre7/mount/mount.8 -=================================================================== ---- util-linux-ng-2.12r+2.13pre7.orig/mount/mount.8 -+++ util-linux-ng-2.12r+2.13pre7/mount/mount.8 -@@ -1335,7 +1335,8 @@ are recognized: - .BR ac , - .BR tcp , - .BR udp , --.BR lock . -+.BR lock , -+.BR acl . - For details, see - .BR nfs (5). - -Index: util-linux-ng-2.12r+2.13pre7/mount/nfs.5 -=================================================================== ---- util-linux-ng-2.12r+2.13pre7.orig/mount/nfs.5 -+++ util-linux-ng-2.12r+2.13pre7/mount/nfs.5 -@@ -204,6 +204,15 @@ default UDP protocol. Many NFS servers - .I udp - Mount the NFS filesystem using the UDP protocol. This - is the default. -+.TP 1.5i -+.I noacl -+Assume no extended access control mechanisms like POSIX ACLs are used -+on the NFS filesystem, and depend on the file mode permission bits -+instead of using the ACCESS remote procedure call. The default is to -+use the ACCESS remote procedure call for making access decisions in -+NFS version 3. (On NFS version 2 filesystems this option has no effect.) -+This option also deactivates the GETACL and SETACL remote procedure calls -+which are otherwise used to manipulate ACLs. - .P - All of the non-value options have corresponding nooption forms. - For example, nointr means don't allow file operations to be -Index: util-linux-ng-2.12r+2.13pre7/mount/nfs_mount4.h -=================================================================== ---- util-linux-ng-2.12r+2.13pre7.orig/mount/nfs_mount4.h -+++ util-linux-ng-2.12r+2.13pre7/mount/nfs_mount4.h -@@ -51,4 +51,4 @@ struct nfs_mount_data { - #define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ - #define NFS_MOUNT_NONLM 0x0200 /* 3 */ - #define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ -- -+#define NFS_MOUNT_NOACL 0x0800 /* 4 */ -Index: util-linux-ng-2.12r+2.13pre7/mount/nfsmount.c -=================================================================== ---- util-linux-ng-2.12r+2.13pre7.orig/mount/nfsmount.c -+++ util-linux-ng-2.12r+2.13pre7/mount/nfsmount.c -@@ -214,7 +214,7 @@ int nfsmount(const char *spec, const cha - struct stat statbuf; - char *s; - int port, mountport, proto, bg, soft, intr; -- int posix, nocto, noac, nolock, broken_suid; -+ int posix, nocto, noac, nolock, broken_suid, noacl; - int retry, tcp; - int mountprog, mountvers, nfsprog, nfsvers; - int retval; -@@ -314,6 +314,7 @@ int nfsmount(const char *spec, const cha - nocto = 0; - nolock = 0; - broken_suid = 0; -+ noacl = 0; - noac = 0; - retry = 10000; /* 10000 minutes ~ 1 week */ - tcp = 0; -@@ -425,6 +426,8 @@ int nfsmount(const char *spec, const cha - printf(_("Warning: option nolock is not supported.\n")); - } else if (!strcmp(opt, "broken_suid")) { - broken_suid = val; -+ } else if (!strcmp(opt, "acl")) { -+ noacl = !val; - } else { - if (!sloppy) { - printf(_("unknown nfs mount option: " -@@ -450,8 +453,10 @@ int nfsmount(const char *spec, const cha - data.flags |= (nolock ? NFS_MOUNT_NONLM : 0); - #endif - #if NFS_MOUNT_VERSION >= 4 -- if (nfs_mount_version >= 4) -+ if (nfs_mount_version >= 4) { - data.flags |= (broken_suid ? NFS_MOUNT_BROKEN_SUID : 0); -+ data.flags |= (noacl ? NFS_MOUNT_NOACL : 0); -+ } - #endif - if (nfsvers > MAX_NFSPROT) { - fprintf(stderr, "NFSv%d not supported!\n", nfsvers); diff --git a/util-linux-2.12-mount_base_nfsv4.patch b/util-linux-2.12-mount_base_nfsv4.patch deleted file mode 100644 index ead5f2f..0000000 --- a/util-linux-2.12-mount_base_nfsv4.patch +++ /dev/null @@ -1,859 +0,0 @@ - -Add basic nfsv4 support - ---- - - util-linux-2.12-bfields/mount/Makefile | 2 - util-linux-2.12-bfields/mount/fstab.5 | 1 - util-linux-2.12-bfields/mount/mount.8 | 75 ++++++ - util-linux-2.12-bfields/mount/mount.c | 13 + - util-linux-2.12-bfields/mount/nfs.5 | 200 +++++++++++++++++ - util-linux-2.12-bfields/mount/nfs4_mount.h | 82 +++++++ - util-linux-2.12-bfields/mount/nfs4mount.c | 335 +++++++++++++++++++++++++++++ - util-linux-2.12-bfields/mount/nfsmount.c | 5 - util-linux-2.12-bfields/mount/sundries.h | 2 - util-linux-2.12-bfields/mount/umount.c | 3 - 10 files changed, 710 insertions(+), 8 deletions(-) - -Index: util-linux-ng-2.12r+git20070330/mount/fstab.5 -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/mount/fstab.5 -+++ util-linux-ng-2.12r+git20070330/mount/fstab.5 -@@ -115,6 +115,7 @@ of filesystem types, such as - .IR msdos , - .IR ncpfs , - .IR nfs , -+.IR nfs4 , - .IR ntfs , - .IR proc , - .IR qnx4 , -Index: util-linux-ng-2.12r+git20070330/mount/mount.8 -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/mount/mount.8 -+++ util-linux-ng-2.12r+git20070330/mount/mount.8 -@@ -385,6 +385,7 @@ currently supported include: - .IR msdos , - .IR ncpfs , - .IR nfs , -+.IR nfs4 , - .IR ntfs , - .IR proc , - .IR qnx4 , -@@ -422,7 +423,7 @@ For most types all the - program has to do is issue a simple - .IR mount (2) - system call, and no detailed knowledge of the filesystem type is required. --For a few types however (like nfs, cifs, smbfs, ncpfs) ad hoc code is -+For a few types however (like nfs, nfs4, cifs, smbfs, ncpfs) ad hoc code is - necessary. The nfs ad hoc code is built in, but cifs, smbfs, and ncpfs - have a separate mount program. In order to make it possible to - treat all types in a uniform way, mount will execute the program -@@ -450,9 +451,10 @@ or, if that does not exist, - All of the filesystem types listed there will be tried, - except for those that are labeled "nodev" (e.g., - .IR devpts , --.I proc -+.IR proc , -+.IR nfs , - and --.IR nfs ). -+.IR nfs4 ). - If - .I /etc/filesystems - ends in a line with a single * only, mount will read -@@ -1380,6 +1382,73 @@ Usually it just causes lots of trouble. - .B nolock - Do not use locking. Do not start lockd. - -+.SH "Mount options for nfs4" -+Instead of a textual option string, parsed by the kernel, the -+.I nfs4 -+file system expects a binary argument of type -+.IR "struct nfs4_mount_data" . -+The program -+.B mount -+itself parses the following options of the form `tag=value', -+and puts them in the structure mentioned: -+.BI rsize= n, -+.BI wsize= n, -+.BI timeo= n, -+.BI retrans= n, -+.BI acregmin= n, -+.BI acregmax= n, -+.BI acdirmin= n, -+.BI acdirmax= n, -+.BI actimeo= n, -+.BI retry= n, -+.BI port= n, -+.BI proto= n, -+.BI clientaddr= n, -+.BI sec= n. -+The option -+.BI addr= n -+is accepted but ignored. -+Also the following Boolean options, possibly preceded by -+.B no -+are recognized: -+.BR bg , -+.BR fg , -+.BR soft , -+.BR hard , -+.BR intr , -+.BR cto , -+.BR ac , -+For details, see -+.BR nfs (5). -+ -+Especially useful options include -+.TP -+.B rsize=32768,wsize=32768 -+This will make your NFS connection faster than with the default -+buffer size of 4096. -+.TP -+.B hard -+The program accessing a file on a NFS mounted file system will hang -+when the server crashes. The process cannot be interrupted or -+killed unless you also specify -+.BR intr . -+When the NFS server is back online the program will continue undisturbed -+from where it was. This is probably what you want. -+.TP -+.B soft -+This option allows the kernel to time out if the NFS server is not -+responding for some time. The time can be -+specified with -+.BR timeo=time . -+This timeout value is expressed in tenths of a second. -+The -+.BR soft -+option might be useful if your NFS server sometimes doesn't respond -+or will be rebooted while some process tries to get a file from the server. -+Avoid using this option with -+.BR proto=udp -+or with a short timeout. -+ - .SH "Mount options for ntfs" - .TP - .BI iocharset= name -Index: util-linux-ng-2.12r+git20070330/mount/mount.c -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/mount/mount.c -+++ util-linux-ng-2.12r+git20070330/mount/mount.c -@@ -860,6 +860,19 @@ try_mount_one (const char *spec0, const - if (res) - goto out; - } -+#ifdef HAVE_NFS -+ /* -+ * NFSv4 support -+ */ -+ if (!fake && types && streq (types, "nfs4")) { -+ mnt_err = nfs4mount(spec, node, &flags, &extra_opts, &mount_opts, bg); -+ if (mnt_err) -+ return mnt_err; -+#else -+ die (EX_SOFTWARE, _("mount: this version was compiled " -+ "without support for the type `nfs4'")); -+#endif -+ } - - /* - * Call mount.TYPE for types that require a separate mount program. -Index: util-linux-ng-2.12r+git20070330/mount/nfs4mount.c -=================================================================== ---- /dev/null -+++ util-linux-ng-2.12r+git20070330/mount/nfs4mount.c -@@ -0,0 +1,335 @@ -+/* -+ * nfs4mount.c -- Linux NFS mount -+ * Copyright (C) 2002 Trond Myklebust -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * Note: this file based on the original nfsmount.c -+ */ -+ -+#include "../config.h" -+ -+#include -+#include -+#undef __FD_CLR -+#undef __FD_SET -+#undef __FD_ISSET -+#undef __FD_ZERO -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "sundries.h" -+ -+#include "mount_constants.h" -+#include "nfs4_mount.h" -+ -+#include "nls.h" -+ -+#ifndef NFS_PORT -+#define NFS_PORT 2049 -+#endif -+ -+static int parse_devname(char *hostdir, char **hostname, char **dirname) -+{ -+ char *s; -+ -+ if (!(s = strchr(hostdir, ':'))) { -+ fprintf(stderr, -+ _("mount: " -+ "directory to mount not in host:dir format\n")); -+ return -1; -+ } -+ *hostname = hostdir; -+ *dirname = s + 1; -+ *s = '\0'; -+ /* Ignore all but first hostname in replicated mounts -+ until they can be fully supported. (mack@sgi.com) */ -+ if ((s = strchr(hostdir, ','))) { -+ *s = '\0'; -+ fprintf(stderr, -+ _("mount: warning: " -+ "multiple hostnames not supported\n")); -+ } -+ return 0; -+} -+ -+static int fill_ipv4_sockaddr(const char *hostname, struct sockaddr_in *addr) -+{ -+ struct hostent *hp; -+ addr->sin_family = AF_INET; -+ -+ if (inet_aton(hostname, &addr->sin_addr)) -+ return 0; -+ if ((hp = gethostbyname(hostname)) == NULL) { -+ fprintf(stderr, _("mount: can't get address for %s\n"), -+ hostname); -+ return -1; -+ } -+ if (hp->h_length > sizeof(struct in_addr)) { -+ fprintf(stderr, -+ _("mount: got bad hp->h_length\n")); -+ hp->h_length = sizeof(struct in_addr); -+ } -+ memcpy(&addr->sin_addr, hp->h_addr, hp->h_length); -+ return 0; -+} -+ -+static int get_my_ipv4addr(char *ip_addr, int len) -+{ -+ char myname[1024]; -+ struct sockaddr_in myaddr; -+ -+ if (gethostname(myname, sizeof(myname))) { -+ fprintf(stderr, _("mount: can't determine client address\n")); -+ return -1; -+ } -+ if (fill_ipv4_sockaddr(myname, &myaddr)) -+ return -1; -+ snprintf(ip_addr, len, "%s", inet_ntoa(myaddr.sin_addr)); -+ ip_addr[len-1] = '\0'; -+ return 0; -+} -+ -+int nfs4mount(const char *spec, const char *node, int *flags, -+ char **extra_opts, char **mount_opts, -+ int running_bg) -+{ -+ static struct nfs4_mount_data data; -+ static char hostdir[1024]; -+ static char ip_addr[16] = "127.0.0.1"; -+ static struct sockaddr_in server_addr; -+ static int pseudoflavour = 0; -+ -+ char *hostname, *dirname, *old_opts; -+ char new_opts[1024]; -+ char *opt, *opteq; -+ char *s; -+ int val; -+ int bg, soft, intr; -+ int nocto, noac; -+ int retry; -+ int retval; -+ -+ retval = EX_FAIL; -+ if (strlen(spec) >= sizeof(hostdir)) { -+ fprintf(stderr, _("mount: " -+ "excessively long host:dir argument\n")); -+ goto fail; -+ } -+ strcpy(hostdir, spec); -+ if (parse_devname(hostdir, &hostname, &dirname)) -+ goto fail; -+ -+ if (fill_ipv4_sockaddr(hostname, &server_addr)) -+ goto fail; -+ if (get_my_ipv4addr(ip_addr, sizeof(ip_addr))) -+ goto fail; -+ -+ /* add IP address to mtab options for use when unmounting */ -+ s = inet_ntoa(server_addr.sin_addr); -+ old_opts = *extra_opts; -+ if (!old_opts) -+ old_opts = ""; -+ if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) { -+ fprintf(stderr, _("mount: " -+ "excessively long option argument\n")); -+ goto fail; -+ } -+ snprintf(new_opts, sizeof(new_opts), "%s%saddr=%s", -+ old_opts, *old_opts ? "," : "", s); -+ *extra_opts = xstrdup(new_opts); -+ -+ /* Set default options. -+ * rsize/wsize and timeo are left 0 in order to -+ * let the kernel decide. -+ */ -+ memset(&data, 0, sizeof(data)); -+ data.retrans = 3; -+ data.acregmin = 3; -+ data.acregmax = 60; -+ data.acdirmin = 30; -+ data.acdirmax = 60; -+ data.proto = IPPROTO_TCP; -+ -+ bg = 0; -+ soft = 0; -+ intr = 0; -+ nocto = 0; -+ noac = 0; -+ retry = 10000; /* 10000 minutes ~ 1 week */ -+ -+ /* -+ * NFSv4 specifies that the default port should be 2049 -+ */ -+ server_addr.sin_port = htons(NFS_PORT); -+ -+ /* parse options */ -+ -+ for (opt = strtok(old_opts, ","); opt; opt = strtok(NULL, ",")) { -+ if ((opteq = strchr(opt, '='))) { -+ val = atoi(opteq + 1); -+ *opteq = '\0'; -+ if (!strcmp(opt, "rsize")) -+ data.rsize = val; -+ else if (!strcmp(opt, "wsize")) -+ data.wsize = val; -+ else if (!strcmp(opt, "timeo")) -+ data.timeo = val; -+ else if (!strcmp(opt, "retrans")) -+ data.retrans = val; -+ else if (!strcmp(opt, "acregmin")) -+ data.acregmin = val; -+ else if (!strcmp(opt, "acregmax")) -+ data.acregmax = val; -+ else if (!strcmp(opt, "acdirmin")) -+ data.acdirmin = val; -+ else if (!strcmp(opt, "acdirmax")) -+ data.acdirmax = val; -+ else if (!strcmp(opt, "actimeo")) { -+ data.acregmin = val; -+ data.acregmax = val; -+ data.acdirmin = val; -+ data.acdirmax = val; -+ } -+ else if (!strcmp(opt, "retry")) -+ retry = val; -+ else if (!strcmp(opt, "port")) -+ server_addr.sin_port = htons(val); -+ else if (!strcmp(opt, "proto")) { -+ if (!strncmp(opteq+1, "tcp", 3)) -+ data.proto = IPPROTO_TCP; -+ else if (!strncmp(opteq+1, "udp", 3)) -+ data.proto = IPPROTO_UDP; -+ else -+ printf(_("Warning: Unrecognized proto= option.\n")); -+ } else if (!strcmp(opt, "clientaddr")) { -+ if (strlen(opteq+1) >= sizeof(ip_addr)) -+ printf(_("Invalid client address %s"), -+ opteq+1); -+ strncpy(ip_addr,opteq+1, sizeof(ip_addr)); -+ ip_addr[sizeof(ip_addr)-1] = '\0'; -+ } else if (!strcmp(opt, "sec")) { -+ if (!strcmp(opteq+1, "krb5")) -+ pseudoflavour = 390003; -+ else if (!strcmp(opteq+1, "krb5i")) -+ pseudoflavour = 390004; -+ else if (!strcmp(opteq+1, "krb5p")) -+ pseudoflavour = 390005; -+ else if (!strcmp(opteq+1, "lipkey")) -+ pseudoflavour = 390006; -+ else if (!strcmp(opteq+1, "lipkey-i")) -+ pseudoflavour = 390007; -+ else if (!strcmp(opteq+1, "lipkey-p")) -+ pseudoflavour = 390008; -+ else if (!strcmp(opteq+1, "spkm3")) -+ pseudoflavour = 390009; -+ else if (!strcmp(opteq+1, "spkm3i")) -+ pseudoflavour = 390010; -+ else if (!strcmp(opteq+1, "spkm3p")) -+ pseudoflavour = 390011; -+ else { -+ printf(_("unknown security type %s\n"), -+ opteq+1); -+ goto fail; -+ } -+ } else if (!strcmp(opt, "addr")) { -+ /* ignore */; -+ } else { -+ printf(_("unknown nfs mount parameter: " -+ "%s=%d\n"), opt, val); -+ goto fail; -+ } -+ } else { -+ val = 1; -+ if (!strncmp(opt, "no", 2)) { -+ val = 0; -+ opt += 2; -+ } -+ if (!strcmp(opt, "bg")) -+ bg = val; -+ else if (!strcmp(opt, "fg")) -+ bg = !val; -+ else if (!strcmp(opt, "soft")) -+ soft = val; -+ else if (!strcmp(opt, "hard")) -+ soft = !val; -+ else if (!strcmp(opt, "intr")) -+ intr = val; -+ else if (!strcmp(opt, "cto")) -+ nocto = !val; -+ else if (!strcmp(opt, "ac")) -+ noac = !val; -+ else { -+ if (!sloppy) { -+ printf(_("unknown nfs mount option: " -+ "%s%s\n"), val ? "" : "no", opt); -+ goto fail; -+ } -+ } -+ } -+ } -+ -+ data.flags = (soft ? NFS4_MOUNT_SOFT : 0) -+ | (intr ? NFS4_MOUNT_INTR : 0) -+ | (nocto ? NFS4_MOUNT_NOCTO : 0) -+ | (noac ? NFS4_MOUNT_NOAC : 0); -+ -+ if (pseudoflavour != 0) { -+ data.auth_flavourlen = 1; -+ data.auth_flavours = &pseudoflavour; -+ } -+ -+ data.client_addr.data = ip_addr; -+ data.client_addr.len = strlen(ip_addr); -+ -+ data.mnt_path.data = dirname; -+ data.mnt_path.len = strlen(dirname); -+ -+ data.hostname.data = hostname; -+ data.hostname.len = strlen(hostname); -+ data.host_addr = (struct sockaddr *)&server_addr; -+ data.host_addrlen = sizeof(server_addr); -+ -+#ifdef NFS_MOUNT_DEBUG -+ printf("rsize = %d, wsize = %d, timeo = %d, retrans = %d\n", -+ data.rsize, data.wsize, data.timeo, data.retrans); -+ printf("acreg (min, max) = (%d, %d), acdir (min, max) = (%d, %d)\n", -+ data.acregmin, data.acregmax, data.acdirmin, data.acdirmax); -+ printf("port = %d, bg = %d, retry = %d, flags = %.8x\n", -+ ntohs(server_addr.sin_port), bg, retry, data.flags); -+ printf("soft = %d, intr = %d, nocto = %d, noac = %d\n", -+ (data.flags & NFS4_MOUNT_SOFT) != 0, -+ (data.flags & NFS4_MOUNT_INTR) != 0, -+ (data.flags & NFS4_MOUNT_NOCTO) != 0, -+ (data.flags & NFS4_MOUNT_NOAC) != 0); -+ printf("proto = %s\n", (data.proto == IPPROTO_TCP) ? "tcp" : "udp"); -+#endif -+ -+ data.version = NFS4_MOUNT_VERSION; -+ -+ *mount_opts = (char *) &data; -+ /* clean up */ -+ return 0; -+ -+fail: -+ return retval; -+} -Index: util-linux-ng-2.12r+git20070330/mount/nfs4_mount.h -=================================================================== ---- /dev/null -+++ util-linux-ng-2.12r+git20070330/mount/nfs4_mount.h -@@ -0,0 +1,82 @@ -+#ifndef _LINUX_NFS4_MOUNT_H -+#define _LINUX_NFS4_MOUNT_H -+ -+/* -+ * linux/include/linux/nfs4_mount.h -+ * -+ * Copyright (C) 2002 Trond Myklebust -+ * -+ * structure passed from user-space to kernel-space during an nfsv4 mount -+ */ -+ -+/* -+ * WARNING! Do not delete or change the order of these fields. If -+ * a new field is required then add it to the end. The version field -+ * tracks which fields are present. This will ensure some measure of -+ * mount-to-kernel version compatibility. Some of these aren't used yet -+ * but here they are anyway. -+ */ -+#define NFS4_MOUNT_VERSION 1 -+ -+struct nfs_string { -+ unsigned int len; -+ const char* data; -+}; -+ -+struct nfs4_mount_data { -+ int version; /* 1 */ -+ int flags; /* 1 */ -+ int rsize; /* 1 */ -+ int wsize; /* 1 */ -+ int timeo; /* 1 */ -+ int retrans; /* 1 */ -+ int acregmin; /* 1 */ -+ int acregmax; /* 1 */ -+ int acdirmin; /* 1 */ -+ int acdirmax; /* 1 */ -+ -+ /* see the definition of 'struct clientaddr4' in RFC3010 */ -+ struct nfs_string client_addr; /* 1 */ -+ -+ /* Mount path */ -+ struct nfs_string mnt_path; /* 1 */ -+ -+ /* Server details */ -+ struct nfs_string hostname; /* 1 */ -+ /* Server IP address */ -+ unsigned int host_addrlen; /* 1 */ -+ struct sockaddr* host_addr; /* 1 */ -+ -+ /* Transport protocol to use */ -+ int proto; /* 1 */ -+ -+ /* Pseudo-flavours to use for authentication. See RFC2623 */ -+ int auth_flavourlen; /* 1 */ -+ int *auth_flavours; /* 1 */ -+}; -+ -+/* bits in the flags field */ -+/* Note: the fields that correspond to existing NFSv2/v3 mount options -+ * should mirror the values from include/linux/nfs_mount.h -+ */ -+ -+#define NFS4_MOUNT_SOFT 0x0001 /* 1 */ -+#define NFS4_MOUNT_INTR 0x0002 /* 1 */ -+#define NFS4_MOUNT_NOCTO 0x0010 /* 1 */ -+#define NFS4_MOUNT_NOAC 0x0020 /* 1 */ -+#define NFS4_MOUNT_STRICTLOCK 0x1000 /* 1 */ -+#define NFS4_MOUNT_FLAGMASK 0xFFFF -+ -+/* pseudoflavors: */ -+ -+#define RPC_AUTH_GSS_KRB5 390003 -+#define RPC_AUTH_GSS_KRB5I 390004 -+#define RPC_AUTH_GSS_KRB5P 390005 -+#define RPC_AUTH_GSS_LKEY 390006 -+#define RPC_AUTH_GSS_LKEYI 390007 -+#define RPC_AUTH_GSS_LKEYP 390008 -+#define RPC_AUTH_GSS_SPKM 390009 -+#define RPC_AUTH_GSS_SPKMI 390010 -+#define RPC_AUTH_GSS_SPKMP 390011 -+ -+#endif -Index: util-linux-ng-2.12r+git20070330/mount/nfs.5 -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/mount/nfs.5 -+++ util-linux-ng-2.12r+git20070330/mount/nfs.5 -@@ -3,7 +3,7 @@ - .\" patches. " - .TH NFS 5 "20 November 1993" "Linux 0.99" "Linux Programmer's Manual" - .SH NAME --nfs \- nfs fstab format and options -+nfs \- nfs and nfs4 fstab format and options - .SH SYNOPSIS - .B /etc/fstab - .SH DESCRIPTION -@@ -17,14 +17,51 @@ the local directory that is the mount po - and the NFS specific options that control - the way the filesystem is mounted. - .P --Here is an example from an \fI/etc/fstab\fP file from an NFS mount. -+Three different versions of the NFS protocol are -+supported by the Linux NFS client: -+NFS version 2, NFS version 3, and NFS version 4. -+To mount via NFS version 2, use the -+.BR nfs -+file system type and specify -+.BR nfsvers=2 . -+Version 2 is the default protocol version for the -+.BR nfs -+file system type when -+.BR nfsvers= -+is not specified on the mount command. -+To mount via NFS version 3, use the -+.BR nfs -+file system type and specify -+.BR nfsvers=3 . -+To mount via NFS version 4, use the -+.BR nfs4 -+file system type. -+The -+.BR nfsvers= -+keyword is not supported for the -+.BR nfs4 -+file system type. -+.P -+These file system types share similar mount options; -+the differences are listed below. -+.P -+Here is an example from an \fI/etc/fstab\fP file for an NFSv2 mount -+over UDP. - .sp - .nf - .ta 2.5i +0.75i +0.75i +1.0i - server:/usr/local/pub /pub nfs rsize=8192,wsize=8192,timeo=14,intr - .fi -+.P -+Here is an example for an NFSv4 mount over TCP using Kerberos -+5 mutual authentication. -+.sp -+.nf -+.ta 2.5i +0.75i +0.75i +1.0i -+server:/usr/local/pub /pub nfs4 proto=tcp,sec=krb5,hard,intr -+.fi - .DT --.SS Options -+.SS Options for the nfs file system type - .TP 1.5i - .I rsize=n - The number of bytes NFS uses when reading files from an NFS server. -@@ -217,6 +254,163 @@ which are otherwise used to manipulate A - All of the non-value options have corresponding nooption forms. - For example, nointr means don't allow file operations to be - interrupted. -+.SS Options for the nfs4 file system type -+.TP 1.5i -+.I rsize=n -+The number of bytes NFS uses when reading files from an NFS server. -+The default value is dependent on the kernel, currently 4096 bytes. -+(However, throughput is improved greatly by asking for -+.IR rsize=32768 .) -+This value is negotiated with the server. -+.TP 1.5i -+.I wsize=n -+The number of bytes NFS uses when writing files to an NFS server. -+The default value is dependent on the kernel, currently 4096 bytes. -+(However, throughput is improved greatly by asking for -+.IR wsize=32768 .) -+This value is negotiated with the server. -+.TP 1.5i -+.I timeo=n -+The value in tenths of a second before sending the -+first retransmission after an RPC timeout. -+The default value depends on whether -+.IR proto=udp -+or -+.IR proto=tcp -+is in effect (see below). -+The default value for UDP is 7 tenths of a second. -+The default value for TCP is 60 seconds. -+After the first timeout, -+the timeout is doubled after each successive timeout until a maximum -+timeout of 60 seconds is reached or the enough retransmissions -+have occured to cause a major timeout. Then, if the filesystem -+is hard mounted, each new timeout cascade restarts at twice the -+initial value of the previous cascade, again doubling at each -+retransmission. The maximum timeout is always 60 seconds. -+.TP 1.5i -+.I retrans=n -+The number of minor timeouts and retransmissions that must occur before -+a major timeout occurs. The default is 5 timeouts for -+.IR proto=udp -+and 2 timeouts for -+.IR proto=tcp . -+When a major timeout -+occurs, the file operation is either aborted or a "server not responding" -+message is printed on the console. -+.TP 1.5i -+.I acregmin=n -+The minimum time in seconds that attributes of a regular file should -+be cached before requesting fresh information from a server. -+The default is 3 seconds. -+.TP 1.5i -+.I acregmax=n -+The maximum time in seconds that attributes of a regular file can -+be cached before requesting fresh information from a server. -+The default is 60 seconds. -+.TP 1.5i -+.I acdirmin=n -+The minimum time in seconds that attributes of a directory should -+be cached before requesting fresh information from a server. -+The default is 30 seconds. -+.TP 1.5i -+.I acdirmax=n -+The maximum time in seconds that attributes of a directory can -+be cached before requesting fresh information from a server. -+The default is 60 seconds. -+.TP 1.5i -+.I actimeo=n -+Using actimeo sets all of -+.I acregmin, -+.I acregmax, -+.I acdirmin, -+and -+.I acdirmax -+to the same value. -+There is no default value. -+.TP 1.5i -+.I retry=n -+The number of minutes to retry an NFS mount operation -+in the foreground or background before giving up. -+The default value is 10000 minutes, which is roughly one week. -+.TP 1.5i -+.I port=n -+The numeric value of the port to connect to the NFS server on. -+If the port number is 0 (the default) then query the -+remote host's portmapper for the port number to use. -+If the remote host's NFS daemon is not registered with -+its portmapper, the standard NFS port number 2049 is -+used instead. -+.TP 1.5i -+.I proto=n -+Mount the NFS filesystem using a specific network protocol -+instead of the default UDP protocol. -+Many NFS version 4 servers only support TCP. -+Valid protocol types are -+.IR udp -+and -+.IR tcp . -+.TP 1.5i -+.I clientaddr=n -+On a multi-homed client, this -+causes the client to use a specific callback address when -+communicating with an NFS version 4 server. -+This option is currently ignored. -+.TP 1.5i -+.I sec=n -+Specify an advanced security mechanism for this file system. -+To use Kerberos 5 mutual authentication, specify -+.IR krb5 . -+Kerberos 5 integrity checking is specified with -+.IR krb5i , -+and Kerberos 5 privacy is specified with -+.IR krb5p . -+Other security mechanisms may become available in the future. -+.TP 1.5i -+.I bg -+If an NFS mount attempt times out, retry the mount -+in the background. -+After a mount operation is backgrounded, all subsequent mounts -+on the same NFS server will be backgrounded immediately, without -+first attempting the mount. -+A missing mount point is treated as a timeout, -+to allow for nested NFS mounts. -+.TP 1.5i -+.I fg -+If the first NFS mount attempt times out, retry the mount -+in the foreground. -+This is the complement of the -+.I bg -+option, and also the default behavior. -+.TP 1.5i -+.I soft -+If an NFS file operation has a major timeout then report an I/O error to -+the calling program. -+The default is to continue retrying NFS file operations indefinitely. -+.TP 1.5i -+.I hard -+If an NFS file operation has a major timeout then report -+"server not responding" on the console and continue retrying indefinitely. -+This is the default. -+.TP 1.5i -+.I intr -+If an NFS file operation has a major timeout and it is hard mounted, -+then allow signals to interupt the file operation and cause it to -+return EINTR to the calling program. The default is to not -+allow file operations to be interrupted. -+.TP 1.5i -+.I nocto -+Suppress the retrieval of new attributes when creating a file. -+.TP 1.5i -+.I noac -+Disable attribute caching, and force synchronous writes. -+This extracts a -+server performance penalty but it allows two different NFS clients -+to get reasonable good results when both clients are actively -+writing to common filesystem on the server. -+.P -+All of the non-value options have corresponding nooption forms. -+For example, nointr means don't allow file operations to be -+interrupted. - .SH FILES - .I /etc/fstab - .SH "SEE ALSO" -Index: util-linux-ng-2.12r+git20070330/mount/sundries.h -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/mount/sundries.h -+++ util-linux-ng-2.12r+git20070330/mount/sundries.h -@@ -40,6 +40,8 @@ void die (int errcode, const char *fmt, - - int nfsmount (const char *spec, const char *node, int *flags, - char **orig_opts, char **opt_args, int *version, int running_bg); -+int nfs4mount (const char *spec, const char *node, int *flags, -+ char **orig_opts, char **opt_args, int running_bg); - - /* exit status - bits below are ORed */ - #define EX_USAGE 1 /* incorrect invocation or permission */ -Index: util-linux-ng-2.12r+git20070330/mount/umount.c -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/mount/umount.c -+++ util-linux-ng-2.12r+git20070330/mount/umount.c -@@ -88,6 +88,9 @@ int verbose = 0; - /* True if ruid != euid. */ - int suid = 0; - -+/* Needed by nfs4mount.c */ -+int sloppy = 0; -+ - /* - * check_special_umountprog() - * If there is a special umount program for this type, exec it. -Index: util-linux-ng-2.12r+git20070330/mount/Makefile.am -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/mount/Makefile.am -+++ util-linux-ng-2.12r+git20070330/mount/Makefile.am -@@ -17,7 +17,7 @@ MNTHDRS = fstab.h linux_fs.h mount_mnten - mount_SOURCES = mount.c fstab.c sundries.c xmalloc.c realpath.c mount_mntent.c \ - get_label_uuid.c mount_by_label.c mount_blkid.c mount_guess_fstype.c \ - getusername.c \ -- nfsmount.c nfsmount_xdr.c nfsmount_clnt.c \ -+ nfsmount.c nfsmount_xdr.c nfsmount_clnt.c nfs4mount.c \ - lomount.c \ - $(MNTHDRS) - diff --git a/util-linux-2.12-mount_mountfallback.patch b/util-linux-2.12-mount_mountfallback.patch deleted file mode 100644 index 23a04f1..0000000 --- a/util-linux-2.12-mount_mountfallback.patch +++ /dev/null @@ -1,36 +0,0 @@ -Index: util-linux-ng-2.12r+2.13pre7/mount/nfsmount.c -=================================================================== ---- util-linux-ng-2.12r+2.13pre7.orig/mount/nfsmount.c -+++ util-linux-ng-2.12r+2.13pre7/mount/nfsmount.c -@@ -167,8 +167,20 @@ get_mountport(struct sockaddr_in *server - } - if (!p.pm_vers) - p.pm_vers = MOUNTVERS; -- if (!p.pm_prot) -+ if (!p.pm_prot) { - p.pm_prot = IPPROTO_TCP; -+ if (!p.pm_port) { -+ p.pm_port = pmap_getport(server_addr, -+ p.pm_prog, p.pm_vers, p.pm_prot); -+ } -+ /* Fall back to UDP if there's no TCP registration for mount */ -+ if (!p.pm_port) { -+ fprintf(stderr, "mount server reported tcp not available, falling back to udp\n"); -+ p.pm_prot = IPPROTO_UDP; -+ p.pm_port = pmap_getport(server_addr, -+ p.pm_prog, p.pm_vers, p.pm_prot); -+ } -+ } - #if 0 - if (!p.pm_port) { - p.pm_port = pmap_getport(server_addr, p.pm_prog, p.pm_vers, -@@ -582,7 +594,8 @@ retry_udp: - pm_mnt = get_mountport(&mount_server_addr, - mountprog, - mountvers, -- proto, -+ 0, /* TCP or UDP: pick -+ whatever is available */ - mountport, - nfs_mount_version); - diff --git a/util-linux-2.12-mount_nfs_tcp.patch b/util-linux-2.12-mount_nfs_tcp.patch deleted file mode 100644 index 69943e1..0000000 --- a/util-linux-2.12-mount_nfs_tcp.patch +++ /dev/null @@ -1,65 +0,0 @@ -Index: util-linux-ng-2.12r+2.13pre7/mount/nfs.5 -=================================================================== ---- util-linux-ng-2.12r+2.13pre7.orig/mount/nfs.5 -+++ util-linux-ng-2.12r+2.13pre7/mount/nfs.5 -@@ -199,11 +199,11 @@ writing to common filesystem on the serv - .TP 1.5i - .I tcp - Mount the NFS filesystem using the TCP protocol instead of the --default UDP protocol. Many NFS servers only support UDP. -+UDP protocol. This is the default, but in case it fails (many NFS servers only -+support UDP) it will fallback and try UDP. - .TP 1.5i - .I udp --Mount the NFS filesystem using the UDP protocol. This --is the default. -+Mount the NFS filesystem using the UDP protocol. - .TP 1.5i - .I noacl - Assume no extended access control mechanisms like POSIX ACLs are used -@@ -227,8 +227,5 @@ interrupted. - The posix, and nocto options are parsed by mount - but currently are silently ignored. - .P --The tcp and namlen options are implemented but are not currently --supported by the Linux kernel. --.P - The umount command should notify the server - when an NFS filesystem is unmounted. -Index: util-linux-ng-2.12r+2.13pre7/mount/nfsmount.c -=================================================================== ---- util-linux-ng-2.12r+2.13pre7.orig/mount/nfsmount.c -+++ util-linux-ng-2.12r+2.13pre7/mount/nfsmount.c -@@ -317,7 +317,7 @@ int nfsmount(const char *spec, const cha - noacl = 0; - noac = 0; - retry = 10000; /* 10000 minutes ~ 1 week */ -- tcp = 0; -+ tcp = 2; - - mountprog = MOUNTPROG; - mountvers = 0; -@@ -437,6 +437,8 @@ int nfsmount(const char *spec, const cha - } - } - } -+ -+retry_udp: - proto = (tcp) ? IPPROTO_TCP : IPPROTO_UDP; - - data.flags = (soft ? NFS_MOUNT_SOFT : 0) -@@ -740,7 +742,13 @@ int nfsmount(const char *spec, const cha - * '0' for port (service unavailable), we then exit, - * notifying the user, rather than hanging up mount. - */ -- if (port == 0 && tcp == 1) { -+ if (port == 0 && tcp) { -+ if (tcp == 2) { -+ fprintf(stderr, "nfs server reported tcp not available, falling back to udp\n"); -+ close(fsock); -+ tcp = 0; -+ goto retry_udp; -+ } - perror(_("nfs server reported service unavailable")); - goto fail; - } diff --git a/util-linux-2.12a-mount_mountbylabel-dm.patch b/util-linux-2.12a-mount_mountbylabel-dm.patch deleted file mode 100644 index c39636d..0000000 --- a/util-linux-2.12a-mount_mountbylabel-dm.patch +++ /dev/null @@ -1,65 +0,0 @@ -Index: util-linux-ng-2.12r+2.13pre7/mount/mount_by_label.c -=================================================================== ---- util-linux-ng-2.12r+2.13pre7.orig/mount/mount_by_label.c -+++ util-linux-ng-2.12r+2.13pre7/mount/mount_by_label.c -@@ -18,6 +18,8 @@ - * - Added JFS v2 format support - * 2002-07-26 Luciano Chavez - * - Added EVMS support -+ * 2004-08-11 Alasdair Kergon -+ * - Added LVM2/device-mapper support - */ - - #include -@@ -39,6 +41,7 @@ - #define VG_DIR "/proc/lvm/VGs" - #define EVMS_VOLUME_NAME_SIZE 127 - #define PROC_EVMS_VOLUMES "/proc/evms/volumes" -+#define DEVICEMAPPERDIR "/dev/mapper" - - extern char *progname; - -@@ -104,6 +107,34 @@ uuidcache_init_lvm(void) { - closedir(vg_dir); - } - -+/* LVM2/device-mapper support */ -+static void -+uuidcache_init_dm(void) { -+ char lvm_device[PATH_MAX]; -+ DIR *d; -+ struct dirent *lv_iter; -+ char uuid[16], *label; -+ -+ if (!(d = opendir(DEVICEMAPPERDIR))) { -+ if (errno != ENOENT) -+ perror("mount (init_dm)"); -+ return; -+ } -+ -+ while ((lv_iter = readdir(d))) { -+ if (!strcmp(lv_iter->d_name, "control") || -+ !strcmp(lv_iter->d_name, ".") || -+ !strcmp(lv_iter->d_name, "..")) -+ continue; -+ snprintf(lvm_device, sizeof(lvm_device), "%s/%s", -+ DEVICEMAPPERDIR, lv_iter->d_name); -+ if (!get_label_uuid(strdup(lvm_device), &label, uuid)) -+ uuidcache_addentry(strdup(lvm_device), -+ label, uuid); -+ } -+ closedir(d); -+} -+ - static int - uuidcache_init_evms(void) { - FILE *procvol; -@@ -256,6 +287,8 @@ uuidcache_init(void) { - fclose(procpt); - - uuidcache_init_lvm(); -+ -+ uuidcache_init_dm(); - } - - #define UUID 1 diff --git a/util-linux-2.12a-mount_mountpointwithcolon.patch b/util-linux-2.12a-mount_mountpointwithcolon.patch index aecc7d7..7b29286 100644 --- a/util-linux-2.12a-mount_mountpointwithcolon.patch +++ b/util-linux-2.12a-mount_mountpointwithcolon.patch @@ -9,7 +9,7 @@ Index: util-linux-ng-2.12r+git20070330/mount/mount.c - types = "nfs"; - if (verbose) - printf(_("mount: no type was given - " -+ types = do_guess_fstype(spec); ++ types = fsprobe_get_fstype_by_devname(spec); + if(types == NULL) { + types = "nfs"; + if (verbose) { diff --git a/util-linux-2.12q-mount_strict_aliasing.patch b/util-linux-2.12q-mount_strict_aliasing.patch deleted file mode 100644 index fe53e6d..0000000 --- a/util-linux-2.12q-mount_strict_aliasing.patch +++ /dev/null @@ -1,28 +0,0 @@ -Index: util-linux-ng-2.12r+git20070330/mount/Makefile.am -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/mount/Makefile.am -+++ util-linux-ng-2.12r+git20070330/mount/Makefile.am -@@ -17,11 +17,11 @@ MNTHDRS = fstab.h linux_fs.h mount_mnten - mount_SOURCES = mount.c fstab.c sundries.c xmalloc.c realpath.c mount_mntent.c \ - get_label_uuid.c mount_by_label.c mount_blkid.c mount_guess_fstype.c \ - getusername.c \ -- nfsmount.c nfsmount_xdr.c nfsmount_clnt.c nfs4mount.c \ -+ nfsmount.c nfsmount_clnt.c nfs4mount.c \ - lomount.c \ - $(MNTHDRS) - --mount_LDADD = $(top_srcdir)/lib/libenv.a $(top_srcdir)/lib/libsetproctitle.a -+mount_LDADD = $(top_srcdir)/lib/libenv.a $(top_srcdir)/lib/libsetproctitle.a libnfsmount_xdr.a - - umount_SOURCES = umount.c fstab.c sundries.c xmalloc.c realpath.c mount_mntent.c \ - getusername.c get_label_uuid.c mount_by_label.c mount_blkid.c \ -@@ -60,6 +60,9 @@ swapargs.h: - clean-local: - rm -f swapargs.h - -+noinst_LIBRARIES = libnfsmount_xdr.a -+libnfsmount_xdr_a_SOURCES = nfsmount_xdr.c -+libnfsmount_xdr_a_CFLAGS = -fno-strict-aliasing - - install-exec-hook: - chmod 4755 $(DESTDIR)$(bindir)/mount diff --git a/util-linux-2.12q-sys_utils_ionice.patch b/util-linux-2.12q-sys_utils_ionice.patch index c098a72..56ecf84 100644 --- a/util-linux-2.12q-sys_utils_ionice.patch +++ b/util-linux-2.12q-sys_utils_ionice.patch @@ -1,7 +1,7 @@ -Index: util-linux-ng-2.12r+2.13pre7/sys-utils/ionice.1 +Index: util-linux-ng-2.12r+git20070509/sys-utils/ionice.1 =================================================================== --- /dev/null -+++ util-linux-ng-2.12r+2.13pre7/sys-utils/ionice.1 ++++ util-linux-ng-2.12r+git20070509/sys-utils/ionice.1 @@ -0,0 +1,71 @@ +.TH ionice "1" "August 2005" ionice +.SH NAME @@ -74,10 +74,10 @@ Index: util-linux-ng-2.12r+2.13pre7/sys-utils/ionice.1 + +.SH AUTHORS +Jens Axboe -Index: util-linux-ng-2.12r+2.13pre7/sys-utils/ionice.c +Index: util-linux-ng-2.12r+git20070509/sys-utils/ionice.c =================================================================== --- /dev/null -+++ util-linux-ng-2.12r+2.13pre7/sys-utils/ionice.c ++++ util-linux-ng-2.12r+git20070509/sys-utils/ionice.c @@ -0,0 +1,144 @@ +/* + * ionice: set or get process io scheduling class and priority @@ -223,11 +223,11 @@ Index: util-linux-ng-2.12r+2.13pre7/sys-utils/ionice.c + + return 0; +} -Index: util-linux-ng-2.12r+2.13pre7/sys-utils/Makefile.am +Index: util-linux-ng-2.12r+git20070509/sys-utils/Makefile.am =================================================================== ---- util-linux-ng-2.12r+2.13pre7.orig/sys-utils/Makefile.am -+++ util-linux-ng-2.12r+2.13pre7/sys-utils/Makefile.am -@@ -2,17 +2,17 @@ +--- util-linux-ng-2.12r+git20070509.orig/sys-utils/Makefile.am ++++ util-linux-ng-2.12r+git20070509/sys-utils/Makefile.am +@@ -2,7 +2,7 @@ include $(top_srcdir)/config/include-Mak bin_PROGRAMS = dmesg @@ -236,14 +236,12 @@ Index: util-linux-ng-2.12r+2.13pre7/sys-utils/Makefile.am cytune_SOURCES = cytune.c cyclades.h - sbin_PROGRAMS = ctrlaltdel - - usrsbinexec_PROGRAMS = readprofile tunelp +@@ -12,7 +12,7 @@ usrsbinexec_PROGRAMS = readprofile tunel tunelp_SOURCES = tunelp.c lp.h -man_MANS = flock.1 readprofile.1 \ +man_MANS = flock.1 ionice.1 readprofile.1 \ - ctrlaltdel.8 cytune.8 dmesg.8 ipcrm.8 ipcs.8 renice.8 \ - setsid.8 tunelp.8 + ctrlaltdel.8 cytune.8 dmesg.1 ipcrm.1 ipcs.1 renice.1 \ + setsid.1 tunelp.8 diff --git a/util-linux-2.12r-mount_nfs_remount_options.patch b/util-linux-2.12r-mount_nfs_remount_options.patch deleted file mode 100644 index a700af5..0000000 --- a/util-linux-2.12r-mount_nfs_remount_options.patch +++ /dev/null @@ -1,20 +0,0 @@ -do not append addr option with each nfs remount [#130625] - -Index: util-linux-ng-2.12r+2.13pre7/mount/nfsmount.c -=================================================================== ---- util-linux-ng-2.12r+2.13pre7.orig/mount/nfsmount.c -+++ util-linux-ng-2.12r+2.13pre7/mount/nfsmount.c -@@ -303,8 +303,11 @@ int nfsmount(const char *spec, const cha - "excessively long option argument\n")); - goto fail; - } -- sprintf(new_opts, "%s%saddr=%s", -- old_opts, *old_opts ? "," : "", s); -+ if (*flags & MS_REMOUNT) -+ strcpy(new_opts, old_opts); -+ else -+ sprintf(new_opts, "%s%saddr=%s", -+ old_opts, *old_opts ? "," : "", s); - *extra_opts = xstrdup(new_opts); - - /* Set default options. diff --git a/util-linux-2.12r-mount_rpcsec_gss.patch b/util-linux-2.12r-mount_rpcsec_gss.patch deleted file mode 100644 index a5d8138..0000000 --- a/util-linux-2.12r-mount_rpcsec_gss.patch +++ /dev/null @@ -1,116 +0,0 @@ -Index: mount/nfsmount.c -=================================================================== ---- mount/nfsmount.c.orig -+++ mount/nfsmount.c -@@ -117,8 +117,10 @@ find_kernel_nfs_mount_version(void) { - nfs_mount_version = 4; /* since 2.2.18pre9 */ - else if (kernel_version < MAKE_VERSION(2,3,99)) - nfs_mount_version = 3; -+ else if (kernel_version < MAKE_VERSION(2,6,3)) -+ nfs_mount_version = 4; - else -- nfs_mount_version = 4; /* since 2.3.99pre4 */ -+ nfs_mount_version = 6; - } - if (nfs_mount_version > NFS_MOUNT_VERSION) - nfs_mount_version = NFS_MOUNT_VERSION; -@@ -318,7 +320,6 @@ int nfsmount(const char *spec, const cha - #if NFS_MOUNT_VERSION >= 2 - data.namlen = NAME_MAX; - #endif -- - bg = 0; - soft = 0; - intr = 0; -@@ -400,6 +401,38 @@ int nfsmount(const char *spec, const cha - printf(_("Warning: Option namlen is not supported.\n")); - } else if (!strcmp(opt, "addr")) { - /* ignore */; -+#if NFS_MOUNT_VERSION >= 5 -+ } else if (!strcmp(opt, "sec")) { -+ char *secflavor = opteq+1; -+ /* see RFC 2623 */ -+ if (nfs_mount_version < 5) { -+ printf(_("Warning: this version of mount(1) does not support RPCSEC_GSS, ignoring sec=%s option\n"), secflavor); -+ continue; -+ } else if (!strcmp(secflavor, "sys")) -+ data.pseudoflavor = AUTH_SYS; -+ else if (!strcmp(secflavor, "krb5")) -+ data.pseudoflavor = AUTH_GSS_KRB5; -+ else if (!strcmp(secflavor, "krb5i")) -+ data.pseudoflavor = AUTH_GSS_KRB5I; -+ else if (!strcmp(secflavor, "krb5p")) -+ data.pseudoflavor = AUTH_GSS_KRB5P; -+ else if (!strcmp(secflavor, "lipkey")) -+ data.pseudoflavor = AUTH_GSS_LKEY; -+ else if (!strcmp(secflavor, "lipkey-i")) -+ data.pseudoflavor = AUTH_GSS_LKEYI; -+ else if (!strcmp(secflavor, "lipkey-p")) -+ data.pseudoflavor = AUTH_GSS_LKEYP; -+ else if (!strcmp(secflavor, "spkm3")) -+ data.pseudoflavor = AUTH_GSS_SPKM; -+ else if (!strcmp(secflavor, "spkm3i")) -+ data.pseudoflavor = AUTH_GSS_SPKMI; -+ else if (!strcmp(secflavor, "spkm3p")) -+ data.pseudoflavor = AUTH_GSS_SPKMP; -+ else if(!sloppy) { -+ printf(_("Warning: Unrecognized security flavor %s.\n"), secflavor); -+ goto fail; -+ } -+#endif - } else { - printf(_("unknown nfs mount parameter: " - "%s=%d\n"), opt, val); -@@ -472,6 +505,11 @@ retry_udp: - data.flags |= (noacl ? NFS_MOUNT_NOACL : 0); - } - #endif -+#if NFS_MOUNT_VERSION >= 5 -+ if ((nfs_mount_version >= 5) && data.pseudoflavor) { -+ data.flags |= NFS_MOUNT_SECFLAVOUR; -+ } -+#endif - if (nfsvers > MAX_NFSPROT) { - fprintf(stderr, "NFSv%d not supported!\n", nfsvers); - return 0; -@@ -508,6 +546,9 @@ retry_udp: - printf("tcp = %d\n", - (data.flags & NFS_MOUNT_TCP) != 0); - #endif -+#if NFS_MOUNT_VERSION >= 5 -+ printf("sec = %u\n", data.pseudoflavor); -+#endif - #endif - - data.version = nfs_mount_version; -@@ -715,6 +756,30 @@ retry_udp: - nfs_strerror(status.nfsv3.fhs_status)); - goto fail; - } -+#if NFS_MOUNT_VERSION >= 5 -+ if (data.pseudoflavor) { -+ mountres3_ok *mountres = &status.nfsv3.mountres3_u.mountinfo; -+ int i = mountres->auth_flavours.auth_flavours_len; -+ -+ if (i > 0) { -+ int *flavor = mountres->auth_flavours.auth_flavours_val; -+ while (--i >= 0) { -+ if (flavor[i] == data.pseudoflavor) { -+ break; -+ } -+ } -+ -+ if (i < 0) { -+ fprintf(stderr, -+ "mount: %s:%s failed, security flavor not supported\n", -+ hostname, dirname); -+ mountproc3_umnt_3(&dirname,mclient); -+ goto fail; -+ } -+ } -+ } -+#endif -+ - fhandle = &status.nfsv3.mountres3_u.mountinfo.fhandle; - memset(data.old_root.data, 0, NFS_FHSIZE); - memset(&data.root, 0, sizeof(data.root)); diff --git a/util-linux-2.12r-mount_sec_manpage.patch b/util-linux-2.12r-mount_sec_manpage.patch deleted file mode 100644 index c0c5611..0000000 --- a/util-linux-2.12r-mount_sec_manpage.patch +++ /dev/null @@ -1,51 +0,0 @@ -From: http://www.citi.umich.edu/projects/nfsv4/linux/util-linux-patches -Subject: Update nfs(5) manpage to document security flavors -References: 159368 - -Acked-by: okir@suse.de - - mount/nfs.5 | 24 ++++++++++++++++++++---- - 1 files changed, 20 insertions(+), 4 deletions(-) - -Index: util-linux-ng-2.12r+2.13pre7/mount/nfs.5 -=================================================================== ---- util-linux-ng-2.12r+2.13pre7.orig/mount/nfs.5 -+++ util-linux-ng-2.12r+2.13pre7/mount/nfs.5 -@@ -165,7 +165,7 @@ mount daemon program number. - Use an alternate RPC version number to contact the - mount daemon on the remote host. This option is useful - for hosts that can run multiple NFS servers. --The default value is version 1. -+The default value depends on which kernel you are using. - .TP 1.5i - .I nfsprog=n - Use an alternate RPC program number to contact the -@@ -230,9 +230,25 @@ Suppress the retrieval of new attributes - .TP 1.5i - .I noac - Disable all forms of attribute caching entirely. This extracts a --server performance penalty but it allows two different NFS clients --to get reasonable good results when both clients are actively --writing to common filesystem on the server. -+significant performance penalty but it allows two different NFS clients -+to get reasonable results when both clients are actively -+writing to a common export on the server. -+.TP 1.5i -+.I sec=mode -+Set the security flavor for this mount to "mode". -+The default setting is \f3sec=sys\f1, which uses local -+unix uids and gids to authenticate NFS operations (AUTH_SYS). -+Other currently supported settings are: -+\f3sec=krb5\f1, which uses Kerberos V5 instead of local unix uids -+and gids to authenticate users; -+\f3sec=krb5i\f1, which uses Kerberos V5 for user authentication -+and performs integrity checking of NFS operations using secure -+checksums to prevent data tampering; and -+\f3sec=krb5p\f1, which uses Kerberos V5 for user authentication -+and integrity checking, and encrypts NFS traffic to prevent -+traffic sniffing (this is the most secure setting). -+Note that there is a performance penalty when using integrity -+or privacy. - .TP 1.5i - .I tcp - Mount the NFS filesystem using the TCP protocol instead of the diff --git a/util-linux-2.12r-mount_swapon_swsuspend_resume.patch b/util-linux-2.12r-mount_swapon_swsuspend_resume.patch index 7f44b78..8bc8e98 100644 --- a/util-linux-2.12r-mount_swapon_swsuspend_resume.patch +++ b/util-linux-2.12r-mount_swapon_swsuspend_resume.patch @@ -1,44 +1,4 @@ ## 30swsusp-resume.dpatch by Jeff Bailey -Index: util-linux-ng-2.12r+git20070330/mount/get_label_uuid.c -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/mount/get_label_uuid.c -+++ util-linux-ng-2.12r+git20070330/mount/get_label_uuid.c -@@ -93,7 +93,25 @@ is_v1_swap_partition(int fd, char **labe - } - return 0; - } -- -+ -+static int -+is_swsuspend_partition(int fd, char **label, char *uuid) { -+ int n = getpagesize(); -+ char *buf = xmalloc(n); -+ struct swap_header_v1_2 *p = (struct swap_header_v1_2 *) buf; -+ -+ if (lseek(fd, 0, SEEK_SET) == 0 -+ && read(fd, buf, n) == n -+ && (strncmp(buf+n-10, "S1SUSPEND", 9)==0 || -+ strncmp(buf+n-10, "S2SUSPEND", 9)==0 || -+ strncmp(buf+n-10, "ULSUSPEND", 9)==0) -+ && p->version == 1) { -+ store_uuid(uuid, p->uuid); -+ store_label(label, p->volume_name, 16); -+ return 1; -+ } -+ return 0; -+} - - /* - * Get both label and uuid. -@@ -126,6 +144,8 @@ get_label_uuid(const char *device, char - - if (is_v1_swap_partition(fd, label, uuid)) - goto done; -+ if (is_swsuspend_partition(fd, label, uuid)) -+ goto done; - - if (lseek(fd, 1024, SEEK_SET) == 1024 - && read(fd, (char *) &e2sb, sizeof(e2sb)) == sizeof(e2sb) Index: util-linux-ng-2.12r+git20070330/mount/swapon.c =================================================================== --- util-linux-ng-2.12r+git20070330.orig/mount/swapon.c diff --git a/util-linux-2.12r-mount_umount_nosysfs.patch b/util-linux-2.12r-mount_umount_nosysfs.patch deleted file mode 100644 index 97cc882..0000000 --- a/util-linux-2.12r-mount_umount_nosysfs.patch +++ /dev/null @@ -1,15 +0,0 @@ -Added sysfs to list of filesystems not to unmount with umount -a [#190385] - -Index: mount/umount.c -=================================================================== ---- mount/umount.c.orig -+++ mount/umount.c -@@ -721,7 +721,7 @@ main (int argc, char *argv[]) { - if (all) { - /* nodev stuff: sysfs, usbfs, oprofilefs, ... */ - if (types == NULL) -- types = "noproc,nodevfs,nodevpts"; -+ types = "noproc,nodevfs,nodevpts,nosysfs"; - result = umount_all (types, test_opts); - } else if (argc < 1) { - usage (stderr, 2); diff --git a/util-linux-2.13-mount_nfs_timeo.patch b/util-linux-2.13-mount_nfs_timeo.patch deleted file mode 100644 index 53b2141..0000000 --- a/util-linux-2.13-mount_nfs_timeo.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: util-linux-ng-2.12r+2.13pre7/mount/nfsmount.c -=================================================================== ---- util-linux-ng-2.12r+2.13pre7.orig/mount/nfsmount.c -+++ util-linux-ng-2.12r+2.13pre7/mount/nfsmount.c -@@ -487,7 +487,7 @@ retry_udp: - - /* Adjust options if none specified */ - if (!data.timeo) -- data.timeo = tcp ? 70 : 7; -+ data.timeo = tcp ? 600 : 7; - - #ifdef NFS_MOUNT_DEBUG - printf("rsize = %d, wsize = %d, timeo = %d, retrans = %d\n", diff --git a/util-linux-2.13-mount_volume_id.patch b/util-linux-2.13-mount_volume_id.patch new file mode 100644 index 0000000..e97aa1a --- /dev/null +++ b/util-linux-2.13-mount_volume_id.patch @@ -0,0 +1,3574 @@ +Signed-off-by: Karel Zak +--- + mount/Makefile.am | 8 ++-- + mount/fsprobe.h | 12 +++++ + mount/fsprobe_blkid.c | 111 ++++++++++++++++++++++++++++++++++++++++++++ + mount/fstab.c | 2 +- + mount/mount.c | 2 +- + mount/mount_blkid.c | 111 -------------------------------------------- + mount/mount_blkid.h | 12 ----- + mount/mount_guess_fstype.c | 2 +- + mount/swapon.c | 2 +- + 9 files changed, 131 insertions(+), 131 deletions(-) + +diff --git a/mount/Makefile.am b/mount/Makefile.am +index 95db3dd..930a0bf 100644 +--- a/mount/Makefile.am ++++ b/mount/Makefile.am +@@ -7,13 +7,13 @@ sbin_PROGRAMS = losetup swapon + man_MANS = fstab.5 mount.8 swapoff.8 swapon.8 umount.8 losetup.8 + + MNTHDRS = fstab.h linux_fs.h mount_mntent.h mount_constants.h my_dev_t.h \ +- mount_paths.h get_label_uuid.h lomount.h mount_blkid.h \ ++ mount_paths.h get_label_uuid.h lomount.h fsprobe.h \ + mount_guess_fstype.h realpath.h xmalloc.h \ + getusername.h loop.h mount_by_label.h mount_guess_rootdev.h \ + sundries.h + + mount_SOURCES = mount.c fstab.c sundries.c xmalloc.c realpath.c mount_mntent.c \ +- get_label_uuid.c mount_by_label.c mount_blkid.c mount_guess_fstype.c \ ++ get_label_uuid.c mount_by_label.c fsprobe_blkid.c mount_guess_fstype.c \ + getusername.c \ + lomount.c \ + $(MNTHDRS) +@@ -22,7 +22,7 @@ mount_LDADD = $(top_srcdir)/lib/libenv.a $(top_srcdir)/lib/libsetproctitle.a + mount_CFLAGS = $(SUID_CFLAGS) + + umount_SOURCES = umount.c fstab.c sundries.c xmalloc.c realpath.c mount_mntent.c \ +- getusername.c get_label_uuid.c mount_by_label.c mount_blkid.c \ ++ getusername.c get_label_uuid.c mount_by_label.c fsprobe_blkid.c \ + lomount.c \ + $(MNTHDRS) + +@@ -30,7 +30,7 @@ umount_LDADD = $(top_srcdir)/lib/libenv.a + umount_CFLAGS = $(SUID_CFLAGS) + + swapon_SOURCES = swapon.c xmalloc.c \ +- get_label_uuid.c mount_by_label.c mount_blkid.c \ ++ get_label_uuid.c mount_by_label.c fsprobe_blkid.c \ + swap_constants.h realpath.c + + losetup_SOURCES = lomount.c loop.h lomount.h +diff --git a/mount/fsprobe.h b/mount/fsprobe.h +new file mode 100644 +index 0000000..c96ff8c +--- /dev/null ++++ b/mount/fsprobe.h +@@ -0,0 +1,12 @@ ++#ifdef HAVE_LIBBLKID ++#include ++extern blkid_cache blkid; ++#endif ++ ++extern void mount_blkid_get_cache(void); ++extern void mount_blkid_put_cache(void); ++extern const char *mount_get_devname_by_uuid(const char *uuid); ++extern const char *mount_get_devname_by_label(const char *label); ++extern const char *mount_get_volume_label_by_spec(const char *spec); ++extern const char *mount_get_devname(const char *spec); ++extern const char *mount_get_devname_for_mounting(const char *spec); +diff --git a/mount/fsprobe_blkid.c b/mount/fsprobe_blkid.c +new file mode 100644 +index 0000000..0616945 +--- /dev/null ++++ b/mount/fsprobe_blkid.c +@@ -0,0 +1,111 @@ ++#include ++#include "fsprobe.h" ++ ++#ifdef HAVE_LIBBLKID ++ ++blkid_cache blkid; ++ ++void ++mount_blkid_get_cache(void) { ++ blkid_get_cache(&blkid, NULL); ++} ++ ++void ++mount_blkid_put_cache(void) { ++ blkid_put_cache(blkid); ++} ++ ++const char * ++mount_get_volume_label_by_spec(const char *spec) { ++ return blkid_get_tag_value(blkid, "LABEL", spec); ++} ++ ++const char * ++mount_get_devname(const char *spec) { ++ return blkid_get_devname(blkid, spec, 0); ++} ++ ++const char * ++mount_get_devname_by_uuid(const char *uuid) { ++ return blkid_get_devname(blkid, "UUID", uuid); ++} ++ ++const char * ++mount_get_devname_by_label(const char *label) { ++ return blkid_get_devname(blkid, "LABEL", label); ++} ++ ++/* Also when no UUID= or LABEL= occur? No verbose? No warnings? */ ++const char * ++mount_get_devname_for_mounting(const char *spec) { ++ return blkid_get_devname(blkid, spec, 0); ++} ++ ++#else ++#include ++#include "sundries.h" ++#include "mount_by_label.h" ++#include "nls.h" ++ ++void ++mount_blkid_get_cache(void) { ++} ++ ++void ++mount_blkid_put_cache(void) { ++} ++ ++const char * ++mount_get_volume_label_by_spec(const char *spec) { ++ return xstrdup(get_volume_label_by_spec(spec)); ++} ++ ++const char * ++mount_get_devname(const char *spec) { ++ if (!strncmp(spec, "UUID=", 5)) ++ return get_spec_by_uuid(spec+5); ++ if (!strncmp(spec, "LABEL=", 6)) ++ return get_spec_by_volume_label(spec+6); ++ return spec; ++} ++ ++const char * ++mount_get_devname_by_uuid(const char *uuid) { ++ return get_spec_by_uuid(uuid); ++} ++ ++extern char *progname; ++ ++const char * ++mount_get_devname_by_label(const char *volumelabel) { ++ const char *spec, *spec2; ++ ++ spec = get_spec_by_volume_label(volumelabel); ++ spec2 = second_occurrence_of_vol_label(volumelabel); ++ if (spec2) ++ die (EX_FAIL, ++ _("%s: error: the label %s occurs on both %s and %s\n"), ++ progname, volumelabel, spec, spec2); ++ return spec; ++} ++ ++const char * ++mount_get_devname_for_mounting(const char *spec) { ++ const char *nspec; ++ ++ if (!strncmp(spec, "UUID=", 5)) { ++ nspec = mount_get_devname_by_uuid(spec+5); ++ if (nspec && verbose > 1) ++ printf(_("mount: going to mount %s by UUID\n"), spec); ++ } else if (!strncmp(spec, "LABEL=", 6)) { ++ nspec = mount_get_devname_by_label(spec+6); ++ if (nspec && verbose > 1) ++ printf(_("mount: going to mount %s by label\n"), spec); ++ } else ++ nspec = spec; ++ ++ return nspec; ++} ++ ++ ++#endif +diff --git a/mount/fstab.c b/mount/fstab.c +index 72c46f3..5267f62 100644 +--- a/mount/fstab.c ++++ b/mount/fstab.c +@@ -15,7 +15,7 @@ + #include "fstab.h" + #include "sundries.h" + #include "xmalloc.h" +-#include "mount_blkid.h" ++#include "fsprobe.h" + #include "mount_paths.h" + #include "nls.h" + +diff --git a/mount/mount.c b/mount/mount.c +index 5058a7e..dfa44dc 100644 +--- a/mount/mount.c ++++ b/mount/mount.c +@@ -29,7 +29,7 @@ + #include + #endif + +-#include "mount_blkid.h" ++#include "fsprobe.h" + #include "mount_constants.h" + #include "sundries.h" + #include "xmalloc.h" +diff --git a/mount/mount_blkid.c b/mount/mount_blkid.c +deleted file mode 100644 +index 8fa30a1..0000000 +--- a/mount/mount_blkid.c ++++ /dev/null +@@ -1,111 +0,0 @@ +-#include +-#include "mount_blkid.h" +- +-#ifdef HAVE_LIBBLKID +- +-blkid_cache blkid; +- +-void +-mount_blkid_get_cache(void) { +- blkid_get_cache(&blkid, NULL); +-} +- +-void +-mount_blkid_put_cache(void) { +- blkid_put_cache(blkid); +-} +- +-const char * +-mount_get_volume_label_by_spec(const char *spec) { +- return blkid_get_tag_value(blkid, "LABEL", spec); +-} +- +-const char * +-mount_get_devname(const char *spec) { +- return blkid_get_devname(blkid, spec, 0); +-} +- +-const char * +-mount_get_devname_by_uuid(const char *uuid) { +- return blkid_get_devname(blkid, "UUID", uuid); +-} +- +-const char * +-mount_get_devname_by_label(const char *label) { +- return blkid_get_devname(blkid, "LABEL", label); +-} +- +-/* Also when no UUID= or LABEL= occur? No verbose? No warnings? */ +-const char * +-mount_get_devname_for_mounting(const char *spec) { +- return blkid_get_devname(blkid, spec, 0); +-} +- +-#else +-#include +-#include "sundries.h" +-#include "mount_by_label.h" +-#include "nls.h" +- +-void +-mount_blkid_get_cache(void) { +-} +- +-void +-mount_blkid_put_cache(void) { +-} +- +-const char * +-mount_get_volume_label_by_spec(const char *spec) { +- return xstrdup(get_volume_label_by_spec(spec)); +-} +- +-const char * +-mount_get_devname(const char *spec) { +- if (!strncmp(spec, "UUID=", 5)) +- return get_spec_by_uuid(spec+5); +- if (!strncmp(spec, "LABEL=", 6)) +- return get_spec_by_volume_label(spec+6); +- return spec; +-} +- +-const char * +-mount_get_devname_by_uuid(const char *uuid) { +- return get_spec_by_uuid(uuid); +-} +- +-extern char *progname; +- +-const char * +-mount_get_devname_by_label(const char *volumelabel) { +- const char *spec, *spec2; +- +- spec = get_spec_by_volume_label(volumelabel); +- spec2 = second_occurrence_of_vol_label(volumelabel); +- if (spec2) +- die (EX_FAIL, +- _("%s: error: the label %s occurs on both %s and %s\n"), +- progname, volumelabel, spec, spec2); +- return spec; +-} +- +-const char * +-mount_get_devname_for_mounting(const char *spec) { +- const char *nspec; +- +- if (!strncmp(spec, "UUID=", 5)) { +- nspec = mount_get_devname_by_uuid(spec+5); +- if (nspec && verbose > 1) +- printf(_("mount: going to mount %s by UUID\n"), spec); +- } else if (!strncmp(spec, "LABEL=", 6)) { +- nspec = mount_get_devname_by_label(spec+6); +- if (nspec && verbose > 1) +- printf(_("mount: going to mount %s by label\n"), spec); +- } else +- nspec = spec; +- +- return nspec; +-} +- +- +-#endif +diff --git a/mount/mount_blkid.h b/mount/mount_blkid.h +deleted file mode 100644 +index c96ff8c..0000000 +--- a/mount/mount_blkid.h ++++ /dev/null +@@ -1,12 +0,0 @@ +-#ifdef HAVE_LIBBLKID +-#include +-extern blkid_cache blkid; +-#endif +- +-extern void mount_blkid_get_cache(void); +-extern void mount_blkid_put_cache(void); +-extern const char *mount_get_devname_by_uuid(const char *uuid); +-extern const char *mount_get_devname_by_label(const char *label); +-extern const char *mount_get_volume_label_by_spec(const char *spec); +-extern const char *mount_get_devname(const char *spec); +-extern const char *mount_get_devname_for_mounting(const char *spec); +diff --git a/mount/mount_guess_fstype.c b/mount/mount_guess_fstype.c +index f1637f1..51d8750 100644 +--- a/mount/mount_guess_fstype.c ++++ b/mount/mount_guess_fstype.c +@@ -38,7 +38,7 @@ + #include + #include + #include "linux_fs.h" +-#include "mount_blkid.h" ++#include "fsprobe.h" + #include "mount_guess_fstype.h" + #include "sundries.h" /* for xstrdup */ + #include "nls.h" +diff --git a/mount/swapon.c b/mount/swapon.c +index b6bcd75..af4ba96 100644 +--- a/mount/swapon.c ++++ b/mount/swapon.c +@@ -15,7 +15,7 @@ + #include "swap_constants.h" + #include "swapargs.h" + #include "nls.h" +-#include "mount_blkid.h" ++#include "fsprobe.h" + #include "mount_by_label.h" + #include "realpath.h" + +-- +1.5.0.6 + +- +To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html + +This patch removes old FS detection code and enables +blkid code only when HAVE_BLKID is defined. + +Signed-off-by: Karel Zak +--- + mount/Makefile.am | 12 +- + mount/fsprobe_blkid.c | 67 ------- + mount/get_label_uuid.c | 221 ---------------------- + mount/get_label_uuid.h | 1 - + mount/linux_fs.h | 292 ----------------------------- + mount/mount.c | 1 - + mount/mount_by_label.c | 363 ------------------------------------ + mount/mount_by_label.h | 4 - + mount/mount_guess_fstype.c | 434 -------------------------------------------- + mount/swapon.c | 1 - + 10 files changed, 7 insertions(+), 1389 deletions(-) + +diff --git a/mount/Makefile.am b/mount/Makefile.am +index 930a0bf..6f63dcf 100644 +--- a/mount/Makefile.am ++++ b/mount/Makefile.am +@@ -7,13 +7,13 @@ sbin_PROGRAMS = losetup swapon + man_MANS = fstab.5 mount.8 swapoff.8 swapon.8 umount.8 losetup.8 + + MNTHDRS = fstab.h linux_fs.h mount_mntent.h mount_constants.h my_dev_t.h \ +- mount_paths.h get_label_uuid.h lomount.h fsprobe.h \ ++ mount_paths.h lomount.h fsprobe.h \ + mount_guess_fstype.h realpath.h xmalloc.h \ +- getusername.h loop.h mount_by_label.h mount_guess_rootdev.h \ ++ getusername.h loop.h mount_guess_rootdev.h \ + sundries.h + + mount_SOURCES = mount.c fstab.c sundries.c xmalloc.c realpath.c mount_mntent.c \ +- get_label_uuid.c mount_by_label.c fsprobe_blkid.c mount_guess_fstype.c \ ++ mount_guess_fstype.c \ + getusername.c \ + lomount.c \ + $(MNTHDRS) +@@ -22,7 +22,7 @@ mount_LDADD = $(top_srcdir)/lib/libenv.a $(top_srcdir)/lib/libsetproctitle.a + mount_CFLAGS = $(SUID_CFLAGS) + + umount_SOURCES = umount.c fstab.c sundries.c xmalloc.c realpath.c mount_mntent.c \ +- getusername.c get_label_uuid.c mount_by_label.c fsprobe_blkid.c \ ++ getusername.c \ + lomount.c \ + $(MNTHDRS) + +@@ -30,13 +30,15 @@ umount_LDADD = $(top_srcdir)/lib/libenv.a + umount_CFLAGS = $(SUID_CFLAGS) + + swapon_SOURCES = swapon.c xmalloc.c \ +- get_label_uuid.c mount_by_label.c fsprobe_blkid.c \ + swap_constants.h realpath.c + + losetup_SOURCES = lomount.c loop.h lomount.h + losetup_CFLAGS = -DMAIN + + if HAVE_BLKID ++mount_SOURCES += fsprobe_blkid.c ++umount_SOURCES += fsprobe_blkid.c ++swapon_SOURCES += fsprobe_blkid.c + mount_LDADD += -lblkid -luuid + umount_LDADD += -lblkid -luuid + swapon_LDADD = -lblkid -luuid +diff --git a/mount/fsprobe_blkid.c b/mount/fsprobe_blkid.c +index 0616945..9ff4e31 100644 +--- a/mount/fsprobe_blkid.c ++++ b/mount/fsprobe_blkid.c +@@ -41,71 +41,4 @@ mount_get_devname_for_mounting(const char *spec) { + return blkid_get_devname(blkid, spec, 0); + } + +-#else +-#include +-#include "sundries.h" +-#include "mount_by_label.h" +-#include "nls.h" +- +-void +-mount_blkid_get_cache(void) { +-} +- +-void +-mount_blkid_put_cache(void) { +-} +- +-const char * +-mount_get_volume_label_by_spec(const char *spec) { +- return xstrdup(get_volume_label_by_spec(spec)); +-} +- +-const char * +-mount_get_devname(const char *spec) { +- if (!strncmp(spec, "UUID=", 5)) +- return get_spec_by_uuid(spec+5); +- if (!strncmp(spec, "LABEL=", 6)) +- return get_spec_by_volume_label(spec+6); +- return spec; +-} +- +-const char * +-mount_get_devname_by_uuid(const char *uuid) { +- return get_spec_by_uuid(uuid); +-} +- +-extern char *progname; +- +-const char * +-mount_get_devname_by_label(const char *volumelabel) { +- const char *spec, *spec2; +- +- spec = get_spec_by_volume_label(volumelabel); +- spec2 = second_occurrence_of_vol_label(volumelabel); +- if (spec2) +- die (EX_FAIL, +- _("%s: error: the label %s occurs on both %s and %s\n"), +- progname, volumelabel, spec, spec2); +- return spec; +-} +- +-const char * +-mount_get_devname_for_mounting(const char *spec) { +- const char *nspec; +- +- if (!strncmp(spec, "UUID=", 5)) { +- nspec = mount_get_devname_by_uuid(spec+5); +- if (nspec && verbose > 1) +- printf(_("mount: going to mount %s by UUID\n"), spec); +- } else if (!strncmp(spec, "LABEL=", 6)) { +- nspec = mount_get_devname_by_label(spec+6); +- if (nspec && verbose > 1) +- printf(_("mount: going to mount %s by label\n"), spec); +- } else +- nspec = spec; +- +- return nspec; +-} +- +- + #endif +diff --git a/mount/get_label_uuid.c b/mount/get_label_uuid.c +deleted file mode 100644 +index 6d92e07..0000000 +--- a/mount/get_label_uuid.c ++++ /dev/null +@@ -1,221 +0,0 @@ +-#ifndef HAVE_LIBBLKID +-/* +- * Get label. Used by mount, umount and swapon. +- */ +-#include +-#include +-#include +-#include +-#include +- +-#include "xmalloc.h" +-#include "linux_fs.h" +-#include "get_label_uuid.h" +-#include "../disk-utils/swapheader.h" +- +-/* +- * 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 inline int +-is_raid_partition(int fd) { +-#if 0 +- struct mdp_super_block mdsb; +- int n; +- +- /* hardcode 4096 here in various places, because that's +- what it's defined to be. Note that even if we used +- the actual kernel headers, sizeof(mdp_super_t) is +- slightly larger in the 2.2 kernel on 64-bit archs, +- so using that wouldn't work. */ +- lseek(fd, -4096, SEEK_END); /* Ignore possible error +- about return value overflow */ +- n = 4096; +- if (sizeof(mdsb) < n) +- n = sizeof(mdsb); +- if (read(fd, &mdsb, n) != n) +- return 1; /* error */ +- return (mdsbmagic(mdsb) == MD_SB_MAGIC); +-#else +- return 0; +-#endif +-} +- +-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 void +-store_uuid(char *udest, char *usrc) { +- if (usrc) +- memcpy(udest, usrc, 16); +- else +- memset(udest, 0, 16); +-} +- +-static void +-store_label(char **ldest, char *lsrc, int len) { +- *ldest = xmalloc(len+1); +- memset(*ldest, 0, len+1); +- memcpy(*ldest, lsrc, len); +-} +- +-static int +-is_v1_swap_partition(int fd, char **label, char *uuid) { +- int n = getpagesize(); +- char *buf = xmalloc(n); +- struct swap_header_v1_2 *p = (struct swap_header_v1_2 *) buf; +- +- if (lseek(fd, 0, SEEK_SET) == 0 +- && read(fd, buf, n) == n +- && !strncmp(buf+n-10, "SWAPSPACE2", 10) +- && p->version == 1) { +- store_uuid(uuid, p->uuid); +- store_label(label, p->volume_name, 16); +- return 1; +- } +- return 0; +-} +- +- +-/* +- * Get both label and uuid. +- * For now, only ext2, ext3, xfs, ocfs, ocfs2, reiserfs, swap are supported +- * +- * Return 0 on success. +- */ +-int +-get_label_uuid(const char *device, char **label, char *uuid) { +- int fd; +- 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; +- struct ocfs2_super_block osb; +- struct reiserfs_super_block reiserfssb; +- int blksize; +- int rv = 0; +- +- fd = open(device, O_RDONLY); +- if (fd < 0) +- return -1; +- +- /* If there is a RAID partition, or an error, ignore this partition */ +- if (is_raid_partition(fd)) { +- rv = 1; +- goto done; +- } +- +- if (is_v1_swap_partition(fd, label, uuid)) +- goto done; +- +- if (lseek(fd, 1024, SEEK_SET) == 1024 +- && read(fd, (char *) &e2sb, sizeof(e2sb)) == sizeof(e2sb) +- && (ext2magic(e2sb) == EXT2_SUPER_MAGIC)) { +- store_uuid(uuid, e2sb.s_uuid); +- store_label(label, e2sb.s_volume_name, +- sizeof(e2sb.s_volume_name)); +- goto done; +- } +- +- if (lseek(fd, 0, SEEK_SET) == 0 +- && read(fd, (char *) &xfsb, sizeof(xfsb)) == sizeof(xfsb) +- && (strncmp(xfsb.s_magic, XFS_SUPER_MAGIC, 4) == 0)) { +- store_uuid(uuid, xfsb.s_uuid); +- store_label(label, xfsb.s_fname, sizeof(xfsb.s_fname)); +- goto done; +- } +- +- 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)) { +- store_uuid(uuid, NULL); +- store_label(label, olbl.label, ocfslabellen(olbl)); +- goto done; +- } +- +- 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)) { +- +-/* The situation for jfs is rather messy. The structure of the +- superblock changed a few times, but there seems to be no good way +- to check what kind of sb we have. +- Old (OS/2 compatible) jfs filesystems don't have UUIDs and have +- an 11-byte label in s_fpack[]. +- Kernel 2.5.6 supports jfs v1; 2.5.8 supports v2; 2.5.18 has label/uuid. +- Kernel 2.4.20 supports jfs v2 with label/uuid. +- s_version will be 2 for new filesystems using an external log. +- Other new filesystems will have version 1. +- Label and UUID can be set by jfs_tune. */ +- +-/* Let us believe label/uuid on v2, and on v1 only when label agrees +- with s_fpack in the first 11 bytes. */ +- +- if (assemble4le(jfssb.s_version) == 1 && +- strncmp(jfssb.s_label, jfssb.s_fpack, 11) != 0) { +- store_uuid(uuid, NULL); +- store_label(label, jfssb.s_fpack, +- sizeof(jfssb.s_fpack)); +- } else { +- store_uuid(uuid, jfssb.s_uuid); +- store_label(label, jfssb.s_label, +- sizeof(jfssb.s_label)); +- } +- goto done; +- } +- +- 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(reiserfssb.s_magic) > 1) { +- store_uuid(uuid, reiserfssb.s_uuid); +- store_label(label, reiserfssb.s_label, +- sizeof(reiserfssb.s_label)); +- goto done; +- } +- +- for (blksize = OCFS2_MIN_BLOCKSIZE; +- blksize <= OCFS2_MAX_BLOCKSIZE; +- blksize <<= 1) { +- int 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) { +- store_uuid(uuid, osb.s_uuid); +- store_label(label, osb.s_label, sizeof(osb.s_label)); +- goto done; +- } +- } +- rv = 1; +- done: +- close(fd); +- return rv; +-} +-#endif +diff --git a/mount/get_label_uuid.h b/mount/get_label_uuid.h +deleted file mode 100644 +index f52cc52..0000000 +--- a/mount/get_label_uuid.h ++++ /dev/null +@@ -1 +0,0 @@ +-int get_label_uuid(const char *device, char **label, char *uuid); +diff --git a/mount/linux_fs.h b/mount/linux_fs.h +index 430cbed..e47da2f 100644 +--- a/mount/linux_fs.h ++++ b/mount/linux_fs.h +@@ -13,295 +13,3 @@ + #endif + #endif + +-#define MINIX_SUPER_MAGIC 0x137F /* minix v1, 14 char names */ +-#define MINIX_SUPER_MAGIC2 0x138F /* minix v1, 30 char names */ +-#define MINIX2_SUPER_MAGIC 0x2468 /* minix v2, 14 char names */ +-#define MINIX2_SUPER_MAGIC2 0x2478 /* minix v2, 30 char names */ +-struct minix_super_block { +- u_char s_dummy[16]; +- u_char s_magic[2]; +-}; +-#define minixmagic(s) assemble2le(s.s_magic) +- +-#define ISODCL(from, to) (to - from + 1) +-#define ISO_STANDARD_ID "CD001" +-struct iso_volume_descriptor { +- char type[ISODCL(1,1)]; /* 711 */ +- char id[ISODCL(2,6)]; +- char version[ISODCL(7,7)]; +- char data[ISODCL(8,2048)]; +-}; +- +-#define HS_STANDARD_ID "CDROM" +-struct hs_volume_descriptor { +- char foo[ISODCL ( 1, 8)]; /* 733 */ +- char type[ISODCL ( 9, 9)]; /* 711 */ +- char id[ISODCL ( 10, 14)]; +- char version[ISODCL ( 15, 15)]; /* 711 */ +- char data[ISODCL(16,2048)]; +-}; +- +-#define EXT_SUPER_MAGIC 0x137D +-struct ext_super_block { +- u_char s_dummy[56]; +- u_char s_magic[2]; +-}; +-#define extmagic(s) assemble2le(s.s_magic) +- +-#define EXT2_PRE_02B_MAGIC 0xEF51 +-#define EXT2_SUPER_MAGIC 0xEF53 +-#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 +-struct ext2_super_block { +- u_char s_dummy1[56]; +- u_char s_magic[2]; +- u_char s_dummy2[34]; +- u_char s_feature_compat[4]; +- u_char s_feature_incompat[4]; +- u_char s_feature_ro_compat[4]; +- u_char s_uuid[16]; +- u_char s_volume_name[16]; +- u_char s_dummy3[88]; +- u_char s_journal_inum[4]; /* ext3 only */ +-}; +-#define ext2magic(s) assemble2le(s.s_magic) +- +-struct reiserfs_super_block +-{ +- u_char s_block_count[4]; +- u_char s_free_blocks[4]; +- u_char s_root_block[4]; +- u_char s_journal_block[4]; +- u_char s_journal_dev[4]; +- u_char s_orig_journal_size[4]; +- u_char s_journal_trans_max[4]; +- u_char s_journal_block_count[4]; +- u_char s_journal_max_batch[4]; +- u_char s_journal_max_commit_age[4]; +- u_char s_journal_max_trans_age[4]; +- u_char s_blocksize[2]; +- u_char s_oid_maxsize[2]; +- u_char s_oid_cursize[2]; +- u_char s_state[2]; +- u_char s_magic[10]; +- u_char s_dummy1[10]; +- u_char s_version[2]; /* only valid with relocated journal */ +- +- /* only valid in 3.6.x format --mason@suse.com */ +- u_char s_dummy2[10]; +- u_char s_uuid[16]; +- u_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) +- +-/* values of s_version when REISER3FS_SUPER_MAGIC_STRING is found */ +-#define REISERFS_VERSION_1 0 /* 3.5.x disk format */ +-#define REISERFS_VERSION_2 2 /* 3.6.x disk format */ +- +-extern int reiserfs_magic_version(const char *magic); +- +-#define _XIAFS_SUPER_MAGIC 0x012FD16D +-struct xiafs_super_block { +- u_char s_boot_segment[512]; /* 1st sector reserved for boot */ +- u_char s_dummy[60]; +- u_char s_magic[4]; +-}; +-#define xiafsmagic(s) assemble4le(s.s_magic) +- +-/* From jj@sunsite.ms.mff.cuni.cz Mon Mar 23 15:19:05 1998 */ +-#define UFS_SUPER_MAGIC_LE 0x00011954 +-#define UFS_SUPER_MAGIC_BE 0x54190100 +-struct ufs_super_block { +- u_char s_dummy[0x55c]; +- u_char s_magic[4]; +-}; +-#define ufsmagic(s) assemble4le(s.s_magic) +- +-/* From Richard.Russon@ait.co.uk Wed Feb 24 08:05:27 1999 */ +-#define NTFS_SUPER_MAGIC "NTFS" +-struct ntfs_super_block { +- u_char s_dummy[3]; +- u_char s_magic[4]; +-}; +- +-/* From inspection of a few FAT filesystems - aeb */ +-/* Unfortunately I find almost the same thing on an extended partition; +- it looks like a primary has some directory entries where the extended +- has a partition table: IO.SYS, MSDOS.SYS, WINBOOT.SYS */ +-struct fat_super_block { +- u_char s_dummy[3]; +- u_char s_os[8]; /* "MSDOS5.0" or "MSWIN4.0" or "MSWIN4.1" */ +- /* mtools-3.9.4 writes "MTOOL394" */ +- u_char s_dummy2[32]; +- u_char s_label[11]; /* for DOS? */ +- u_char s_fs[8]; /* "FAT12 " or "FAT16 " or all zero */ +- /* OS/2 BM has "FAT " here. */ +- u_char s_dummy3[9]; +- u_char s_label2[11]; /* for Windows? */ +- u_char s_fs2[8]; /* garbage or "FAT32 " */ +-}; +- +-#define XFS_SUPER_MAGIC "XFSB" +-struct xfs_super_block { +- u_char s_magic[4]; +- u_char s_dummy[28]; +- u_char s_uuid[16]; +- u_char s_dummy2[60]; +- u_char s_fname[12]; +-}; +- +-#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]; +- u_char s_id[16]; +-}; +-#define cramfsmagic(s) assemble4le(s.s_magic) +- +-#define HFS_SUPER_MAGIC 0x4244 +-struct hfs_super_block { +- u_char s_magic[2]; /* drSigWord */ +- u_char s_dummy[18]; +- u_char s_blksize[4]; /* drAlBlkSiz */ +-}; +-#define hfsmagic(s) assemble2be(s.s_magic) +-#define hfsblksize(s) assemble4be(s.s_blksize) +- +-#define HPFS_SUPER_MAGIC 0xf995e849 +-struct hpfs_super_block { +- u_char s_magic[4]; +- u_char s_magic2[4]; +-}; +-#define hpfsmagic(s) assemble4le(s.s_magic) +- +-struct adfs_super_block { +- u_char s_dummy[448]; +- u_char s_blksize[1]; +- u_char s_dummy2[62]; +- u_char s_checksum[1]; +-}; +-#define adfsblksize(s) ((uint) s.s_blksize[0]) +- +-/* found in first 4 bytes of block 1 */ +-struct vxfs_super_block { +- u_char s_magic[4]; +-}; +-#define vxfsmagic(s) assemble4le(s.s_magic) +-#define VXFS_SUPER_MAGIC 0xa501FCF5 +- +-struct jfs_super_block { +- char s_magic[4]; +- u_char s_version[4]; +- u_char s_dummy1[93]; +- char s_fpack[11]; +- u_char s_dummy2[24]; +- u_char s_uuid[16]; +- char s_label[16]; +-}; +-#define JFS_SUPER1_OFF 0x8000 +-#define JFS_MAGIC "JFS1" +- +-struct sysv_super_block { +- u_char s_dummy1[504]; +- u_char s_magic[4]; +- u_char type[4]; +-}; +-#define sysvmagic(s) assemble4le(s.s_magic) +-#define SYSV_SUPER_MAGIC 0xfd187e20 +- +-struct mdp_super_block { +- u_char md_magic[4]; +-}; +-#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" +- +-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]; +- char vd_nbytes[4]; +-}; +- +-struct efs_partition_table { /* size 12 */ +- char pt_nblks[4]; +- char pt_firstlbn[4]; +- char pt_type[4]; +-}; +- +-struct efs_volume_header { /* size 512 */ +- char vh_magic[4]; +- short vh_rootpt; +- short vh_swappt; +- char vh_bootfile[16]; +- char pad[48]; +- struct efs_volume_directory vh_vd[15]; +- struct efs_partition_table vh_pt[16]; +- int vh_csum; +- int vh_fill; +-}; +- +-struct efs_super { +- char fs_stuff[512+28]; +- char fs_magic[4]; +- char fs_fname[6]; +- char fs_fpack[6]; +- /* ... */ +-}; +- +-#define EFS_VHMAGIC 0x0be5a941 /* big endian */ +-#define EFS_SBMAGIC 0x00072959 /* idem */ +-#define EFS_SBMAGIC2 0x0007295a /* idem */ +- +-static inline int +-assemble2le(unsigned char *p) { +- return (p[0] | (p[1] << 8)); +-} +- +-static inline int +-assemble2be(unsigned char *p) { +- return (p[1] | (p[0] << 8)); +-} +- +-static inline int +-assemble4le(unsigned char *p) { +- return (p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24)); +-} +- +-static inline int +-assemble4be(unsigned char *p) { +- return (p[3] | (p[2] << 8) | (p[1] << 16) | (p[0] << 24)); +-} +diff --git a/mount/mount.c b/mount/mount.c +index dfa44dc..309e41e 100644 +--- a/mount/mount.c ++++ b/mount/mount.c +@@ -40,7 +40,6 @@ + #include "linux_fs.h" /* for BLKGETSIZE */ + #include "mount_guess_rootdev.h" + #include "mount_guess_fstype.h" +-#include "mount_by_label.h" + #include "getusername.h" + #include "mount_paths.h" + #include "env.h" +diff --git a/mount/mount_by_label.c b/mount/mount_by_label.c +deleted file mode 100644 +index 4899f03..0000000 +--- a/mount/mount_by_label.c ++++ /dev/null +@@ -1,363 +0,0 @@ +-#ifndef HAVE_LIBBLKID +-/* +- * mount_by_label.c - aeb +- * +- * 1999-02-22 Arkadiusz Mi¶kiewicz +- * - added Native Language Support +- * 2000-01-20 James Antill +- * - Added error message if /proc/partitions cannot be opened +- * 2000-05-09 Erik Troan +- * - Added cache for UUID and disk labels +- * 2000-11-07 Nathan Scott +- * - Added XFS support +- * 2001-11-22 Kirby Bohling +- * - Added support of labels on LVM +- * 2002-03-21 Christoph Hellwig +- * - Added JFS support +- * 2002-07-11 Christoph Hellwig +- * - Added JFS v2 format support +- * 2002-07-26 Luciano Chavez +- * - Added EVMS support +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include /* needed for opendir */ +-#include +-#include "sundries.h" /* for xstrdup */ +-#include "linux_fs.h" +-#include "get_label_uuid.h" +-#include "mount_by_label.h" +-#include "nls.h" +- +-#define PROC_PARTITIONS "/proc/partitions" +-#define DEVLABELDIR "/dev" +-#define VG_DIR "/proc/lvm/VGs" +-#define EVMS_VOLUME_NAME_SIZE 127 +-#define PROC_EVMS_VOLUMES "/proc/evms/volumes" +- +-extern char *progname; +- +-static struct uuidCache_s { +- struct uuidCache_s *next; +- char uuid[16]; +- char *label; +- char *device; +-} *uuidCache = NULL; +- +-static void +-uuidcache_addentry(char *device, char *label, char *uuid) { +- struct uuidCache_s *last; +- +- if (!uuidCache) { +- last = uuidCache = malloc(sizeof(*uuidCache)); +- } else { +- for (last = uuidCache; last->next; last = last->next); +- last->next = malloc(sizeof(*uuidCache)); +- last = last->next; +- } +- last->next = NULL; +- last->device = device; +- last->label = label; +- memcpy(last->uuid, uuid, sizeof(last->uuid)); +-} +- +-/* LVM support - Kirby Bohling */ +-static void +-uuidcache_init_lvm(void) { +- char buffer[PATH_MAX]; +- char lvm_device[PATH_MAX]; +- DIR *vg_dir, *lv_list; +- struct dirent *vg_iter, *lv_iter; +- char uuid[16], *label; +- +- vg_dir = opendir(VG_DIR); +- if (vg_dir == NULL) /* to be expected */ +- return; +- +- seekdir(vg_dir, 2); +- while ((vg_iter = readdir(vg_dir)) != 0) { +- sprintf(buffer, "%s/%s/LVs", VG_DIR, vg_iter->d_name); +- lv_list = opendir(buffer); +- if (lv_list == NULL) { +- perror("uuidcache_init_lvm"); +- continue; +- } +- seekdir(lv_list, 2); +- while ((lv_iter = readdir(lv_list)) != 0) { +- /* Now we have the file.. could open it and read out +- * where the device is, read the first line, second +- * field... Instead we guess. +- */ +- sprintf(lvm_device, "%s/%s/%s", DEVLABELDIR, +- vg_iter->d_name, lv_iter->d_name); +- if (!get_label_uuid(lvm_device, &label, uuid)) +- uuidcache_addentry(xstrdup(lvm_device), +- label, uuid); +- } +- closedir(lv_list); +- } +- closedir(vg_dir); +-} +- +-static int +-uuidcache_init_evms(void) { +- FILE *procvol; +- char *label; +- char uuid[16]; +- char volname[EVMS_VOLUME_NAME_SIZE+1]; +- char line[EVMS_VOLUME_NAME_SIZE+80]; +- +- procvol = fopen(PROC_EVMS_VOLUMES, "r"); +- if (!procvol) +- return 0; +- +- while (fgets(line, sizeof(line), procvol)) { +- if (sscanf(line, "%*d %*d %*d %*s %*s %[^\n]", volname) == 1) { +- if (!get_label_uuid(volname, &label, uuid)) +- uuidcache_addentry(xstrdup(volname), label, uuid); +- } +- } +- +- fclose(procvol); +- +- return 1; +-} +- +-/* +- * xvm is a proprietary sgi volume manager, it goes into /proc/partitions +- * like this: +- * +- * 4 0 2210817 xvm/local/vol/myvolume/data/block +- * 4 1 2210817 xvm/local/vol/myvolume/rt/block +- * 4 2 2210817 xvm/local/vol/myvolume/log/block +- * 4 3 2210818 xvm/local/vol/discs3/data/block +- * +- * The heuristics here are that the device should start with "xvm," +- * but should not end in "log/block" or "rt/block" - those are +- * special devices for the xfs filesystem external log & realtime device. +- */ +- +-/* Return 1 if this looks like an xvm device that should be scanned */ +-static int +-is_xvm(char *ptname) +-{ +- int len; +- +- /* if it doesn't start with "xvm," we're done. */ +- if (strncmp(ptname, "xvm", 3)) +- return 0; +- +- len = strlen(ptname); +- /* +- * check for "log/block" or "rt/block" on the end, +- * these are special - don't scan. +- */ +- if (!strncmp(ptname+(len-9), "log/block", 9) || +- !strncmp(ptname+(len-8), "rt/block", 8)) +- return 0; +- +- return 1; +-} +- +-static void +-uuidcache_init(void) { +- char line[100]; +- char *s; +- int ma, mi, sz; +- static char ptname[100]; +- FILE *procpt; +- char uuid[16], *label; +- char device[110]; +- int firstPass; +- int handleOnFirst; +-#if 0 +- char iobuf[32*1024]; /* For setvbuf */ +-#endif +- +- if (uuidCache) +- return; +- +- if (uuidcache_init_evms()) +- return; +- +- procpt = fopen(PROC_PARTITIONS, "r"); +- if (!procpt) { +- static int warn = 0; +- if (!warn++) +- error (_("%s: could not open %s, so UUID and LABEL " +- "conversion cannot be done.\n"), +- progname, PROC_PARTITIONS); +- return; +- } +-#if 0 +-/* Ugly kludge - the contents of /proc/partitions change in time, +- and this causes failures when the file is not read in one go. +- In particular, one cannot use stdio on /proc/partitions. +- Doing this ourselves is not easy either, since stat returns 0 +- so the size is unknown. We might try increasing buffer sizes +- until a single read gets all. For now only pick a largish buffer size. */ +-/* All these troubles are mainly caused by people who patch the kernel +- to keep statistics in /proc/partitions. Of course, statistics belong +- in some /proc/diskstats, not in some /proc file that happened to +- exist already. */ +- +- setvbuf(procpt, iobuf, _IOFBF, sizeof(iobuf)); +-#endif +- +- for (firstPass = 1; firstPass >= 0; firstPass--) { +- fseek(procpt, 0, SEEK_SET); +- +- while (fgets(line, sizeof(line), procpt)) { +- if (!index(line, '\n')) +- break; +- +- if (sscanf (line, " %d %d %d %[^\n ]", +- &ma, &mi, &sz, ptname) != 4) +- continue; +- +- /* skip extended partitions (heuristic: size 1) */ +- if (sz == 1) +- continue; +- +- /* look only at md devices on first pass */ +- handleOnFirst = !strncmp(ptname, "md", 2); +- if (firstPass != handleOnFirst) +- continue; +- +- /* skip entire disk (minor 0, 64, ... on ide; +- 0, 16, ... on sd) */ +- /* heuristic: partition name ends in a digit */ +- /* devfs has .../disc and .../part1 etc. */ +- +- for (s = ptname; *s; s++); +- if (isdigit(s[-1]) || is_xvm(ptname)) { +- +- /* +- * Note: this is a heuristic only - there is no reason +- * why these devices should live in /dev. +- * Perhaps this directory should be specifiable by option. +- * One might for example have /devlabel with links to /dev +- * for the devices that may be accessed in this way. +- * (This is useful, if the cdrom on /dev/hdc must not +- * be accessed.) +- */ +- sprintf(device, "%s/%s", DEVLABELDIR, ptname); +- if (!get_label_uuid(device, &label, uuid)) +- uuidcache_addentry(xstrdup(device), label, uuid); +- } +- } +- } +- +- fclose(procpt); +- +- uuidcache_init_lvm(); +-} +- +-#define UUID 1 +-#define VOL 2 +- +-static const char * +-get_spec_by_x(int n, const char *t) { +- struct uuidCache_s *uc; +- +- uuidcache_init(); +- uc = uuidCache; +- +- while (uc) { +- switch (n) { +- case UUID: +- if (!memcmp(t, uc->uuid, sizeof(uc->uuid))) +- return xstrdup(uc->device); +- break; +- case VOL: +- if (uc->label && !strcmp(t, uc->label)) +- return xstrdup(uc->device); +- break; +- } +- uc = uc->next; +- } +- return NULL; +-} +- +-static u_char +-fromhex(char c) { +- if (isdigit(c)) +- return (c - '0'); +- else if (islower(c)) +- return (c - 'a' + 10); +- else +- return (c - 'A' + 10); +-} +- +-const char * +-get_spec_by_uuid(const char *s) { +- u_char uuid[16]; +- int i; +- +- if (strlen(s) != 36 || +- s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-') +- goto bad_uuid; +- for (i=0; i<16; i++) { +- if (*s == '-') s++; +- if (!isxdigit(s[0]) || !isxdigit(s[1])) +- goto bad_uuid; +- uuid[i] = ((fromhex(s[0])<<4) | fromhex(s[1])); +- s += 2; +- } +- return get_spec_by_x(UUID, uuid); +- +- bad_uuid: +- die(EX_USAGE, _("%s: bad UUID"), progname); +- return NULL; /* just for gcc */ +-} +- +-const char * +-get_spec_by_volume_label(const char *s) { +- return get_spec_by_x(VOL, s); +-} +- +-const char * +-get_volume_label_by_spec(const char *spec) { +- struct uuidCache_s *uc; +- +- uuidcache_init(); +- uc = uuidCache; +- +- while(uc) { +- if (!strcmp(spec, uc->device)) +- return uc->label; +- uc = uc->next; +- } +- return NULL; +-} +- +-/* +- * second_occurrence_of_vol_label() +- * As labels are user defined they are not necessarily +- * system-wide unique. Make sure that they are. +- */ +-const char * +-second_occurrence_of_vol_label (const char *label) { +- struct uuidCache_s *last; +- int occurrences = 0; +- +- uuidcache_init(); +- +- for (last = uuidCache; last; last = last->next) { +- if (last->label && !strcmp(last->label, label)) { +- occurrences++; +- if (occurrences == 2) +- return last->device; +- } +- } +- +- return NULL; +-} +- +- +-#endif +diff --git a/mount/mount_by_label.h b/mount/mount_by_label.h +deleted file mode 100644 +index f5c930d..0000000 +--- a/mount/mount_by_label.h ++++ /dev/null +@@ -1,4 +0,0 @@ +-const char *get_spec_by_uuid(const char *uuid); +-const char *get_spec_by_volume_label(const char *volumelabel); +-const char *get_volume_label_by_spec(const char *spec); +-const char *second_occurrence_of_vol_label(const char *label); +diff --git a/mount/mount_guess_fstype.c b/mount/mount_guess_fstype.c +index 51d8750..01c3fc7 100644 +--- a/mount/mount_guess_fstype.c ++++ b/mount/mount_guess_fstype.c +@@ -46,8 +46,6 @@ + #define ETC_FILESYSTEMS "/etc/filesystems" + #define PROC_FILESYSTEMS "/proc/filesystems" + +-#ifdef HAVE_LIBBLKID +- + char * + do_guess_fstype(const char *device) + { +@@ -60,438 +58,6 @@ known_fstype(const char *fstype) + return blkid_known_fstype(fstype); + } + +-#else +-#define SIZE(a) (sizeof(a)/sizeof(a[0])) +- +-/* Most file system types can be recognized by a `magic' number +- in the superblock. Note that the order of the tests is +- significant: by coincidence a filesystem can have the +- magic numbers for several file system types simultaneously. +- For example, the romfs magic lives in the 1st sector; +- xiafs does not touch the 1st sector and has its magic in +- the 2nd sector; ext2 does not touch the first two sectors. */ +- +-static inline unsigned short +-swapped(unsigned short a) { +- return (a>>8) | (a<<8); +-} +- +-/* +- char *guess_fstype(const char *device); +- +- Probes the device and attempts to determine the type of filesystem +- contained within. +- +- Original routine by ; made into a function +- for mount(8) by Mike Grupenhoff . +- Corrected the test for xiafs - aeb +- Read the superblock only once - aeb +- Added a very weak heuristic for vfat - aeb +- Added efs, iso9660, minix-v2, romfs, qnx4, udf, vxfs, swap - aeb +- Added a test for high sierra (iso9660) - quinlan@bucknell.edu +- Added ufs from a patch by jj. But maybe there are several types of ufs? +- Added ntfs from a patch by Richard Russon. +- Added xfs - 2000-03-21 Martin K. Petersen +- Added cramfs, hfs, hpfs, adfs - Sepp Wijnands +- Added ext3 - Andrew Morton +- Added jfs - Christoph Hellwig +- Added sysv - Tim Launchbury +- Added udf - Bryce Nesbitt +- Added ocfs, ocfs2 - Manish Singh - http://oss.oracle.com/projects/ocfs2/ +-*/ +-static char +-*magic_known[] = { +- "adfs", "bfs", "cramfs", "efs", "ext", "ext2", "ext3", +- "hfs", "hpfs", "iso9660", "jfs", "minix", "ntfs", "ocfs", "ocfs2", +- "qnx4", "reiserfs", "romfs", "swap", "sysv", "udf", "ufs", +- "vxfs", "xfs", "xiafs" +-}; +- +-static int +-known_fstype(const char *fstype) { +- char **m; +- +- for (m = magic_known; m - magic_known < SIZE(magic_known); m++) +- if (!strcmp(*m, fstype)) +- return 1; +- return 0; +-} +- +-/* +- * udf magic - I find that trying to mount garbage as an udf fs +- * causes a very large kernel delay, almost killing the machine. +- * So, we do not try udf unless there is positive evidence that it +- * might work. Strings below taken from ECMA 167. +- */ +-/* +- * It seems that before udf 2.00 the volume descriptor was not well +- * defined. For 2.00 you're supposed to keep scanning records until +- * you find one NOT in this list. (See ECMA 2/8.3.1). +- */ +-static char +-*udf_magic[] = { "BEA01", "BOOT2", "CD001", "CDW02", "NSR02", +- "NSR03", "TEA01" }; +- +- +-static int +-may_be_udf(const char *id) { +- char **m; +- +- for (m = udf_magic; m - udf_magic < SIZE(udf_magic); m++) +- if (!strncmp(*m, id, 5)) +- return 1; +- return 0; +-} +- +-/* we saw "CD001" - may be iso9660 or udf - Bryce Nesbitt */ +-static int +-is_really_udf(int fd) { +- int j, bs; +- struct iso_volume_descriptor isosb; +- +- /* determine the block size by scanning in 2K increments +- (block sizes larger than 2K will be null padded) */ +- for (bs = 1; bs < 16; bs++) { +- lseek(fd, bs*2048+32768, SEEK_SET); +- if (read(fd, (char *)&isosb, sizeof(isosb)) != sizeof(isosb)) +- return 0; +- if (isosb.id[0]) +- break; +- } +- +- /* Scan up to another 64 blocks looking for additional VSD's */ +- for (j = 1; j < 64; j++) { +- if (j > 1) { +- lseek(fd, j*bs*2048+32768, SEEK_SET); +- if (read(fd, (char *)&isosb, sizeof(isosb)) +- != sizeof(isosb)) +- return 0; +- } +- /* If we find NSR0x then call it udf: +- NSR01 for UDF 1.00 +- NSR02 for UDF 1.50 +- NSR03 for UDF 2.00 */ +- if (!strncmp(isosb.id, "NSR0", 4)) +- return 1; +- if (!may_be_udf(isosb.id)) +- return 0; +- } +- +- return 0; +-} +- +-static int +-may_be_swap(const char *s) { +- return (strncmp(s-10, "SWAP-SPACE", 10) == 0 || +- strncmp(s-10, "SWAPSPACE2", 10) == 0); +-} +- +-/* rather weak necessary condition */ +-static int +-may_be_adfs(const u_char *s) { +- u_char *p; +- int sum; +- +- p = (u_char *) s + 511; +- sum = 0; +- while (--p != s) +- sum = (sum >> 8) + (sum & 0xff) + *p; +- +- return (sum == p[511]); +-} +- +-char * +-do_guess_fstype(const char *device) { +- int fd; +- char *type = NULL; +- union { +- struct xiafs_super_block xiasb; +- char romfs_magic[8]; +- char qnx4fs_magic[10]; /* ignore first 4 bytes */ +- long bfs_magic; +- struct ntfs_super_block ntfssb; +- 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 */ +- union { +- struct minix_super_block ms; +- struct ext_super_block es; +- struct ext2_super_block e2s; +- struct vxfs_super_block vs; +- } sb; /* stuff at 1024 */ +- struct ufs_super_block ufssb; +- union { +- struct iso_volume_descriptor iso; +- struct hs_volume_descriptor hs; +- } isosb; +- struct reiserfs_super_block reiserfssb; /* block 64 or 8 */ +- struct jfs_super_block jfssb; /* block 32 */ +- struct hfs_super_block hfssb; +- 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 +- undesired side effects - first check that `device' refers +- to a block device or ordinary file */ +- if (stat (device, &statbuf) || +- !(S_ISBLK(statbuf.st_mode) || S_ISREG(statbuf.st_mode))) +- return 0; +- +- fd = open(device, O_RDONLY); +- if (fd < 0) +- return 0; +- +- /* do seeks and reads in disk order, otherwise a very short +- partition may cause a failure because of read error */ +- +- if (!type) { +- /* block 0 */ +- if (lseek(fd, 0, SEEK_SET) != 0 +- || read(fd, (char *) &xsb, sizeof(xsb)) != sizeof(xsb)) +- goto try_iso9660; +- /* Gyorgy Kovesdi: none of my photocds has a readable block 0 */ +- +- if (xiafsmagic(xsb.xiasb) == _XIAFS_SUPER_MAGIC) +- type = "xiafs"; +- else if(!strncmp(xsb.romfs_magic, "-rom1fs-", 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) +- type = "bfs"; +- 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 || +- cramfsmagic(xsb.cramfssb) == CRAMFS_SUPER_MAGIC_BE) +- type = "cramfs"; +- else if (assemble4be(xsb.efsvh.vh_magic) == EFS_VHMAGIC) +- type = "efs"; /* EFS volume header */ +- /* might check checksum here */ +- else if (assemble4be(xsb.efssb.fs_magic) == EFS_SBMAGIC || +- assemble4be(xsb.efssb.fs_magic) == EFS_SBMAGIC2) +- type = "efs"; /* EFS partition */ +- else if ((!strncmp(xsb.fatsb.s_os, "MSDOS", 5) || +- !strncmp(xsb.fatsb.s_os, "MSWIN", 5) || +- !strncmp(xsb.fatsb.s_os, "MTOOL", 5) || +- !strncmp(xsb.fatsb.s_os, "IBM", 3) || +- !strncmp(xsb.fatsb.s_os, "DRDOS", 5) || +- !strncmp(xsb.fatsb.s_os, "mkdosfs", 7) || +- !strncmp(xsb.fatsb.s_os, "kmkdosfs", 8) || +- /* Michal Svec: created by fdformat, old msdos utility for +- formatting large (1.7) floppy disks. */ +- !strncmp(xsb.fatsb.s_os, "CH-FOR18", 8)) +- && (!strncmp(xsb.fatsb.s_fs, "FAT12 ", 8) || +- !strncmp(xsb.fatsb.s_fs, "FAT16 ", 8) || +- !strncmp(xsb.fatsb.s_fs2, "FAT32 ", 8))) +- type = "vfat"; /* only guessing - might as well be fat or umsdos */ +- } +- +- if (!type) { +- /* sector 1 */ +- if (lseek(fd, 512 , SEEK_SET) != 512 +- || read(fd, (char *) &svsb, sizeof(svsb)) != sizeof(svsb)) +- goto io_error; +- if (sysvmagic(svsb) == SYSV_SUPER_MAGIC ) +- type = "sysv"; +- } +- +- if (!type) { +- /* block 1 */ +- if (lseek(fd, 1024, SEEK_SET) != 1024 || +- read(fd, (char *) &sb, sizeof(sb)) != sizeof(sb)) +- goto io_error; +- +- /* ext2 has magic in little-endian on disk, so "swapped" is +- superfluous; however, there have existed strange byteswapped +- PPC ext2 systems */ +- if (ext2magic(sb.e2s) == EXT2_SUPER_MAGIC || +- ext2magic(sb.e2s) == EXT2_PRE_02B_MAGIC || +- ext2magic(sb.e2s) == swapped(EXT2_SUPER_MAGIC)) { +- type = "ext2"; +- +- /* maybe even ext3? */ +- if ((assemble4le(sb.e2s.s_feature_compat) +- & EXT3_FEATURE_COMPAT_HAS_JOURNAL) && +- assemble4le(sb.e2s.s_journal_inum) != 0) +- type = "ext3"; /* "ext3,ext2" */ +- } +- +- else if (minixmagic(sb.ms) == MINIX_SUPER_MAGIC || +- minixmagic(sb.ms) == MINIX_SUPER_MAGIC2 || +- minixmagic(sb.ms) == swapped(MINIX_SUPER_MAGIC2) || +- minixmagic(sb.ms) == MINIX2_SUPER_MAGIC || +- minixmagic(sb.ms) == MINIX2_SUPER_MAGIC2) +- type = "minix"; +- +- else if (extmagic(sb.es) == EXT_SUPER_MAGIC) +- type = "ext"; +- +- else if (vxfsmagic(sb.vs) == VXFS_SUPER_MAGIC) +- type = "vxfs"; +- } +- +- if (!type) { +- /* block 1 */ +- if (lseek(fd, 0x400, SEEK_SET) != 0x400 +- || read(fd, (char *) &hfssb, sizeof(hfssb)) != sizeof(hfssb)) +- goto io_error; +- +- /* also check if block size is equal to 512 bytes, +- or a multiple. (I see 1536 here.) */ +- if (hfsmagic(hfssb) == HFS_SUPER_MAGIC && /* always BE */ +- hfsblksize(hfssb) != 0 && +- (hfsblksize(hfssb) & 0x1ff) == 0) +- type = "hfs"; +- } +- +- if (!type) { +- /* block 3 */ +- if (lseek(fd, 0xc00, SEEK_SET) != 0xc00 +- || read(fd, (char *) &adfssb, sizeof(adfssb)) != sizeof(adfssb)) +- goto io_error; +- +- /* only a weak test */ +- if (may_be_adfs((u_char *) &adfssb) +- && (adfsblksize(adfssb) >= 8 && +- adfsblksize(adfssb) <= 10)) +- type = "adfs"; +- } +- +- if (!type) { +- int mag; +- +- /* block 8 */ +- if (lseek(fd, 8192, SEEK_SET) != 8192 +- || read(fd, (char *) &ufssb, sizeof(ufssb)) != sizeof(ufssb)) +- goto io_error; +- +- mag = ufsmagic(ufssb); +- if (mag == UFS_SUPER_MAGIC_LE || mag == UFS_SUPER_MAGIC_BE) +- type = "ufs"; +- } +- +- if (!type) { +- /* block 8 */ +- if (lseek(fd, REISERFS_OLD_DISK_OFFSET_IN_BYTES, SEEK_SET) != +- REISERFS_OLD_DISK_OFFSET_IN_BYTES +- || read(fd, (char *) &reiserfssb, sizeof(reiserfssb)) != +- sizeof(reiserfssb)) +- goto io_error; +- if (reiserfs_magic_version(reiserfssb.s_magic)) +- type = "reiserfs"; +- } +- +- if (!type) { +- /* block 8 */ +- if (lseek(fd, 0x2000, SEEK_SET) != 0x2000 +- || read(fd, (char *) &hpfssb, sizeof(hpfssb)) != sizeof(hpfssb)) +- goto io_error; +- +- if (hpfsmagic(hpfssb) == HPFS_SUPER_MAGIC) +- type = "hpfs"; +- } +- +- if (!type) { +- /* block 32 */ +- if (lseek(fd, JFS_SUPER1_OFF, SEEK_SET) != JFS_SUPER1_OFF +- || read(fd, (char *) &jfssb, sizeof(jfssb)) != sizeof(jfssb)) +- goto io_error; +- if (!strncmp(jfssb.s_magic, JFS_MAGIC, 4)) +- type = "jfs"; +- } +- +- if (!type) { +- /* block 32 */ +- try_iso9660: +- if (lseek(fd, 0x8000, SEEK_SET) != 0x8000 +- || read(fd, (char *) &isosb, sizeof(isosb)) != sizeof(isosb)) +- goto io_error; +- +- if (strncmp(isosb.hs.id, HS_STANDARD_ID, sizeof(isosb.hs.id)) == 0) { +- /* "CDROM" */ +- type = "iso9660"; +- } else if (strncmp(isosb.iso.id, ISO_STANDARD_ID, +- sizeof(isosb.iso.id)) == 0) { +- /* CD001 */ +- type = "iso9660"; +- if (is_really_udf(fd)) +- type = "udf"; +- } else if (may_be_udf(isosb.iso.id)) +- type = "udf"; +- } +- +- if (!type) { +- /* block 64 */ +- if (lseek(fd, REISERFS_DISK_OFFSET_IN_BYTES, SEEK_SET) != +- REISERFS_DISK_OFFSET_IN_BYTES +- || read(fd, (char *) &reiserfssb, sizeof(reiserfssb)) != +- sizeof(reiserfssb)) +- goto io_error; +- if (reiserfs_magic_version(reiserfssb.s_magic)) +- type = "reiserfs"; +- } +- +- 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(); +- int rd; +- char buf[32768]; +- +- rd = pagesize; +- if (rd < 8192) +- rd = 8192; +- if (rd > sizeof(buf)) +- rd = sizeof(buf); +- if (lseek(fd, 0, SEEK_SET) != 0 +- || read(fd, buf, rd) != rd) +- goto io_error; +- if (may_be_swap(buf+pagesize) || +- may_be_swap(buf+4096) || may_be_swap(buf+8192)) +- type = "swap"; +- } +- +- close (fd); +- return(type); +- +-io_error: +- if (errno) +- perror(device); +- else +- fprintf(stderr, _("mount: error while guessing filesystem type\n")); +- close(fd); +- return 0; +-} +- +-#endif + + static struct tried { + struct tried *next; +diff --git a/mount/swapon.c b/mount/swapon.c +index af4ba96..cb055b3 100644 +--- a/mount/swapon.c ++++ b/mount/swapon.c +@@ -16,7 +16,6 @@ + #include "swapargs.h" + #include "nls.h" + #include "fsprobe.h" +-#include "mount_by_label.h" + #include "realpath.h" + + #define streq(s, t) (strcmp ((s), (t)) == 0) +-- +1.5.0.6 + +- +To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html + +Signed-off-by: Kay Sievers +Signed-off-by: Karel Zak +--- + mount/Makefile.am | 15 +-- + mount/fsprobe.c | 164 ++++++++++++++++++++++++++++++++ + mount/fsprobe.h | 17 ++++ + mount/fsprobe_blkid.c | 11 ++ + mount/mount.c | 43 +++++++-- + mount/mount_guess_fstype.c | 225 -------------------------------------------- + mount/mount_guess_fstype.h | 16 --- + mount/mount_paths.h | 3 + + 8 files changed, 232 insertions(+), 262 deletions(-) + +diff --git a/mount/Makefile.am b/mount/Makefile.am +index 6f63dcf..b5b21b5 100644 +--- a/mount/Makefile.am ++++ b/mount/Makefile.am +@@ -7,24 +7,17 @@ sbin_PROGRAMS = losetup swapon + man_MANS = fstab.5 mount.8 swapoff.8 swapon.8 umount.8 losetup.8 + + MNTHDRS = fstab.h linux_fs.h mount_mntent.h mount_constants.h my_dev_t.h \ +- mount_paths.h lomount.h fsprobe.h \ +- mount_guess_fstype.h realpath.h xmalloc.h \ +- getusername.h loop.h mount_guess_rootdev.h \ +- sundries.h ++ mount_paths.h lomount.h fsprobe.h realpath.h xmalloc.h \ ++ getusername.h loop.h mount_guess_rootdev.h sundries.h + + mount_SOURCES = mount.c fstab.c sundries.c xmalloc.c realpath.c mount_mntent.c \ +- mount_guess_fstype.c \ +- getusername.c \ +- lomount.c \ +- $(MNTHDRS) ++ fsprobe.c getusername.c lomount.c $(MNTHDRS) + + mount_LDADD = $(top_srcdir)/lib/libenv.a $(top_srcdir)/lib/libsetproctitle.a + mount_CFLAGS = $(SUID_CFLAGS) + + umount_SOURCES = umount.c fstab.c sundries.c xmalloc.c realpath.c mount_mntent.c \ +- getusername.c \ +- lomount.c \ +- $(MNTHDRS) ++ getusername.c fsprobe.c lomount.c $(MNTHDRS) + + umount_LDADD = $(top_srcdir)/lib/libenv.a + umount_CFLAGS = $(SUID_CFLAGS) +diff --git a/mount/fsprobe.c b/mount/fsprobe.c +new file mode 100644 +index 0000000..4b57802 +--- /dev/null ++++ b/mount/fsprobe.c +@@ -0,0 +1,164 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "mount_paths.h" ++#include "linux_fs.h" ++#include "fsprobe.h" ++#include "sundries.h" /* for xstrdup */ ++#include "nls.h" ++ ++/* list of already tested filesystems by fsprobe_procfsloop_mount() */ ++static struct tried { ++ struct tried *next; ++ char *type; ++} *tried = NULL; ++ ++static int ++was_tested(const char *fstype) { ++ struct tried *t; ++ ++ if (fsprobe_known_fstype(fstype)) ++ return 1; ++ for (t = tried; t; t = t->next) { ++ if (!strcmp(t->type, fstype)) ++ return 1; ++ } ++ return 0; ++} ++ ++static void ++set_tested(const char *fstype) { ++ struct tried *t = xmalloc(sizeof(struct tried)); ++ ++ t->next = tried; ++ t->type = xstrdup(fstype); ++ tried = t; ++} ++ ++static void ++free_tested(void) { ++ struct tried *t, *tt; ++ ++ t = tried; ++ while(t) { ++ free(t->type); ++ tt = t->next; ++ free(t); ++ t = tt; ++ } ++ tried = NULL; ++} ++ ++static char * ++procfsnext(FILE *procfs) { ++ char line[100]; ++ char fsname[100]; ++ ++ while (fgets(line, sizeof(line), procfs)) { ++ if (sscanf (line, "nodev %[^\n]\n", fsname) == 1) continue; ++ if (sscanf (line, " %[^ \n]\n", fsname) != 1) continue; ++ return xstrdup(fsname); ++ } ++ return 0; ++} ++ ++/* Only use /proc/filesystems here, this is meant to test what ++ the kernel knows about, so /etc/filesystems is irrelevant. ++ Return: 1: yes, 0: no, -1: cannot open procfs */ ++int ++fsprobe_known_fstype_in_procfs(const char *type) ++{ ++ FILE *procfs; ++ char *fsname; ++ int ret = -1; ++ ++ procfs = fopen(PROC_FILESYSTEMS, "r"); ++ if (procfs) { ++ ret = 0; ++ while ((fsname = procfsnext(procfs)) != NULL) ++ if (!strcmp(fsname, type)) { ++ ret = 1; ++ break; ++ } ++ fclose(procfs); ++ procfs = NULL; ++ } ++ return ret; ++} ++ ++/* Try all types in FILESYSTEMS, except those in *types, ++ in case *types starts with "no" */ ++/* return: 0: OK, -1: error in errno, 1: type not found */ ++/* when 0 or -1 is returned, *types contains the type used */ ++/* when 1 is returned, *types is NULL */ ++int ++fsprobe_procfsloop_mount( int (*mount_fn)(struct mountargs *), ++ struct mountargs *args, ++ const char **types) ++{ ++ char *files[2] = { ETC_FILESYSTEMS, PROC_FILESYSTEMS }; ++ FILE *procfs; ++ char *fsname; ++ const char *notypes = NULL; ++ int no = 0; ++ int ret = 1; ++ int errsv = 0; ++ int i; ++ ++ if (*types && !strncmp(*types, "no", 2)) { ++ no = 1; ++ notypes = (*types) + 2; ++ } ++ *types = NULL; ++ ++ /* Use PROC_FILESYSTEMS only when ETC_FILESYSTEMS does not exist. ++ In some cases trying a filesystem that the kernel knows about ++ on the wrong data will crash the kernel; in such cases ++ ETC_FILESYSTEMS can be used to list the filesystems that we ++ are allowed to try, and in the order they should be tried. ++ End ETC_FILESYSTEMS with a line containing a single '*' only, ++ if PROC_FILESYSTEMS should be tried afterwards. */ ++ ++ for (i=0; i<2; i++) { ++ procfs = fopen(files[i], "r"); ++ if (!procfs) ++ continue; ++ while ((fsname = procfsnext(procfs)) != NULL) { ++ if (!strcmp(fsname, "*")) { ++ fclose(procfs); ++ goto nexti; ++ } ++ if (was_tested (fsname)) ++ continue; ++ if (no && matching_type(fsname, notypes)) ++ continue; ++ set_tested (fsname); ++ args->type = fsname; ++ if (verbose) { ++ printf(_("Trying %s\n"), fsname); ++ fflush(stdout); ++ } ++ if ((*mount_fn) (args) == 0) { ++ *types = fsname; ++ ret = 0; ++ break; ++ } else if (errno != EINVAL && ++ fsprobe_known_fstype_in_procfs(fsname) == 1) { ++ *types = "guess"; ++ ret = -1; ++ errsv = errno; ++ break; ++ } ++ } ++ free_tested(); ++ fclose(procfs); ++ errno = errsv; ++ return ret; ++ nexti:; ++ } ++ return 1; ++} +diff --git a/mount/fsprobe.h b/mount/fsprobe.h +index c96ff8c..cc429e1 100644 +--- a/mount/fsprobe.h ++++ b/mount/fsprobe.h +@@ -10,3 +10,20 @@ extern const char *mount_get_devname_by_label(const char *label); + extern const char *mount_get_volume_label_by_spec(const char *spec); + extern const char *mount_get_devname(const char *spec); + extern const char *mount_get_devname_for_mounting(const char *spec); ++extern int fsprobe_known_fstype(const char *fstype); ++extern const char *fsprobe_get_fstype_by_devname(const char *devname); ++ ++struct mountargs { ++ const char *spec; ++ const char *node; ++ const char *type; ++ int flags; ++ void *data; ++}; ++ ++extern int fsprobe_known_fstype_in_procfs(const char *type); ++ ++extern int fsprobe_procfsloop_mount(int (*mount_fn)(struct mountargs *), ++ struct mountargs *args, ++ const char **types); ++ +diff --git a/mount/fsprobe_blkid.c b/mount/fsprobe_blkid.c +index 9ff4e31..7f8c362 100644 +--- a/mount/fsprobe_blkid.c ++++ b/mount/fsprobe_blkid.c +@@ -41,4 +41,15 @@ mount_get_devname_for_mounting(const char *spec) { + return blkid_get_devname(blkid, spec, 0); + } + ++int ++fsprobe_known_fstype(const char *fstype) ++{ ++ return blkid_known_fstype(fstype); ++} ++ ++const char * ++fsprobe_get_fstype_by_devname(const char *devname) { ++ return blkid_get_tag_value(blkid, "TYPE", devname); ++} ++ + #endif +diff --git a/mount/mount.c b/mount/mount.c +index 309e41e..be9e409 100644 +--- a/mount/mount.c ++++ b/mount/mount.c +@@ -39,7 +39,6 @@ + #include "loop.h" + #include "linux_fs.h" /* for BLKGETSIZE */ + #include "mount_guess_rootdev.h" +-#include "mount_guess_fstype.h" + #include "getusername.h" + #include "mount_paths.h" + #include "env.h" +@@ -656,6 +655,26 @@ check_special_mountprog(const char *spec, const char *node, const char *type, in + return 0; + } + ++ ++static const char * ++guess_fstype_by_devname(const char *devname) ++{ ++ const char *type = fsprobe_get_fstype_by_devname(devname); ++ ++ if (verbose) { ++ printf (_("mount: you didn't specify a filesystem type for %s\n"), devname); ++ ++ if (!type) ++ printf (_(" I will try all types mentioned in %s or %s\n"), ++ ETC_FILESYSTEMS, PROC_FILESYSTEMS); ++ else if (!strcmp(type, "swap")) ++ printf (_(" and it looks like this is swapspace\n")); ++ else ++ printf (_(" I will try type %s\n"), type); ++ } ++ return type; ++} ++ + /* + * guess_fstype_and_mount() + * Mount a single file system. Guess the type when unknown. +@@ -675,7 +694,7 @@ guess_fstype_and_mount(const char *spec, const char *node, const char **types, + *types = "none"; /* random, but not "bind" */ + + if (!*types && !(flags & MS_REMOUNT)) { +- *types = guess_fstype(spec); ++ *types = guess_fstype_by_devname(spec); + if (*types) { + if (!strcmp(*types, "swap")) { + error(_("%s looks like swapspace - not mounted"), spec); +@@ -711,7 +730,7 @@ guess_fstype_and_mount(const char *spec, const char *node, const char **types, + return do_mount_syscall (&args); + } + +- return procfsloop(do_mount_syscall, &args, types); ++ return fsprobe_procfsloop_mount(do_mount_syscall, &args, types); + } + + /* +@@ -1147,8 +1166,10 @@ try_mount_one (const char *spec0, const char *node0, const char *types0, + case EIO: + error (_("mount: %s: can't read superblock"), spec); break; + case ENODEV: +- { int pfs; +- if ((pfs = is_in_procfs(types)) == 1 || !strcmp(types, "guess")) ++ { ++ int pfs = fsprobe_known_fstype_in_procfs(types); ++ ++ if (pfs == 1 || !strcmp(types, "guess")) + error(_("mount: %s: unknown device"), spec); + else if (pfs == 0) { + char *lowtype, *p; +@@ -1165,11 +1186,13 @@ try_mount_one (const char *spec0, const char *node0, const char *types0, + u++; + } + } +- if (u && is_in_procfs(lowtype) == 1) ++ if (u && fsprobe_known_fstype_in_procfs(lowtype) == 1) + error (_("mount: probably you meant %s"), lowtype); +- else if (!strncmp(lowtype, "iso", 3) && is_in_procfs("iso9660") == 1) ++ else if (!strncmp(lowtype, "iso", 3) && ++ fsprobe_known_fstype_in_procfs("iso9660") == 1) + error (_("mount: maybe you meant 'iso9660'?")); +- else if (!strncmp(lowtype, "fat", 3) && is_in_procfs("vfat") == 1) ++ else if (!strncmp(lowtype, "fat", 3) && ++ fsprobe_known_fstype_in_procfs("vfat") == 1) + error (_("mount: maybe you meant 'vfat'?")); + free(lowtype); + } else +@@ -1741,8 +1764,8 @@ main(int argc, char *argv[]) { + use only for testing purposes - + the guessing is not reliable at all */ + { +- char *fstype; +- fstype = do_guess_fstype(optarg); ++ const char *fstype; ++ fstype = fsprobe_get_fstype_by_devname(optarg); + printf("%s\n", fstype ? fstype : "unknown"); + exit(fstype ? 0 : EX_FAIL); + } +diff --git a/mount/mount_guess_fstype.c b/mount/mount_guess_fstype.c +deleted file mode 100644 +index 01c3fc7..0000000 +--- a/mount/mount_guess_fstype.c ++++ /dev/null +@@ -1,225 +0,0 @@ +-/* +- * Thu Jul 14 07:32:40 1994: faith@cs.unc.edu added changes from Adam +- * J. Richter (adam@adam.yggdrasil.com) so that /proc/filesystems is used +- * if no -t option is given. I modified his patches so that, if +- * /proc/filesystems is not available, the behavior of mount is the same as +- * it was previously. +- * +- * Wed Feb 8 09:23:18 1995: Mike Grupenhoff added +- * a probe of the superblock for the type before /proc/filesystems is +- * checked. +- * +- * Fri Apr 5 01:13:33 1996: quinlan@bucknell.edu, fixed up iso9660 autodetect +- * +- * Wed Nov 11 11:33:55 1998: K.Garloff@ping.de, try /etc/filesystems before +- * /proc/filesystems +- * [This was mainly in order to specify vfat before fat; these days we often +- * detect *fat and then assume vfat, so perhaps /etc/filesystems isnt +- * so useful anymore.] +- * +- * 1999-02-22 Arkadiusz Mi¶kiewicz +- * added Native Language Support +- * +- * 2000-12-01 Sepp Wijnands +- * added probes for cramfs, hfs, hpfs and adfs. +- * +- * 2001-10-26 Tim Launchbury +- * added sysv magic. +- * +- * aeb - many changes. +- * +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include "linux_fs.h" +-#include "fsprobe.h" +-#include "mount_guess_fstype.h" +-#include "sundries.h" /* for xstrdup */ +-#include "nls.h" +- +-#define ETC_FILESYSTEMS "/etc/filesystems" +-#define PROC_FILESYSTEMS "/proc/filesystems" +- +-char * +-do_guess_fstype(const char *device) +-{ +- return blkid_get_tag_value(blkid, "TYPE", device); +-} +- +-static int +-known_fstype(const char *fstype) +-{ +- return blkid_known_fstype(fstype); +-} +- +- +-static struct tried { +- struct tried *next; +- char *type; +-} *tried = NULL; +- +-static int +-was_tested(const char *fstype) { +- struct tried *t; +- +- if (known_fstype(fstype)) +- return 1; +- for (t = tried; t; t = t->next) { +- if (!strcmp(t->type, fstype)) +- return 1; +- } +- return 0; +-} +- +-static void +-set_tested(const char *fstype) { +- struct tried *t = xmalloc(sizeof(struct tried)); +- +- t->next = tried; +- t->type = xstrdup(fstype); +- tried = t; +-} +- +-static void +-free_tested(void) { +- struct tried *t, *tt; +- +- t = tried; +- while(t) { +- free(t->type); +- tt = t->next; +- free(t); +- t = tt; +- } +- tried = NULL; +-} +- +-char * +-guess_fstype(const char *spec) { +- char *type = do_guess_fstype(spec); +- if (verbose) { +- printf (_("mount: you didn't specify a filesystem type for %s\n"), +- spec); +- if (!type) +- printf (_(" I will try all types mentioned in %s or %s\n"), +- ETC_FILESYSTEMS, PROC_FILESYSTEMS); +- else if (!strcmp(type, "swap")) +- printf (_(" and it looks like this is swapspace\n")); +- else +- printf (_(" I will try type %s\n"), type); +- } +- return type; +-} +- +-static char * +-procfsnext(FILE *procfs) { +- char line[100]; +- char fsname[100]; +- +- while (fgets(line, sizeof(line), procfs)) { +- if (sscanf (line, "nodev %[^\n]\n", fsname) == 1) continue; +- if (sscanf (line, " %[^ \n]\n", fsname) != 1) continue; +- return xstrdup(fsname); +- } +- return 0; +-} +- +-/* Only use /proc/filesystems here, this is meant to test what +- the kernel knows about, so /etc/filesystems is irrelevant. +- Return: 1: yes, 0: no, -1: cannot open procfs */ +-int +-is_in_procfs(const char *type) { +- FILE *procfs; +- char *fsname; +- int ret = -1; +- +- procfs = fopen(PROC_FILESYSTEMS, "r"); +- if (procfs) { +- ret = 0; +- while ((fsname = procfsnext(procfs)) != NULL) +- if (!strcmp(fsname, type)) { +- ret = 1; +- break; +- } +- fclose(procfs); +- procfs = NULL; +- } +- return ret; +-} +- +-/* Try all types in FILESYSTEMS, except those in *types, +- in case *types starts with "no" */ +-/* return: 0: OK, -1: error in errno, 1: type not found */ +-/* when 0 or -1 is returned, *types contains the type used */ +-/* when 1 is returned, *types is NULL */ +-int +-procfsloop(int (*mount_fn)(struct mountargs *), struct mountargs *args, +- const char **types) { +- char *files[2] = { ETC_FILESYSTEMS, PROC_FILESYSTEMS }; +- FILE *procfs; +- char *fsname; +- const char *notypes = NULL; +- int no = 0; +- int ret = 1; +- int errsv = 0; +- int i; +- +- if (*types && !strncmp(*types, "no", 2)) { +- no = 1; +- notypes = (*types) + 2; +- } +- *types = NULL; +- +- /* Use PROC_FILESYSTEMS only when ETC_FILESYSTEMS does not exist. +- In some cases trying a filesystem that the kernel knows about +- on the wrong data will crash the kernel; in such cases +- ETC_FILESYSTEMS can be used to list the filesystems that we +- are allowed to try, and in the order they should be tried. +- End ETC_FILESYSTEMS with a line containing a single '*' only, +- if PROC_FILESYSTEMS should be tried afterwards. */ +- +- for (i=0; i<2; i++) { +- procfs = fopen(files[i], "r"); +- if (!procfs) +- continue; +- while ((fsname = procfsnext(procfs)) != NULL) { +- if (!strcmp(fsname, "*")) { +- fclose(procfs); +- goto nexti; +- } +- if (was_tested (fsname)) +- continue; +- if (no && matching_type(fsname, notypes)) +- continue; +- set_tested (fsname); +- args->type = fsname; +- if (verbose) { +- printf(_("Trying %s\n"), fsname); +- fflush(stdout); +- } +- if ((*mount_fn) (args) == 0) { +- *types = fsname; +- ret = 0; +- break; +- } else if (errno != EINVAL && +- is_in_procfs(fsname) == 1) { +- *types = "guess"; +- ret = -1; +- errsv = errno; +- break; +- } +- } +- free_tested(); +- fclose(procfs); +- errno = errsv; +- return ret; +- nexti:; +- } +- return 1; +-} +diff --git a/mount/mount_guess_fstype.h b/mount/mount_guess_fstype.h +deleted file mode 100644 +index 63cb678..0000000 +--- a/mount/mount_guess_fstype.h ++++ /dev/null +@@ -1,16 +0,0 @@ +-struct mountargs { +- const char *spec; +- const char *node; +- const char *type; +- int flags; +- void *data; +-}; +- +-extern int verbose; +- +-char *guess_fstype(const char *device); +-char *do_guess_fstype(const char *device); +-int procfsloop(int (*mount_fn)(struct mountargs *), struct mountargs *args, +- const char **type); +-int is_in_procfs(const char *fstype); +- +diff --git a/mount/mount_paths.h b/mount/mount_paths.h +index fe84e1d..9093b10 100644 +--- a/mount/mount_paths.h ++++ b/mount/mount_paths.h +@@ -12,4 +12,7 @@ + #endif + #define LOCK_TIMEOUT 10 + ++#define ETC_FILESYSTEMS "/etc/filesystems" ++#define PROC_FILESYSTEMS "/proc/filesystems" ++ + #endif /* MOUNT_PATHS_H */ +-- +1.5.0.6 + +- +To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html + +Signed-off-by: Karel Zak +--- + mount/fsprobe.h | 41 ++++++++++++++++++++++++++++------------- + mount/fsprobe_blkid.c | 27 +++++++++++++++------------ + mount/fstab.c | 8 ++++---- + mount/mount.c | 40 +++++++++++++++++++++++----------------- + mount/swapon.c | 14 +++++++------- + 5 files changed, 77 insertions(+), 53 deletions(-) + +diff --git a/mount/fsprobe.h b/mount/fsprobe.h +index cc429e1..e59440e 100644 +--- a/mount/fsprobe.h ++++ b/mount/fsprobe.h +@@ -1,18 +1,32 @@ +-#ifdef HAVE_LIBBLKID +-#include +-extern blkid_cache blkid; +-#endif +- +-extern void mount_blkid_get_cache(void); +-extern void mount_blkid_put_cache(void); +-extern const char *mount_get_devname_by_uuid(const char *uuid); +-extern const char *mount_get_devname_by_label(const char *label); +-extern const char *mount_get_volume_label_by_spec(const char *spec); +-extern const char *mount_get_devname(const char *spec); +-extern const char *mount_get_devname_for_mounting(const char *spec); +-extern int fsprobe_known_fstype(const char *fstype); ++#ifndef MOUNT_FSPROBE_H ++#define MOUNT_FSPROBE_H ++/* ++ * This is the generic interface for filesystem guessing libraries. ++ * Implementations are provided by ++ * ++ * fsprobe_blkid.c for libblkid from e2fsprogs ++ * fsprobe_volumeid.c for libvolume_id from udev ++ * ++ * Copyright (C) 2007 Kay Sievers ++ * Copyright (C) 2007 Matthias Koenig ++ * Copyright (C) 2007 Karel Zak ++ */ ++ ++extern void fsprobe_init(void); ++extern void fsprobe_exit(void); ++ ++extern const char *fsprobe_get_devname_by_uuid(const char *uuid); ++extern const char *fsprobe_get_devname_by_label(const char *label); ++ ++extern const char *fsprobe_get_label_by_devname(const char *devname); ++extern const char *fsprobe_get_uuid_by_devname(const char *devname); + extern const char *fsprobe_get_fstype_by_devname(const char *devname); + ++extern const char *fsprobe_get_devname(const char *spec); ++extern const char *fsprobe_get_devname_for_mounting(const char *spec); ++ ++extern int fsprobe_known_fstype(const char *fstype); ++ + struct mountargs { + const char *spec; + const char *node; +@@ -27,3 +41,4 @@ extern int fsprobe_procfsloop_mount(int (*mount_fn)(struct mountargs *), + struct mountargs *args, + const char **types); + ++#endif /* MOUNT_FSPROBE_H */ +diff --git a/mount/fsprobe_blkid.c b/mount/fsprobe_blkid.c +index 7f8c362..d25b973 100644 +--- a/mount/fsprobe_blkid.c ++++ b/mount/fsprobe_blkid.c +@@ -1,43 +1,47 @@ + #include ++#include + #include "fsprobe.h" + +-#ifdef HAVE_LIBBLKID +- +-blkid_cache blkid; ++static blkid_cache blkid; + + void +-mount_blkid_get_cache(void) { ++fsprobe_init(void) { + blkid_get_cache(&blkid, NULL); + } + + void +-mount_blkid_put_cache(void) { ++fsprobe_exit(void) { + blkid_put_cache(blkid); + } + + const char * +-mount_get_volume_label_by_spec(const char *spec) { +- return blkid_get_tag_value(blkid, "LABEL", spec); ++fsprobe_get_label_by_devname(const char *devname) { ++ return blkid_get_tag_value(blkid, "LABEL", devname); ++} ++ ++const char * ++fsprobe_get_uuid_by_devname(const char *devname) { ++ return blkid_get_tag_value(blkid, "UUID", devname); + } + + const char * +-mount_get_devname(const char *spec) { ++fsprobe_get_devname(const char *spec) { + return blkid_get_devname(blkid, spec, 0); + } + + const char * +-mount_get_devname_by_uuid(const char *uuid) { ++fsprobe_get_devname_by_uuid(const char *uuid) { + return blkid_get_devname(blkid, "UUID", uuid); + } + + const char * +-mount_get_devname_by_label(const char *label) { ++fsprobe_get_devname_by_label(const char *label) { + return blkid_get_devname(blkid, "LABEL", label); + } + + /* Also when no UUID= or LABEL= occur? No verbose? No warnings? */ + const char * +-mount_get_devname_for_mounting(const char *spec) { ++fsprobe_get_devname_for_mounting(const char *spec) { + return blkid_get_devname(blkid, spec, 0); + } + +@@ -52,4 +56,3 @@ fsprobe_get_fstype_by_devname(const char *devname) { + return blkid_get_tag_value(blkid, "TYPE", devname); + } + +-#endif +diff --git a/mount/fstab.c b/mount/fstab.c +index 5267f62..c47f20d 100644 +--- a/mount/fstab.c ++++ b/mount/fstab.c +@@ -292,7 +292,7 @@ has_label(const char *device, const char *label) { + const char *devlabel; + int ret; + +- devlabel = mount_get_volume_label_by_spec(device); ++ devlabel = fsprobe_get_label_by_devname(device); + ret = !strcmp(label, devlabel); + /* free(devlabel); */ + return ret; +@@ -303,7 +303,7 @@ has_uuid(const char *device, const char *uuid){ + const char *devuuid; + int ret; + +- devuuid = mount_get_devname_by_uuid(device); ++ devuuid = fsprobe_get_uuid_by_devname(device); + ret = !strcmp(uuid, devuuid); + /* free(devuuid); */ + return ret; +@@ -745,8 +745,8 @@ int verbose; + int mount_quiet; + char *progname; + +-const char *mount_get_volume_label_by_spec(const char *spec) { return NULL; } +-const char *mount_get_devname_by_uuid(const char *uuid) { return NULL; } ++const char *fsprobe_get_label_by_devname(const char *spec) { return NULL; } ++const char *fsprobe_get_uuid_by_devname(const char *spec) { return NULL; } + struct my_mntent *my_getmntent (mntFILE *mfp) { return NULL; } + mntFILE *my_setmntent (const char *file, char *mode) { return NULL; } + void my_endmntent (mntFILE *mfp) { } +diff --git a/mount/mount.c b/mount/mount.c +index be9e409..12964ca 100644 +--- a/mount/mount.c ++++ b/mount/mount.c +@@ -233,6 +233,11 @@ parse_string_opt(char *s) { + return 0; + } + ++static void ++my_free(const void *s) { ++ if (s) ++ free((void *) s); ++} + + /* Report on a single mount. */ + static void +@@ -245,11 +250,18 @@ print_one (const struct my_mntent *me) { + if (me->mnt_opts != NULL) + printf (" (%s)", me->mnt_opts); + if (list_with_volumelabel) { +- const char *label; +- label = mount_get_volume_label_by_spec(me->mnt_fsname); +- if (label) { +- printf (" [%s]", label); +- /* free(label); */ ++ const char *devname = fsprobe_get_devname(me->mnt_fsname); ++ ++ if (devname) { ++ const char *label; ++ ++ label = fsprobe_get_label_by_devname(devname); ++ my_free(devname); ++ ++ if (label) { ++ printf (" [%s]", label); ++ my_free(label); ++ } + } + } + printf ("\n"); +@@ -268,12 +280,6 @@ print_all (char *types) { + exit (0); + } + +-static void +-my_free(const void *s) { +- if (s) +- free((void *) s); +-} +- + /* reallocates its first arg */ + static char * + append_opt(char *s, const char *opt, const char *val) +@@ -1330,7 +1336,7 @@ mount_one (const char *spec, const char *node, const char *types, + opts = append_opt(opts, cmdlineopts, NULL); + + /* Handle possible LABEL= and UUID= forms of spec */ +- nspec = mount_get_devname_for_mounting(spec); ++ nspec = fsprobe_get_devname_for_mounting(spec); + if (nspec) + spec = nspec; + +@@ -1387,7 +1393,7 @@ mounted (const char *spec0, const char *node0) { + int ret = 0; + + /* Handle possible UUID= and LABEL= in spec */ +- spec0 = mount_get_devname(spec0); ++ spec0 = fsprobe_get_devname(spec0); + if (!spec0) + return ret; + +@@ -1669,7 +1675,7 @@ main(int argc, char *argv[]) { + if (fd > 2) + close(fd); + +- mount_blkid_get_cache(); ++ fsprobe_init(); + + #ifdef DO_PS_FIDDLING + initproctitle(argc, argv); +@@ -1842,9 +1848,9 @@ main(int argc, char *argv[]) { + + if (specseen) { + if (uuid) +- spec = mount_get_devname_by_uuid(uuid); ++ spec = fsprobe_get_devname_by_uuid(uuid); + else +- spec = mount_get_devname_by_label(volumelabel); ++ spec = fsprobe_get_devname_by_label(volumelabel); + + if (!spec) + die (EX_USAGE, _("mount: no such partition found")); +@@ -1922,7 +1928,7 @@ main(int argc, char *argv[]) { + if (result == EX_SOMEOK) + result = 0; + +- mount_blkid_put_cache(); ++ fsprobe_exit(); + + exit (result); + } +diff --git a/mount/swapon.c b/mount/swapon.c +index cb055b3..025a6b5 100644 +--- a/mount/swapon.c ++++ b/mount/swapon.c +@@ -180,7 +180,7 @@ do_swapon(const char *orig_special, int prio) { + if (verbose) + printf(_("%s on %s\n"), progname, orig_special); + +- special = mount_get_devname(orig_special); ++ special = fsprobe_get_devname(orig_special); + if (!special) { + fprintf(stderr, _("%s: cannot find the device for %s\n"), + progname, orig_special); +@@ -255,13 +255,13 @@ cannot_find(const char *special) { + + static int + swapon_by_label(const char *label, int prio) { +- const char *special = mount_get_devname_by_label(label); ++ const char *special = fsprobe_get_devname_by_label(label); + return special ? do_swapon(special, prio) : cannot_find(label); + } + + static int + swapon_by_uuid(const char *uuid, int prio) { +- const char *special = mount_get_devname_by_uuid(uuid); ++ const char *special = fsprobe_get_devname_by_uuid(uuid); + return special ? do_swapon(special, prio) : cannot_find(uuid); + } + +@@ -272,7 +272,7 @@ do_swapoff(const char *orig_special, int quiet) { + if (verbose) + printf(_("%s on %s\n"), progname, orig_special); + +- special = mount_get_devname(orig_special); ++ special = fsprobe_get_devname(orig_special); + if (!special) + return cannot_find(orig_special); + +@@ -293,13 +293,13 @@ do_swapoff(const char *orig_special, int quiet) { + + static int + swapoff_by_label(const char *label, int quiet) { +- const char *special = mount_get_devname_by_label(label); ++ const char *special = fsprobe_get_devname_by_label(label); + return special ? do_swapoff(special, quiet) : cannot_find(label); + } + + static int + swapoff_by_uuid(const char *uuid, int quiet) { +- const char *special = mount_get_devname_by_uuid(uuid); ++ const char *special = fsprobe_get_devname_by_uuid(uuid); + return special ? do_swapoff(special, quiet) : cannot_find(uuid); + } + +@@ -328,7 +328,7 @@ swapon_all(void) { + if (!streq(fstab->mnt_type, MNTTYPE_SWAP)) + continue; + +- special = mount_get_devname(orig_special); ++ special = fsprobe_get_devname(orig_special); + if (!special) + continue; + +-- +1.5.0.6 + +- +To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html + +The blkid supports NAME=value parsing, but use the library for +this simple task is overkill. (The libblkid requires initialized +blkid cache all time, for all calls.) + +This patch makes the fsprobe_get_devname_for_mounting() and +fsprobe_get_devname() generic for all fsprobe implementations. + +Signed-off-by: Karel Zak +--- + mount/Makefile.am | 2 +- + mount/fsprobe.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ + mount/fsprobe_blkid.c | 11 --------- + mount/sundries.c | 38 ++++++++++++++++++++++++++++++ + mount/sundries.h | 2 + + mount/swapon.c | 1 + + 6 files changed, 103 insertions(+), 12 deletions(-) + +diff --git a/mount/Makefile.am b/mount/Makefile.am +index b5b21b5..e61261f 100644 +--- a/mount/Makefile.am ++++ b/mount/Makefile.am +@@ -23,7 +23,7 @@ umount_LDADD = $(top_srcdir)/lib/libenv.a + umount_CFLAGS = $(SUID_CFLAGS) + + swapon_SOURCES = swapon.c xmalloc.c \ +- swap_constants.h realpath.c ++ swap_constants.h realpath.c fsprobe.c sundries.c + + losetup_SOURCES = lomount.c loop.h lomount.h + losetup_CFLAGS = -DMAIN +diff --git a/mount/fsprobe.c b/mount/fsprobe.c +index 4b57802..2629d0d 100644 +--- a/mount/fsprobe.c ++++ b/mount/fsprobe.c +@@ -162,3 +162,64 @@ fsprobe_procfsloop_mount( int (*mount_fn)(struct mountargs *), + } + return 1; + } ++ ++const char * ++fsprobe_get_devname_for_mounting(const char *spec) ++{ ++ char *name, *value; ++ ++ if (!spec) ++ return NULL; ++ ++ if (parse_spec(spec, &name, &value) != 0) ++ return NULL; /* parse error */ ++ ++ if (name) { ++ const char *nspec = NULL; ++ ++ if (!strcmp(name,"LABEL")) ++ nspec = fsprobe_get_devname_by_label(value); ++ else if (!strcmp(name,"UUID")) ++ nspec = fsprobe_get_devname_by_uuid(value); ++ ++ if (nspec && verbose > 1) ++ printf(_("mount: going to mount %s by %s\n"), spec, name); ++ ++ free((void *) name); ++ return nspec; ++ } ++ ++ /* no LABEL, no UUID, .. probably a path */ ++ if (verbose > 1) ++ printf(_("mount: no LABEL=, no UUID=, going to mount %s by path\n"), spec); ++ ++ return canonicalize(spec); ++} ++ ++/* like fsprobe_get_devname_for_mounting(), but without verbose messages */ ++const char * ++fsprobe_get_devname(const char *spec) ++{ ++ char *name, *value; ++ ++ if (!spec) ++ return NULL; ++ ++ if (parse_spec(spec, &name, &value) != 0) ++ return NULL; /* parse error */ ++ ++ if (name) { ++ const char *nspec = NULL; ++ ++ if (!strcmp(name,"LABEL")) ++ nspec = fsprobe_get_devname_by_label(value); ++ else if (!strcmp(name,"UUID")) ++ nspec = fsprobe_get_devname_by_uuid(value); ++ ++ free((void *) name); ++ return nspec; ++ } ++ ++ return canonicalize(spec); ++} ++ +diff --git a/mount/fsprobe_blkid.c b/mount/fsprobe_blkid.c +index d25b973..2dc734e 100644 +--- a/mount/fsprobe_blkid.c ++++ b/mount/fsprobe_blkid.c +@@ -25,11 +25,6 @@ fsprobe_get_uuid_by_devname(const char *devname) { + } + + const char * +-fsprobe_get_devname(const char *spec) { +- return blkid_get_devname(blkid, spec, 0); +-} +- +-const char * + fsprobe_get_devname_by_uuid(const char *uuid) { + return blkid_get_devname(blkid, "UUID", uuid); + } +@@ -39,12 +34,6 @@ fsprobe_get_devname_by_label(const char *label) { + return blkid_get_devname(blkid, "LABEL", label); + } + +-/* Also when no UUID= or LABEL= occur? No verbose? No warnings? */ +-const char * +-fsprobe_get_devname_for_mounting(const char *spec) { +- return blkid_get_devname(blkid, spec, 0); +-} +- + int + fsprobe_known_fstype(const char *fstype) + { +diff --git a/mount/sundries.c b/mount/sundries.c +index cdfbb42..45404c5 100644 +--- a/mount/sundries.c ++++ b/mount/sundries.c +@@ -247,3 +247,41 @@ canonicalize (const char *path) { + + return xstrdup(path); + } ++ ++ ++/* ++ * Parses NAME=value, returns -1 on parse error, 0 success. The success is also ++ * when the 'spec' doesn't contain name=value pair (because the spec could be ++ * a devname too). In particular case the pointer 'name' is set to NULL. ++ ++ * The result is a new allocated string (the 'name' pointer). ++ */ ++int ++parse_spec(const char *spec, char **name, char **value) ++{ ++ char *vl, *tk, *cp; ++ ++ *name = NULL; ++ *value = NULL; ++ ++ if (!(cp = strchr(spec, '='))) ++ return 0; /* no name= */ ++ ++ tk = xstrdup(spec); ++ vl = tk + (cp - spec); ++ *vl++ = '\0'; ++ ++ if (*vl == '"' || *vl == '\'') { ++ if (!(cp = strrchr(vl+1, *vl))) { ++ free(tk); ++ return -1; /* parse error */ ++ } ++ vl++; ++ *cp = '\0'; ++ } ++ ++ *name = tk; ++ *value = vl; ++ return 0; ++} ++ +diff --git a/mount/sundries.h b/mount/sundries.h +index 0851145..85ccd85 100644 +--- a/mount/sundries.h ++++ b/mount/sundries.h +@@ -35,6 +35,8 @@ char *xstrndup (const char *s, int n); + char *xstrconcat3 (char *, const char *, const char *); + char *xstrconcat4 (char *, const char *, const char *, const char *); + ++int parse_spec(const char *spec, char **name, char **value); ++ + void die (int errcode, const char *fmt, ...); + + /* exit status - bits below are ORed */ +diff --git a/mount/swapon.c b/mount/swapon.c +index 025a6b5..3936790 100644 +--- a/mount/swapon.c ++++ b/mount/swapon.c +@@ -30,6 +30,7 @@ + int all = 0; + int verbose = 0; + int priority = -1; /* non-prioritized swap by default */ ++int mount_quiet = 0; + + /* If true, don't complain if the device/file doesn't exist */ + int ifexists = 0; +-- +1.5.0.6 + +- +To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html + +The blkid_get_cache() parses /etc/blkid.tab, it's better do it only +when we really need to resolve a spec (label or uuid). + +Signed-off-by: Karel Zak +--- + mount/fsprobe_blkid.c | 38 ++++++++++++++++++++++++++++++-------- + 1 files changed, 30 insertions(+), 8 deletions(-) + +diff --git a/mount/fsprobe_blkid.c b/mount/fsprobe_blkid.c +index 2dc734e..16a093a 100644 +--- a/mount/fsprobe_blkid.c ++++ b/mount/fsprobe_blkid.c +@@ -5,32 +5,50 @@ + static blkid_cache blkid; + + void +-fsprobe_init(void) { +- blkid_get_cache(&blkid, NULL); ++fsprobe_init(void) ++{ ++ blkid = NULL; + } + + void +-fsprobe_exit(void) { ++fsprobe_exit(void) ++{ + blkid_put_cache(blkid); + } + + const char * +-fsprobe_get_label_by_devname(const char *devname) { ++fsprobe_get_label_by_devname(const char *devname) ++{ ++ if (!blkid) ++ blkid_get_cache(&blkid, NULL); ++ + return blkid_get_tag_value(blkid, "LABEL", devname); + } + + const char * +-fsprobe_get_uuid_by_devname(const char *devname) { ++fsprobe_get_uuid_by_devname(const char *devname) ++{ ++ if (!blkid) ++ blkid_get_cache(&blkid, NULL); ++ + return blkid_get_tag_value(blkid, "UUID", devname); + } + + const char * +-fsprobe_get_devname_by_uuid(const char *uuid) { ++fsprobe_get_devname_by_uuid(const char *uuid) ++{ ++ if (!blkid) ++ blkid_get_cache(&blkid, NULL); ++ + return blkid_get_devname(blkid, "UUID", uuid); + } + + const char * +-fsprobe_get_devname_by_label(const char *label) { ++fsprobe_get_devname_by_label(const char *label) ++{ ++ if (!blkid) ++ blkid_get_cache(&blkid, NULL); ++ + return blkid_get_devname(blkid, "LABEL", label); + } + +@@ -41,7 +59,11 @@ fsprobe_known_fstype(const char *fstype) + } + + const char * +-fsprobe_get_fstype_by_devname(const char *devname) { ++fsprobe_get_fstype_by_devname(const char *devname) ++{ ++ if (!blkid) ++ blkid_get_cache(&blkid, NULL); ++ + return blkid_get_tag_value(blkid, "TYPE", devname); + } + +-- +1.5.0.6 + +- +To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html + +The functions have to check for NULL pointer. + +Signed-off-by: Karel Zak +--- + mount/fstab.c | 10 ++++++++-- + 1 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/mount/fstab.c b/mount/fstab.c +index c47f20d..eee126e 100644 +--- a/mount/fstab.c ++++ b/mount/fstab.c +@@ -293,8 +293,11 @@ has_label(const char *device, const char *label) { + int ret; + + devlabel = fsprobe_get_label_by_devname(device); ++ if (!devlabel) ++ return 0; ++ + ret = !strcmp(label, devlabel); +- /* free(devlabel); */ ++ my_free(devlabel); + return ret; + } + +@@ -304,8 +307,11 @@ has_uuid(const char *device, const char *uuid){ + int ret; + + devuuid = fsprobe_get_uuid_by_devname(device); ++ if (!devuuid) ++ return 0; ++ + ret = !strcmp(uuid, devuuid); +- /* free(devuuid); */ ++ my_free(devuuid); + return ret; + } + +-- +1.5.0.6 + +- +To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html + +The patch add new option --with-fsprobe= (where the is +blkid or volume_id). The blkid is default. The mount cannot be +compiled without a filesystem detection library. + +Signed-off-by: Kay Sievers +Signed-off-by: Karel Zak +--- + configure.ac | 26 ++++++++++++++++++++++++-- + 1 files changed, 24 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index d24ce09..e3ae318 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -56,8 +56,30 @@ AM_CONDITIONAL(HAVE_LIBUTIL, test x$ac_cv_lib_util_openpty = xyes) + AC_CHECK_LIB(termcap, tgetnum) + AM_CONDITIONAL(HAVE_TERMCAP, test x$ac_cv_lib_termcap_tgetnum = xyes) + +-AC_CHECK_LIB(blkid, blkid_known_fstype) +-AM_CONDITIONAL(HAVE_BLKID, test x$ac_cv_lib_blkid_blkid_known_fstype = xyes) ++ ++AC_ARG_WITH([fsprobe], ++ AC_HELP_STRING([--with-fsprobe], [library to guess filesystems (blkid|volume_id), default is blkid]), ++ with_fsprobe=$withval, with_fsprobe=blkid ++) ++ ++if test x$with_fsprobe = xblkid; then ++ AC_CHECK_LIB(blkid, blkid_known_fstype) ++ if test x$ac_cv_lib_blkid_blkid_known_fstype = xyes; then ++ fsprobe=blkid ++ fi ++elif test x$with_fsprobe = xvolume_id; then ++ AC_CHECK_LIB(volume_id, volume_id_open_fd) ++ if test x$ac_cv_lib_volume_id_volume_id_open_fd = xyes; then ++ fsprobe=volume_id ++ fi ++fi ++ ++if test -z "$fsprobe"; then ++ AC_MSG_ERROR([Without blkid or volume_id you will not be able to build util-linux-ng.]) ++fi ++ ++AM_CONDITIONAL(HAVE_BLKID, test x"$fsprobe" = xblkid) ++AM_CONDITIONAL(HAVE_VOLUME_ID, test x"$fsprobe" = xvolume_id) + + + AM_GNU_GETTEXT_VERSION([0.14.1]) +-- +1.5.0.6 + +- +To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html + +Signed-off-by: Matthias Koenig +Signed-off-by: Kay Sievers +Signed-off-by: Karel Zak +--- + mount/Makefile.am | 9 +++ + mount/fsprobe_volumeid.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++ + mount/mount.8 | 5 +- + mount/mount_paths.h | 4 ++ + 4 files changed, 138 insertions(+), 3 deletions(-) + +diff --git a/mount/Makefile.am b/mount/Makefile.am +index e61261f..4562b2d 100644 +--- a/mount/Makefile.am ++++ b/mount/Makefile.am +@@ -37,6 +37,15 @@ umount_LDADD += -lblkid -luuid + swapon_LDADD = -lblkid -luuid + endif + ++if HAVE_VOLUME_ID ++mount_SOURCES += fsprobe_volumeid.c ++umount_SOURCES += fsprobe_volumeid.c ++swapon_SOURCES += fsprobe_volumeid.c ++mount_LDADD += -lvolume_id ++umount_LDADD += -lvolume_id ++swapon_LDADD = -lvolume_id ++endif ++ + if HAVE_PIVOT_ROOT + sbin_PROGRAMS += pivot_root + man_MANS += pivot_root.8 +diff --git a/mount/fsprobe_volumeid.c b/mount/fsprobe_volumeid.c +new file mode 100644 +index 0000000..8c13987 +--- /dev/null ++++ b/mount/fsprobe_volumeid.c +@@ -0,0 +1,123 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "fsprobe.h" ++#include "realpath.h" ++#include "mount_paths.h" ++#include "sundries.h" ++ ++enum probe_type { ++ VOLUME_ID_NONE, ++ VOLUME_ID_LABEL, ++ VOLUME_ID_UUID, ++ VOLUME_ID_TYPE, ++}; ++ ++static char *probe(const char *device, enum probe_type type) ++{ ++ int fd; ++ uint64_t size; ++ struct volume_id *id; ++ char *value = NULL; ++ ++ fd = open(device, O_RDONLY); ++ if (fd < 0) ++ return NULL; ++ ++ id = volume_id_open_fd(fd); ++ if (!id) ++ return NULL; ++ ++ /* TODO: use blkdev_get_size() */ ++ if (ioctl(fd, BLKGETSIZE64, &size) != 0) ++ size = 0; ++ ++ if (volume_id_probe_all(id, 0, size) == 0) { ++ switch(type) { ++ case VOLUME_ID_LABEL: ++ value = xstrdup(id->label); ++ break; ++ case VOLUME_ID_UUID: ++ value = xstrdup(id->uuid); ++ break; ++ case VOLUME_ID_TYPE: ++ value = xstrdup(id->type); ++ break; ++ default: ++ break; ++ } ++ } ++ ++ volume_id_close(id); ++ return value; ++} ++ ++void ++fsprobe_init(void) ++{ ++} ++ ++void ++fsprobe_exit(void) ++{ ++} ++ ++int ++fsprobe_known_fstype(const char *fstype) ++{ ++ /* TODO ++ if (volume_id_get_prober_by_type(fstype) != NULL) ++ return 1; ++ */ ++ return 0; ++} ++ ++const char * ++fsprobe_get_uuid_by_devname(const char *devname) ++{ ++ return probe(devname, VOLUME_ID_UUID); ++} ++ ++const char * ++fsprobe_get_label_by_devname(const char *devname) ++{ ++ return probe(devname, VOLUME_ID_LABEL); ++} ++ ++const char * ++fsprobe_get_fstype_by_devname(const char *devname) ++{ ++ return probe(devname, VOLUME_ID_TYPE); ++} ++ ++const char * ++fsprobe_get_devname_by_uuid(const char *uuid) ++{ ++ char dev[PATH_MAX]; ++ ++ if (!uuid) ++ return NULL; ++ ++ snprintf(dev, sizeof(dev), PATH_DEV_BYUUID "/%s", uuid); ++ return canonicalize(dev); ++} ++ ++const char * ++fsprobe_get_devname_by_label(const char *label) ++{ ++ char dev[PATH_MAX]; ++ ++ if (!label) ++ return NULL; ++ ++ snprintf(dev, sizeof(dev), PATH_DEV_BYLABEL "/%s", label); ++ return canonicalize(dev); ++} ++ +diff --git a/mount/mount.8 b/mount/mount.8 +index 8ed5a11..be6e537 100644 +--- a/mount/mount.8 ++++ b/mount/mount.8 +@@ -477,9 +477,8 @@ If no + option is given, or if the + .B auto + type is specified, mount will try to guess the desired type. +-If mount was compiled with the blkid library, the guessing is done +-by this library. Otherwise, mount guesses itself by probing the +-superblock; if that does not turn up anything that looks familiar, ++Mount uses the blkid or volume_id library for guessing the filesystem ++type; if that does not turn up anything that looks familiar, + mount will try to read the file + .IR /etc/filesystems , + or, if that does not exist, +diff --git a/mount/mount_paths.h b/mount/mount_paths.h +index 9093b10..d726d06 100644 +--- a/mount/mount_paths.h ++++ b/mount/mount_paths.h +@@ -15,4 +15,8 @@ + #define ETC_FILESYSTEMS "/etc/filesystems" + #define PROC_FILESYSTEMS "/proc/filesystems" + ++/* udev paths */ ++#define PATH_DEV_BYLABEL "/dev/disk/by-label" ++#define PATH_DEV_BYUUID "/dev/disk/by-uuid" ++ + #endif /* MOUNT_PATHS_H */ +-- +1.5.0.6 + +- +To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html + +The util-linux-ng tests have to be useful with blkid and also with +volume_id. + +Signed-off-by: Karel Zak +--- + tests/ts-cramfs-mkfs | 15 +++++++++++---- + tests/ts-mkswap-doit | 16 ++++++++++++---- + 2 files changed, 23 insertions(+), 8 deletions(-) + +diff --git a/tests/ts-cramfs-mkfs b/tests/ts-cramfs-mkfs +index 6a9e029..1f7156e 100755 +--- a/tests/ts-cramfs-mkfs ++++ b/tests/ts-cramfs-mkfs +@@ -40,6 +40,11 @@ IMAGE_RE=$( echo $IMAGE | sed 's:/:\\/:g' ) + LABEL="testCramfs" + MOUNTPOINT="$TS_OUTDIR/cramfs-mnt" + ++ldd $TS_CMD_MOUNT | grep -q 'libvolume_id' 2>&1 >> $TS_OUTPUT ++if [ "$?" == "0" ]; then ++ HAS_VOLUMEID="yes" ++fi ++ + echo "create mountpoint dir" >> $TS_OUTPUT + if [ ! -d "$MOUNTPOINT" ]; then + mkdir -p $MOUNTPOINT +@@ -78,15 +83,17 @@ echo "create loop device from image" >> $TS_OUTPUT + DEVICE=$( $TS_CMD_LOSETUP -f ) + $TS_CMD_LOSETUP $DEVICE $IMAGE 2>&1 >> $TS_OUTPUT + +- + echo "check the image" >> $TS_OUTPUT +-blkid -c /dev/null -w /dev/null -s TYPE $DEVICE 2>&1 | grep -q 'TYPE="cramfs"' 2>&1 >> $TS_OUTPUT +- +-if [ "$?" != "0" ]; then ++if [ "$($TS_CMD_MOUNT --guess-fstype $DEVICE)" != "cramfs" ]; then + echo "Cannot found cramfs on $DEVICE" >> $TS_OUTPUT + ts_finalize + fi + ++if [ -n "$HAS_VOLUMEID" ] && [ ! -L "/dev/disk/by-label/$LABEL" ]; then ++ $TS_CMD_LOSETUP -d $DEVICE 2>&1 >> $TS_OUTPUT ++ ts_skip "udev ignores /dev/loop*" ++fi ++ + echo "mount the image" >> $TS_OUTPUT + $TS_CMD_MOUNT -L $LABEL $MOUNTPOINT 2>&1 >> $TS_OUTPUT + +diff --git a/tests/ts-mkswap-doit b/tests/ts-mkswap-doit +index 6e19b46..e4b5b76 100755 +--- a/tests/ts-mkswap-doit ++++ b/tests/ts-mkswap-doit +@@ -38,6 +38,11 @@ IMAGE="$TS_OUTDIR/loop-swap.img" + IMAGE_RE=$( echo $IMAGE | sed 's:/:\\/:g' ) + LABEL="testSwap" + ++ldd $TS_CMD_SWAPON | grep -q 'libvolume_id' 2>&1 >> $TS_OUTPUT ++if [ "$?" == "0" ]; then ++ HAS_VOLUMEID="yes" ++fi ++ + dd if=/dev/zero of=$IMAGE bs=1M count=20 &> /dev/null + + DEVICE=$( $TS_CMD_LOSETUP -f ) +@@ -54,14 +59,17 @@ $TS_CMD_LOSETUP $DEVICE $IMAGE 2>&1 >> $TS_OUTPUT + $TS_CMD_MKSWAP -L $LABEL $DEVICE 2>&1 >> $TS_OUTPUT + + # check it +-blkid -c /dev/null -w /dev/null -s TYPE $DEVICE 2>&1 | grep -q 'TYPE="swap"' 2>&1 >> $TS_OUTPUT +- +-if [ "$?" != "0" ]; then ++if [ "$($TS_CMD_MOUNT --guess-fstype $DEVICE)" != "swap" ]; then + echo "Cannot found Linux swap on $DEVICE" >> $TS_OUTPUT +- #$TS_CMD_LOSETUP -d $DEVICE 2>&1 >> $TS_OUTPUT ++ $TS_CMD_LOSETUP -d $DEVICE 2>&1 >> $TS_OUTPUT + ts_finalize + fi + ++if [ -n "$HAS_VOLUMEID" ] && [ ! -L "/dev/disk/by-label/$LABEL" ]; then ++ $TS_CMD_LOSETUP -d $DEVICE 2>&1 >> $TS_OUTPUT ++ ts_skip "udev ignores /dev/loop*" ++fi ++ + # try connect it to system (and found the device by label) + $TS_CMD_SWAPON -L $LABEL 2>&1 >> $TS_OUTPUT + +-- +1.5.0.6 + +- +To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in +the body of a message to majordomo@vger.kernel.org +More majordomo info at http://vger.kernel.org/majordomo-info.html + diff --git a/util-linux-2.13-sys_utils_arch.patch b/util-linux-2.13-sys_utils_arch.patch index 4b63ad0..def23d9 100644 --- a/util-linux-2.13-sys_utils_arch.patch +++ b/util-linux-2.13-sys_utils_arch.patch @@ -1,7 +1,7 @@ -Index: util-linux-ng-2.12r+git20070330/sys-utils/Makefile.am +Index: util-linux-ng-2.12r+git20070509/sys-utils/Makefile.am =================================================================== ---- util-linux-ng-2.12r+git20070330.orig/sys-utils/Makefile.am -+++ util-linux-ng-2.12r+git20070330/sys-utils/Makefile.am +--- util-linux-ng-2.12r+git20070509.orig/sys-utils/Makefile.am ++++ util-linux-ng-2.12r+git20070509/sys-utils/Makefile.am @@ -1,9 +1,11 @@ include $(top_srcdir)/config/include-Makefile.am @@ -21,13 +21,13 @@ Index: util-linux-ng-2.12r+git20070330/sys-utils/Makefile.am -man_MANS = flock.1 ionice.1 readprofile.1 \ +man_MANS = arch.1 flock.1 ionice.1 readprofile.1 \ - ctrlaltdel.8 cytune.8 dmesg.8 ipcrm.8 ipcs.8 renice.8 \ - setsid.8 tunelp.8 + ctrlaltdel.8 cytune.8 dmesg.1 ipcrm.1 ipcs.1 renice.1 \ + setsid.1 tunelp.8 -Index: util-linux-ng-2.12r+git20070330/sys-utils/arch.1 +Index: util-linux-ng-2.12r+git20070509/sys-utils/arch.1 =================================================================== --- /dev/null -+++ util-linux-ng-2.12r+git20070330/sys-utils/arch.1 ++++ util-linux-ng-2.12r+git20070509/sys-utils/arch.1 @@ -0,0 +1,34 @@ +.\" arch.1 -- +.\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) @@ -63,10 +63,10 @@ Index: util-linux-ng-2.12r+git20070330/sys-utils/arch.1 +.\" Then how come we get these i586 values? +.\" Well, the routine check_bugs() does system_utsname.machine[1] = '0' + x86; +.\" (called in init/main.c, defined in ./include/asm-i386/bugs.h) -Index: util-linux-ng-2.12r+git20070330/sys-utils/arch.c +Index: util-linux-ng-2.12r+git20070509/sys-utils/arch.c =================================================================== --- /dev/null -+++ util-linux-ng-2.12r+git20070330/sys-utils/arch.c ++++ util-linux-ng-2.12r+git20070509/sys-utils/arch.c @@ -0,0 +1,35 @@ +/* arch -- print machine architecture information + * Created: Mon Dec 20 12:27:15 1993 by faith@cs.unc.edu diff --git a/util-linux-mount_libvolume_id_support.patch b/util-linux-mount_libvolume_id_support.patch deleted file mode 100644 index 3e168ad..0000000 --- a/util-linux-mount_libvolume_id_support.patch +++ /dev/null @@ -1,483 +0,0 @@ -Index: util-linux-ng-2.12r+git20070330/mount/fstab.c -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/mount/fstab.c -+++ util-linux-ng-2.12r+git20070330/mount/fstab.c -@@ -305,6 +305,7 @@ has_uuid(const char *device, const char - struct mntentchn * - getfsspecfile (const char *spec, const char *file) { - struct mntentchn *mc, *mc0; -+ char *nspec; - - mc0 = fstab_head(); - -@@ -315,11 +316,12 @@ getfsspecfile (const char *spec, const c - return mc; - - /* second attempt: names found after symlink resolution */ -+ nspec = canonicalize(spec); - for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) - if ((streq(mc->m.mnt_dir, file) || - streq(canonicalize(mc->m.mnt_dir), file)) - && (streq(mc->m.mnt_fsname, spec) || -- streq(canonicalize(mc->m.mnt_fsname), spec))) -+ streq(canonicalize(mc->m.mnt_fsname), nspec))) - return mc; - - /* third attempt: names found after LABEL= or UUID= resolution */ -@@ -356,11 +358,21 @@ getfsfile (const char *file) { - struct mntentchn * - getfsspec (const char *spec) { - struct mntentchn *mc, *mc0; -+ const char *nspec, *fsname; - - mc0 = fstab_head(); -- for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) -- if (streq(mc->m.mnt_fsname, spec)) -+ for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) { -+ if (!strncmp (mc->m.mnt_fsname, "LABEL=", 6)) { -+ fsname = mount_get_devname_by_label(mc->m.mnt_fsname + 6); -+ } else if (!strncmp(mc->m.mnt_fsname, "UUID=", 5)) { -+ fsname = mount_get_devname_by_uuid(mc->m.mnt_fsname + 5); -+ } else { -+ fsname = mc->m.mnt_fsname; -+ } -+ nspec = canonicalize(fsname); -+ if (streq(nspec, spec)) - return mc; -+ } - return NULL; - } - -@@ -723,6 +735,8 @@ char *progname; - - const char *mount_get_volume_label_by_spec(const char *spec) { return NULL; } - const char *mount_get_devname_by_uuid(const char *uuid) { return NULL; } -+const char *mount_get_devname_by_label(const char *label) { return NULL; } -+const char *mount_get_volume_uuid_by_spec(const char *spec) { return NULL; } - struct my_mntent *my_getmntent (mntFILE *mfp) { return NULL; } - mntFILE *my_setmntent (const char *file, char *mode) { return NULL; } - void my_endmntent (mntFILE *mfp) { } -Index: util-linux-ng-2.12r+git20070330/mount/mount.c -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/mount/mount.c -+++ util-linux-ng-2.12r+git20070330/mount/mount.c -@@ -1746,6 +1746,8 @@ main(int argc, char *argv[]) { - if (mc == NULL) - mc = getfsspec (spec); - if (mc == NULL) -+ mc = getfsspec (canonicalize(spec)); -+ if (mc == NULL) - die (EX_USAGE, - _("mount: cannot find %s in %s"), - spec, _PATH_FSTAB); -Index: util-linux-ng-2.12r+git20070330/mount/mount_blkid.c -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/mount/mount_blkid.c -+++ util-linux-ng-2.12r+git20070330/mount/mount_blkid.c -@@ -1,6 +1,7 @@ - #include - #include "mount_blkid.h" - -+#ifndef HAVE_LIBVOLUME_ID - #ifdef HAVE_LIBBLKID - - blkid_cache blkid; -@@ -118,4 +119,5 @@ mount_get_devname_for_mounting(const cha - } - - --#endif -+#endif /* HAVE_LIBBLKID */ -+#endif /* HAVE_LIBVOLUME_ID */ -Index: util-linux-ng-2.12r+git20070330/mount/mount_blkid.h -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/mount/mount_blkid.h -+++ util-linux-ng-2.12r+git20070330/mount/mount_blkid.h -@@ -11,3 +11,5 @@ extern const char *mount_get_volume_uuid - extern const char *mount_get_volume_label_by_spec(const char *spec); - extern const char *mount_get_devname(const char *spec); - extern const char *mount_get_devname_for_mounting(const char *spec); -+ -+extern const char *volume_id_get_tag(const char *spec, const char *token); -Index: util-linux-ng-2.12r+git20070330/mount/mount_by_label.c -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/mount/mount_by_label.c -+++ util-linux-ng-2.12r+git20070330/mount/mount_by_label.c -@@ -1,4 +1,4 @@ --#ifndef HAVE_LIBBLKID -+#if (!defined HAVE_BLKID) && (!defined HAVE_LIBVOLUME_ID) - /* - * mount_by_label.c - aeb - * -Index: util-linux-ng-2.12r+git20070330/mount/mount_guess_fstype.c -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/mount/mount_guess_fstype.c -+++ util-linux-ng-2.12r+git20070330/mount/mount_guess_fstype.c -@@ -46,15 +46,29 @@ - #define ETC_FILESYSTEMS "/etc/filesystems" - #define PROC_FILESYSTEMS "/proc/filesystems" - -+#ifdef HAVE_LIBVOLUME_ID -+ -+static int -+known_fstype(const char *fstype) { -+ return 0; -+} -+ -+const char * -+do_guess_fstype(const char *spec) -+{ -+ return volume_id_get_tag(spec, "TYPE"); -+} -+ -+#else - #ifdef HAVE_LIBBLKID - --char * -+const char * - do_guess_fstype(const char *device) - { - return blkid_get_tag_value(blkid, "TYPE", device); - } - --static int -+const static int - known_fstype(const char *fstype) - { - return blkid_known_fstype(fstype); -@@ -492,6 +506,7 @@ io_error: - } - - #endif -+#endif - - static struct tried { - struct tried *next; -@@ -534,9 +549,9 @@ free_tested(void) { - tried = NULL; - } - --char * -+const char * - guess_fstype(const char *spec) { -- char *type = do_guess_fstype(spec); -+ const char *type = do_guess_fstype(spec); - if (verbose) { - printf (_("mount: you didn't specify a filesystem type for %s\n"), - spec); -Index: util-linux-ng-2.12r+git20070330/mount/mount_udev.c -=================================================================== ---- /dev/null -+++ util-linux-ng-2.12r+git20070330/mount/mount_udev.c -@@ -0,0 +1,237 @@ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "mount_blkid.h" -+ -+#ifdef HAVE_LIBVOLUME_ID -+ -+extern int verbose; -+ -+struct volume_id_types_t { -+ int id; -+ char *token; -+ char *env; -+}; -+ -+enum { -+ VOLUME_ID_NONE=0, -+ VOLUME_ID_TYPE, -+ VOLUME_ID_LABEL, -+ VOLUME_ID_UUID -+}; -+ -+#define volume_id_offset(member) (unsigned long)offsetof(struct volume_id,member) -+ -+struct volume_id_types_t volume_id_types[] = { -+ { VOLUME_ID_TYPE, "TYPE", "ID_FS_TYPE" }, -+ { VOLUME_ID_LABEL, "LABEL", "ID_FS_LABEL" }, -+ { VOLUME_ID_UUID, "UUID", "ID_FS_UUID" }, -+ { VOLUME_ID_NONE, NULL, NULL }, -+}; -+ -+const char * -+volume_id_get_tag(const char *spec, const char *token) -+{ -+ struct volume_id *vid; -+ uint64_t size; -+ struct volume_id_types_t *volume_id_ptr = volume_id_types; -+ char *var, *value; -+ -+ value = calloc(1, VOLUME_ID_LABEL_SIZE); -+ if (!value) -+ return NULL; -+ -+ if (!spec) -+ return NULL; -+ -+ while (volume_id_ptr->token && strcmp(volume_id_ptr->token,token)) -+ volume_id_ptr++; -+ -+ if (!volume_id_ptr->token) { -+ free(value); -+ value = NULL; -+ goto out; -+ } -+ -+ /* Quick exit if ID_FS_* variables are set */ -+ if ((var = getenv(volume_id_ptr->env))) { -+ strncpy(value,var,VOLUME_ID_LABEL_SIZE - 1); -+ goto out; -+ } -+ -+ vid = volume_id_open_node(spec); -+ if (!vid) { -+ free(value); -+ value = NULL; -+ goto out; -+ } -+ -+ if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0) -+ size = 0; -+ -+ if (volume_id_probe_all(vid, 0, size) == 0) { -+ switch(volume_id_ptr->id) { -+ case VOLUME_ID_TYPE: -+ strcpy(value, vid->type); -+ break; -+ case VOLUME_ID_LABEL: -+ strcpy(value, vid->label); -+ break; -+ case VOLUME_ID_UUID: -+ strcpy(value, vid->uuid); -+ break; -+ default: -+ free(value); -+ value = NULL; -+ break; -+ } -+ } else -+ value = NULL; -+ -+ volume_id_close(vid); -+ -+ out: -+ return value; -+} -+ -+void -+mount_blkid_get_cache(void) {} -+ -+void -+mount_blkid_put_cache(void) {} -+ -+const char * -+mount_get_volume_uuid_by_spec(const char *spec) -+{ -+ return volume_id_get_tag(spec, "UUID"); -+} -+ -+const char * -+mount_get_volume_label_by_spec(const char *spec) -+{ -+ return volume_id_get_tag(spec, "LABEL"); -+} -+ -+const char * -+mount_get_devname_by_uuid(const char *uuid) { -+ char *dev = NULL; -+ -+ if (!uuid) -+ return NULL; -+ -+ dev = malloc(19 + strlen(uuid)); -+ if (dev) { -+ strcpy(dev,"/dev/disk/by-uuid/"); -+ strcat(dev,uuid); -+ } -+ -+ return dev; -+} -+ -+const char * -+mount_get_devname_by_label(const char *label) { -+ char *dev = NULL; -+ -+ if (!label) -+ return NULL; -+ -+ dev = malloc(20 + strlen(label)); -+ if (dev) { -+ strcpy(dev,"/dev/disk/by-label/"); -+ strcat(dev,label); -+ } -+ -+ return dev; -+} -+ -+const char * -+mount_get_devname(const char *spec) -+{ -+ char *token, *cp, *value; -+ const char *nspec = NULL; -+ -+ if (!spec) -+ return NULL; -+ -+ token = strdup(spec); -+ if (!token) -+ return NULL; -+ -+ /* We have to return an allocated string */ -+ if (!(cp = strchr(token, '='))) -+ return token; -+ -+ value = token + (cp - token); -+ *value++ = '\0'; -+ -+ if (*value == '"' || *value == '\'') { -+ char c = *value++; -+ if (!(cp = strrchr(value, c))) -+ goto errout; /* missing closing quote */ -+ *cp = '\0'; -+ } -+ -+ if (!strcmp(token,"LABEL")) { -+ nspec = mount_get_devname_by_label(value); -+ } else if (!strcmp(token,"UUID")) { -+ nspec = mount_get_devname_by_uuid(value); -+ } -+ -+ free(token); -+ -+ errout: -+ return nspec; -+} -+ -+/* Also when no UUID= or LABEL= occur? No verbose? No warnings? */ -+const char * -+mount_get_devname_for_mounting(const char *spec) -+{ -+ char *token, *cp, *value; -+ const char *nspec = NULL; -+ -+ if (!spec) -+ return NULL; -+ -+ token = strdup(spec); -+ if (!token) -+ return NULL; -+ -+ /* We have to return an allocated string */ -+ if (!(cp = strchr(token, '='))) -+ return token; -+ -+ value = token + (cp - token); -+ *value++ = '\0'; -+ -+ if (*value == '"' || *value == '\'') { -+ char c = *value++; -+ if (!(cp = strrchr(value, c))) -+ goto errout; /* missing closing quote */ -+ *cp = '\0'; -+ } -+ -+ if (!strcmp(token,"LABEL")) { -+ nspec = mount_get_devname_by_label(value); -+ if (nspec && verbose > 1) -+ printf(_("mount: going to mount %s by LABEL\n"), spec); -+ } else if (!strcmp(token,"UUID")) { -+ nspec = mount_get_devname_by_uuid(value); -+ if (nspec && verbose > 1) -+ printf(_("mount: going to mount %s by UUID\n"), spec); -+ } -+ -+ free(token); -+ -+ errout: -+ return nspec; -+} -+ -+#endif -Index: util-linux-ng-2.12r+git20070330/mount/mount_guess_fstype.h -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/mount/mount_guess_fstype.h -+++ util-linux-ng-2.12r+git20070330/mount/mount_guess_fstype.h -@@ -8,8 +8,8 @@ struct mountargs { - - extern int verbose; - --char *guess_fstype(const char *device); --char *do_guess_fstype(const char *device); -+const char *guess_fstype(const char *device); -+const char *do_guess_fstype(const char *device); - int procfsloop(int (*mount_fn)(struct mountargs *), struct mountargs *args, - const char **type); - int is_in_procfs(const char *fstype); -Index: util-linux-ng-2.12r+git20070330/configure.ac -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/configure.ac -+++ util-linux-ng-2.12r+git20070330/configure.ac -@@ -57,8 +57,10 @@ AC_CHECK_LIB(termcap, tgetnum) - AM_CONDITIONAL(HAVE_TERMCAP, test x$ac_cv_lib_termcap_tgetnum = xyes) - - AC_CHECK_LIB(blkid, blkid_known_fstype) --AM_CONDITIONAL(HAVE_BLKID, test x$ac_cv_lib_blkid_blkid_known_fstype = xyes) -+AC_CHECK_LIB(volume_id, volume_id_open_node) - -+AM_CONDITIONAL(HAVE_BLKID, test x$ac_cv_lib_blkid_blkid_known_fstype = xyes) -+AM_CONDITIONAL(HAVE_VOLUME_ID, test x$ac_cv_lib_volume_id_volume_id_open_node = xyes) - - AM_GNU_GETTEXT_VERSION([0.14.1]) - AM_GNU_GETTEXT([external]) -Index: util-linux-ng-2.12r+git20070330/mount/Makefile.am -=================================================================== ---- util-linux-ng-2.12r+git20070330.orig/mount/Makefile.am -+++ util-linux-ng-2.12r+git20070330/mount/Makefile.am -@@ -16,7 +16,7 @@ MNTHDRS = fstab.h linux_fs.h mount_mnten - - mount_SOURCES = mount.c fstab.c sundries.c xmalloc.c realpath.c mount_mntent.c \ - get_label_uuid.c mount_by_label.c mount_blkid.c mount_guess_fstype.c \ -- getusername.c \ -+ mount_udev.c getusername.c \ - nfsmount.c nfsmount_clnt.c nfs4mount.c \ - lomount.c \ - $(MNTHDRS) -@@ -24,14 +24,14 @@ mount_SOURCES = mount.c fstab.c sundries - mount_LDADD = $(top_srcdir)/lib/libenv.a $(top_srcdir)/lib/libsetproctitle.a libnfsmount_xdr.a - - umount_SOURCES = umount.c fstab.c sundries.c xmalloc.c realpath.c mount_mntent.c \ -- getusername.c get_label_uuid.c mount_by_label.c mount_blkid.c \ -+ getusername.c get_label_uuid.c mount_by_label.c mount_blkid.c mount_udev.c \ - lomount.c \ - $(MNTHDRS) - - umount_LDADD = $(top_srcdir)/lib/libenv.a - - swapon_SOURCES = swapon.c xmalloc.c \ -- get_label_uuid.c mount_by_label.c mount_blkid.c \ -+ get_label_uuid.c mount_by_label.c mount_blkid.c mount_udev.c \ - swap_constants.h realpath.c - - losetup_SOURCES = lomount.c loop.h lomount.h -@@ -43,6 +43,12 @@ umount_LDADD += -lblkid -luuid - swapon_LDADD = -lblkid -luuid - endif - -+if HAVE_VOLUME_ID -+mount_LDADD += -lvolume_id -+umount_LDADD += -lvolume_id -+swapon_LDADD = -lvolume_id -+endif -+ - if HAVE_PIVOT_ROOT - sbin_PROGRAMS += pivot_root - man_MANS += pivot_root.8 diff --git a/util-linux-mount_nfs.8.patch b/util-linux-mount_nfs.8.patch deleted file mode 100644 index 9ee6e65..0000000 --- a/util-linux-mount_nfs.8.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- util-linux-2.12q/mount/nfs.5 -+++ util-linux-2.12q/mount/nfs.5 -@@ -141,7 +141,7 @@ - Use an alternate RPC version number to contact the - NFS daemon on the remote host. This option is useful - for hosts that can run multiple NFS servers. --The default value is version 2. -+The default value is version 3. - .TP 1.5i - .I nolock - Disable NFS locking. Do not start lockd. diff --git a/util-linux-mount_warn_nfsudp.patch b/util-linux-mount_warn_nfsudp.patch deleted file mode 100644 index 215a283..0000000 --- a/util-linux-mount_warn_nfsudp.patch +++ /dev/null @@ -1,120 +0,0 @@ -Index: util-linux-ng-2.12r+2.13pre7/mount/nfs.5 -=================================================================== ---- util-linux-ng-2.12r+2.13pre7.orig/mount/nfs.5 -+++ util-linux-ng-2.12r+2.13pre7/mount/nfs.5 -@@ -238,9 +238,13 @@ writing to common filesystem on the serv - Mount the NFS filesystem using the TCP protocol instead of the - UDP protocol. This is the default, but in case it fails (many NFS servers only - support UDP) it will fallback and try UDP. -+.IP -+.B Before using NFS over UDP, please refer to the section WARNINGS below. - .TP 1.5i - .I udp - Mount the NFS filesystem using the UDP protocol. -+.IP -+.B Before using NFS over UDP, please refer to the section WARNINGS below. - .TP 1.5i - .I noacl - Assume no extended access control mechanisms like POSIX ACLs are used -@@ -411,6 +415,83 @@ writing to common filesystem on the serv - All of the non-value options have corresponding nooption forms. - For example, nointr means don't allow file operations to be - interrupted. -+.SH WARNINGS -+Using NFS over UDP on high-speed links such as Gigabit -+.BR "can cause silent data corruption" . -+.P -+The problem can be triggered at high loads, and is caused by problems in -+IP fragment reassembly. NFS read and writes typically transmit UDP packets -+of 4 Kilobytes or more, which have to be broken up into several fragments -+in order to be sent over the Ethernet link, which limits packets to 1500 -+bytes by default. This process happens at the IP network layer and is -+called fragmentation. -+.P -+In order to identify fragments that belong together, IP assigns a 16bit -+.I IP ID -+value to each packet; fragments generated from the same UDP packet -+will have the same IP ID. The receiving system will collect these -+fragments and combine them to form the original UDP packet. This process -+is called reassembly. The default timeout for packet reassembly is -+30 seconds; if the network stack does not receive all fragments of -+a given packet within this interval, it assumes the missing fragment(s) -+got lost and discards those it already received. -+.P -+The problem this creates over high-speed links is that it is possible -+to send more than 65536 packets within 30 seconds. In fact, with -+heavy NFS traffic one can observe that the IP IDs repeat after about -+5 seconds. -+.P -+This has serious effects on reassembly: if one fragment gets lost, -+another fragment -+.I from a different packet -+but with the -+.I same IP ID -+will arrive within the 30 second timeout, and the network stack will -+combine these fragments to form a new packet. Most of the time, network -+layers above IP will detect this mismatched reassembly - in the case -+of UDP, the UDP checksum, which is a 16 bit checksum over the entire -+packet payload, will usually not match, and UDP will discard the -+bad packet. -+.P -+However, the UDP checksum is 16 bit only, so there is a chance of 1 in -+65536 that it will match even if the packet payload is completely -+random (which very often isn't the case). If that is the case, -+silent data corruption will occur. -+.P -+This potential should be taken seriously, at least on Gigabit -+Ethernet. -+Network speeds of 100Mbit/s should be considered less -+problematic, because with most traffic patterns IP ID wrap around -+will take much longer than 30 seconds. -+.P -+It is therefore strongly recommended to use -+.BR "NFS over TCP where possible" , -+since TCP does not perform fragmentation. -+.P -+If you absolutely have to use NFS over UDP over Gigabit Ethernet, -+some steps can be taken to mitigate the problem and reduce the -+probability of corruption: -+.TP +1.5i -+.I Jumbo frames: -+Many Gigabit network cards are capable of transmitting -+frames bigger than the 1500 byte limit of traditional Ethernet, typically -+9000 bytes. Using jumbo frames of 9000 bytes will allow you to run NFS over -+UDP at a page size of 8K without fragmentation. Of course, this is -+only feasible if all involved stations support jumbo frames. -+.IP -+To enable a machine to send jumbo frames on cards that support it, -+it is sufficient to configure the interface for a MTU value of 9000. -+.TP +1.5i -+.I Lower reassembly timeout: -+By lowering this timeout below the time it takes the IP ID counter -+to wrap around, incorrect reassembly of fragments can be prevented -+as well. To do so, simply write the new timeout value (in seconds) -+to the file -+.BR /proc/sys/net/ipv4/ipfrag_time . -+.IP -+A value of 2 seconds will greatly reduce the probability of IPID clashes on -+a single Gigabit link, while still allowing for a reasonable timeout -+when receiving fragmented traffic from distant peers. - .SH FILES - .I /etc/fstab - .SH "SEE ALSO" -Index: util-linux-ng-2.12r+2.13pre7/mount/nfsmount.c -=================================================================== ---- util-linux-ng-2.12r+2.13pre7.orig/mount/nfsmount.c -+++ util-linux-ng-2.12r+2.13pre7/mount/nfsmount.c -@@ -735,8 +735,12 @@ retry_udp: - goto fail; - } - fsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); -- } else -+ } else { - fsock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); -+ fprintf(stderr, -+ "Using NFS over UDP can cause data corruption.\n" -+ "Please refer to the WARNINGS section of the nfs(5) manual page.\n"); -+ } - if (fsock < 0) { - perror(_("nfs socket")); - goto fail; diff --git a/util-linux-ng-2.12r+git20070412.tar.bz2 b/util-linux-ng-2.12r+git20070412.tar.bz2 deleted file mode 100644 index abf8a26..0000000 --- a/util-linux-ng-2.12r+git20070412.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:24be49bdf51ff79df2f4289c2c72471aefd9e2a5473cac2c66893cbee612a040 -size 1521684 diff --git a/util-linux-ng-2.12r+git20070509.tar.bz2 b/util-linux-ng-2.12r+git20070509.tar.bz2 new file mode 100644 index 0000000..fa55b66 --- /dev/null +++ b/util-linux-ng-2.12r+git20070509.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be7bac40f6c1ba44b66cd829241f8c6368ff56e823d1c7f673c0321b3d980f99 +size 1504607 diff --git a/util-linux.changes b/util-linux.changes index b89b8c7..bab20b5 100644 --- a/util-linux.changes +++ b/util-linux.changes @@ -1,10 +1,30 @@ +------------------------------------------------------------------- +Tue Jun 5 17:01:48 CEST 2007 - mkoenig@suse.de + +- update to git20070509 + mount: NFS code removed (use mount.nfs{,4} from nfs-utils) +- remove sm-notify (nfs-utils) +- removed patches + util-linux-2.11u-mount_nfs_mount_acl.patch + util-linux-2.12-mount_base_nfsv4.patch + util-linux-2.12-mount_mountfallback.patch + util-linux-2.12-mount_nfs_tcp.patch + util-linux-2.12q-mount_strict_aliasing.patch + util-linux-2.12r-mount_nfs_remount_options.patch + util-linux-2.12r-mount_rpcsec_gss.patch + util-linux-2.12r-mount_sec_manpage.patch + util-linux-2.12r-mount_umount_nosysfs.patch + util-linux-2.13-mount_nfs_timeo.patch + util-linux-mount_nfs.8.patch + util-linux-mount_warn_nfsudp.patch + ------------------------------------------------------------------- Tue Jun 5 14:34:49 CEST 2007 - pth@suse.de - Update to which-2.16, mainly because regenerating configure with newer autotools works. - Fix the patch for AC_CHECK_STATICLIB -- Our distribution doesn't install libiberty.a, so pass +- Our distribution doesn't install libiberty.a, so pass --disable-iberty to configure of which to not use a libiberty from somewhere else. diff --git a/util-linux.spec b/util-linux.spec index 7656993..7cdb5e1 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -1,5 +1,5 @@ # -# spec file for package util-linux (Version 2.12r+git20070412) +# spec file for package util-linux (Version 2.12r+git20070509) # # Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -20,8 +20,8 @@ PreReq: %install_info_prereq permissions License: BSD License and BSD-like, GNU General Public License (GPL) Group: System/Base Autoreqprov: on -Version: 2.12r+git20070412 -Release: 14 +Version: 2.12r+git20070509 +Release: 1 Summary: A collection of basic system utilities Source: ftp://ftp.kernel.org/pub/linux/utils/util-linux/%name-ng-%version.tar.bz2 Source2: nologin.c @@ -40,51 +40,33 @@ Source13: time-%{time_ver}.tar.gz Source15: cryptoloop.txt Source22: setctsid.c Source23: setctsid.8 -Source24: sm-notify-20060111.tar.bz2 -Source25: nfsboot Source26: README.raw -Source27: renice.8 Source28: mkzimage_cmdline.8 Source29: mkzimage_cmdline.c Source30: README.largedisk ## ## util-linux ## +Patch0: util-linux-2.13-mount_volume_id.patch # add hostid Patch1: util-linux-2.12-misc_utils_hostid.patch # 27181 (suse12181) - wall adds newlines Patch2: util-linux-login_utils_wall.patch -# 31815 (suse16815) - Fixed nfs.5 to tell nfsver defaults to 3 -Patch3: util-linux-mount_nfs.8.patch -# 33183 (suse18183) - NFS ACCESS patch, [no]acl nfs mount option -Patch4: util-linux-2.11u-mount_nfs_mount_acl.patch Patch5: util-linux-mount_mount.8-acl.patch # geteuid instead of getuid in hwclock to enable making hwclock suid root. Patch6: util-linux-2.11z-hwclock_geteuid.patch -# 48018 (suse33018) - mount -t nfs must default to tcp in sles9 -Patch7: util-linux-2.12-mount_nfs_tcp.patch # 54436 (suse39436) - boot.swap "failed" activating swap on LVM Patch8: util-linux-2.12a-mount_procswapcheck.patch -# 56735 (suse41735) - NFS can't mount some exports -Patch9: util-linux-2.12-mount_mountfallback.patch # 57097 (suse42097) - mount doesn't allow to mount files that have colons in their path Patch10: util-linux-2.12a-mount_mountpointwithcolon.patch -# 76198 - Default retransmit timeout is too small on NFS over TCP -Patch11: util-linux-2.13-mount_nfs_timeo.patch -# Basic NFSv4 support -Patch12: util-linux-2.12-mount_base_nfsv4.patch -# 80263 - UDP data corruption due to incorrect IP fragment reassembly -Patch13: util-linux-mount_warn_nfsudp.patch # add ionice Patch14: util-linux-2.12q-sys_utils_ionice.patch # 104081 - make fdisk detect MAC-fs Patch15: util-linux-2.11q-fdisk_fs_mac.patch # 104405 - mount -a doesn't work with hotpluggable devices Patch16: util-linux-mount_opt_hotplug.patch -Patch17: util-linux-2.12a-mount_mountbylabel-dm.patch # 115129 - mount --move doesn't work as expected Patch18: util-linux-2.12q-mount_--move.patch -Patch19: util-linux-2.12q-mount_strict_aliasing.patch Patch20: util-linux-2.12r-mount_by_uuid.patch Patch21: util-linux-2.12q-mount_umount2_not_static.patch # 148409 - df, mount, /proc/mounts show root mounted twice @@ -92,19 +74,11 @@ Patch21: util-linux-2.12q-mount_umount2_not_static.patch Patch22: util-linux-2.12r-mount_mtab_update.patch # 153657 - fdisk is not able to manage huge disks Patch23: util-linux-2.12r-fdisk_fdiskwrap.patch -# 158401 - cthon06: NFSv3 client does not support RPCSEC_GSS -Patch24: util-linux-2.12r-mount_rpcsec_gss.patch # 176582 - If the user doesn't specify -t mount.fstype will never be called #TODO: check alternative upstream fix #Patch96: util-linux-2.12r-mount_external_prog_on_guess.patch -# 159368 - NFSv4: krb5p; nfs(5) manpage -Patch25: util-linux-2.12r-mount_sec_manpage.patch # 158955 - document xfs dmapi mount options better Patch26: util-linux-2.12r-mount_mount.8_xfs_update.patch -# use libvolume_id for fs guessing -Patch27: util-linux-mount_libvolume_id_support.patch -# 190385 - Added sysfs to list of filesystems not to unmount with umount -a -Patch28: util-linux-2.12r-mount_umount_nosysfs.patch # 160822 - fix for 153657 Patch29: util-linux-2.12r-fdisk_cyl.patch # 179122 - Fix readprofile one ppc64 @@ -113,8 +87,6 @@ Patch30: util-linux-2.12r-sys_utils_readprofile_mapfile.patch Patch31: util-linux-2.12r-misc_utils_cal_formatting.patch # 205956 - default swap to V1 in any case Patch32: util-linux-2.12r-disk_utils_mkswap_fix.patch -# 130625 - do not append addr option with each nfs remount -Patch33: util-linux-2.12r-mount_nfs_remount_options.patch # 238687 - let mkfs tools open block devices with O_EXCL Patch34: util-linux-2.12r-disk_utils_mkfs_open_exclusive.patch # 241372 - remove legacy warnings from fdisk @@ -122,6 +94,7 @@ Patch35: util-linux-2.12r-fdisk_remove_bogus_warnings.patch # 242750 - mount: fix race condition when using -o loop Patch36: util-linux-2.12r-mount_racy_loop.patch # 254437 - swapon should automatically reset the suspend signature +# TODO: Needs to be ported to new version Patch38: util-linux-2.12r-mount_swapon_swsuspend_resume.patch Patch40: util-linux-2.13-sys_utils_arch.patch Patch41: util-linux-2.13-build_gnu_source.patch @@ -159,44 +132,31 @@ Authors: Karel Zak %prep -%setup -q -a 9 -b 10 -b 11 -b 12 -b 13 -b 24 -n %name-ng-%version +%setup -q -a 9 -b 10 -b 11 -b 12 -b 13 -n %name-ng-%version +%patch0 -p1 %patch1 -p1 %patch2 -p1 -%patch3 -p1 -%patch4 -p1 %patch5 -p0 %patch6 -%patch7 -p1 %patch8 -p1 -%patch9 -p1 %patch10 -p1 -%patch11 -p1 -%patch12 -p1 -%patch13 -p1 %patch14 -p1 %patch15 -p1 %patch16 -p1 -%patch17 -p1 %patch18 -%patch19 -p1 -%patch20 -p1 +#%patch20 -p1 %patch21 %patch22 %patch23 -p1 -%patch24 -%patch25 -p1 %patch26 -%patch27 -p1 -%patch28 %patch29 -p1 %patch30 -p1 %patch31 %patch32 -p1 -%patch33 -p1 %patch34 -p1 %patch35 -p1 %patch36 -p1 -%patch38 -p1 +#%patch38 -p1 %patch40 -p1 %patch41 -p1 %patch42 -p1 @@ -216,7 +176,6 @@ cd ../time-* %patch60 cd ../which-* %patch70 -autoreconf -fi %build # adjtimex build @@ -231,12 +190,11 @@ make CFLAGS="$RPM_OPT_FLAGS" freeramdisk cd .. # which build cd which-%{which_ver} +autoreconf -fi %{?suse_update_config:%{suse_update_config}} CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr \ --mandir=%{_mandir} \ --infodir=%{_infodir} \ - --libdir=%{_libdir} \ - --disable-iberty \ %{_target_cpu}-suse-linux make cd .. @@ -255,10 +213,6 @@ cd .. cd klogconsole make CFLAGS="$RPM_OPT_FLAGS" cd .. -# sm-notify build -cd sm-notify* -make CFLAGS="$RPM_OPT_FLAGS" -cd .. popd # setctsid build rm -f setctsid @@ -273,6 +227,7 @@ CFLAGS=-DCONFIG_SMP ./autogen.sh ./configure --mandir=%{_mandir} \ --datadir=%{_datadir} \ + --with-fsprobe=volume_id \ --enable-elvtune \ --enable-mesg \ --enable-partx \ @@ -320,18 +275,6 @@ cd .. # klogconsole install cd klogconsole make install DEST=$RPM_BUILD_ROOT -cd .. -# sm-notify install -cd sm-notify* -install sm-notify $RPM_BUILD_ROOT/sbin -install -m 0644 sm-notify.8 $RPM_BUILD_ROOT/%_mandir/man8 -install %SOURCE25 $RPM_BUILD_ROOT/etc/init.d -mkdir -p $RPM_BUILD_ROOT/var/lib/nfs/sm -chmod 700 $RPM_BUILD_ROOT/var/lib/nfs/sm -mkdir -p $RPM_BUILD_ROOT/var/lib/nfs/sm.bak -chmod 700 $RPM_BUILD_ROOT/var/lib/nfs/sm.bak -touch $RPM_BUILD_ROOT/var/lib/nfs/state -chmod 644 $RPM_BUILD_ROOT/var/lib/nfs/state popd # # util-linux install @@ -348,7 +291,6 @@ install -m 644 nologin.8 $RPM_BUILD_ROOT%{_mandir}/man8 # setctsid install install -m 755 setctsid $RPM_BUILD_ROOT/usr/sbin install -m 444 setctsid.8 $RPM_BUILD_ROOT%{_mandir}/man8/ -install -m 444 %SOURCE27 $RPM_BUILD_ROOT%{_mandir}/man8/ echo -e "#! /bin/bash\n/sbin/blockdev --flushbufs \$1" > $RPM_BUILD_ROOT/usr/sbin/flushb chmod 755 $RPM_BUILD_ROOT/usr/sbin/flushb # Install scripts to configure raw devices at boot time @@ -390,7 +332,6 @@ rm -rf $RPM_BUILD_ROOT %post %{fillup_and_insserv -ps raw ACTIVATE_RAW_DEV} -%{fillup_and_insserv -fY nfsboot} %install_info --entry="* freeramdisk: (freeramdisk). tell kernel to free allocated memory for ramdisk" --info-dir=%{_infodir} %{_infodir}/freeramdisk.info.gz %install_info --info-dir=%{_infodir} %{_infodir}/ipc.info.gz %install_info --entry="* time: (time). summarizing used system resources" --info-dir=%{_infodir} %{_infodir}/time.info.gz @@ -427,7 +368,6 @@ fi %doc text-utils/README.col %doc README.largedisk %config %attr(744,root,root) /etc/init.d/raw -%attr(755,root,root) /etc/init.d/nfsboot %config(noreplace) %attr(644,root,root) /etc/raw /usr/sbin/rcraw /bin/arch @@ -451,7 +391,6 @@ fi /sbin/nologin /sbin/pivot_root /sbin/raw -/sbin/sm-notify /sbin/swapoff /sbin/swapon /bin/logger @@ -499,8 +438,6 @@ fi %verify(not mode) %attr(0755,root,tty) /usr/bin/write %dir %{_defaultdocdir}/time %dir %{_defaultdocdir}/which -/var/lib/nfs -%ghost /var/lib/nfs/state %{_defaultdocdir}/time/* %{_defaultdocdir}/which/* %{_infodir}/ipc.info.gz @@ -515,9 +452,12 @@ fi %{_mandir}/man1/colrm.1.gz %{_mandir}/man1/column.1.gz %{_mandir}/man1/ddate.1.gz +%{_mandir}/man1/dmesg.1.gz %{_mandir}/man1/flock.1.gz %{_mandir}/man1/getopt.1.gz %{_mandir}/man1/hexdump.1.gz +%{_mandir}/man1/ipcrm.1.gz +%{_mandir}/man1/ipcs.1.gz %{_mandir}/man1/hostid.1.gz %{_mandir}/man1/line.1.gz %{_mandir}/man1/logger.1.gz @@ -530,6 +470,8 @@ fi %{_mandir}/man1/readprofile.1.gz %{_mandir}/man1/rename.1.gz %{_mandir}/man1/rev.1.gz +%{_mandir}/man1/renice.1.gz +%{_mandir}/man1/setsid.1.gz %{_mandir}/man1/script.1.gz %{_mandir}/man1/setterm.1.gz %{_mandir}/man1/tailf.1.gz @@ -540,7 +482,6 @@ fi %{_mandir}/man1/write.1.gz %{_mandir}/man1/which.1.gz %{_mandir}/man5/fstab.5.gz -%{_mandir}/man5/nfs.5.gz %{_mandir}/man8/addpart.8.gz %{_mandir}/man8/agetty.8.gz %{_mandir}/man8/blockdev.8.gz @@ -551,9 +492,6 @@ fi %{_mandir}/man8/mkfs.bfs.8.gz %{_mandir}/man8/mkfs.minix.8.gz %{_mandir}/man8/fsck.minix.8.gz -%{_mandir}/man8/dmesg.8.gz -%{_mandir}/man8/ipcrm.8.gz -%{_mandir}/man8/ipcs.8.gz %{_mandir}/man8/isosize.8.gz %{_mandir}/man8/losetup.8.gz %{_mandir}/man8/mkfs.8.gz @@ -566,9 +504,6 @@ fi %{_mandir}/man8/partx.8.gz %{_mandir}/man8/pivot_root.8.gz %{_mandir}/man8/raw.8.gz -%{_mandir}/man8/renice.8.gz -%{_mandir}/man8/setsid.8.gz -%{_mandir}/man8/sm-notify.8.gz %{_mandir}/man8/swapoff.8.gz %{_mandir}/man8/swapon.8.gz %{_mandir}/man8/umount.8.gz @@ -619,6 +554,23 @@ fi %endif %changelog +* Tue Jun 05 2007 - mkoenig@suse.de +- update to git20070509 + mount: NFS code removed (use mount.nfs{,4} from nfs-utils) +- remove sm-notify (nfs-utils) +- removed patches + util-linux-2.11u-mount_nfs_mount_acl.patch + util-linux-2.12-mount_base_nfsv4.patch + util-linux-2.12-mount_mountfallback.patch + util-linux-2.12-mount_nfs_tcp.patch + util-linux-2.12q-mount_strict_aliasing.patch + util-linux-2.12r-mount_nfs_remount_options.patch + util-linux-2.12r-mount_rpcsec_gss.patch + util-linux-2.12r-mount_sec_manpage.patch + util-linux-2.12r-mount_umount_nosysfs.patch + util-linux-2.13-mount_nfs_timeo.patch + util-linux-mount_nfs.8.patch + util-linux-mount_warn_nfsudp.patch * Tue Jun 05 2007 - pth@suse.de - Update to which-2.16, mainly because regenerating configure with newer autotools works.