Hello community,
here is the log from the commit of package util-linux
checked in at Thu Apr 12 18:31:41 CEST 2007.
--------
--- util-linux/util-linux.changes 2007-04-04 12:56:15.000000000 +0200
+++ /mounts/work_src_done/STABLE/util-linux/util-linux.changes 2007-04-11 11:16:44.000000000 +0200
@@ -1,0 +2,43 @@
+Tue Apr 10 17:25:34 CEST 2007 - mkoenig@suse.de
+
+- update to version git20070330 of new forked development tree
+- removed Suse crypto patches for losetup [FATE#302001]
+- removed binaries:
+ /bin/guessfstype
+ /sbin/sln
+ /usr/bin/setfdprm
+- removed obsolete patches:
+ * guessfstype2.patch
+ * loop-AES-v3.0a-util-linux-2.12p.diff
+ * mount-nfs-nonreserved
+ * stupid-programmer.diff
+ * util-linux-nodiratime.diff
+ * util-linux-2.12-multipleraw.diff
+ * util-linux-2.12-enablereplaybuild.diff
+ * util-linux-2.12-mount_guessfstype.diff
+ * util-linux-2.12h-mtablock.diff
+ * util-linux-2.12i-x86_64intel.diff
+ * util-linux-2.12q-null.diff
+ * util-linux-2.12r.diff
+ * util-linux-2.12r-fdisk_llseek.patch
+ * util-linux-2.12r-mount-doubleslashessourceprefix-cifs.diff
+ * util-linux-2.12r-mount_external_prog_on_guess.patch
+ * util-linux-2.12r-nonfsmountfallback.diff
+ * util-linux-2.12r-pagesize.patch
+ * util-linux-2.12r-partx_enable.patch
+ * util-linux-2.12r-partx_gpt_warning.patch
+- add patches:
+ * util-linux-2.13-misc_utils_add_man_scriptreplay.patch
+ install man page for scriptreplay
+ * util-linux-2.13-tests_missing_include.patch
+ fix missing header in tests/mnt_test_sysinfo.c
+ * util-linux-2.13-sys_utils_arch.patch
+ keep /bin/arch
+ * util-linux-2.13-build_gnu_source.patch
+ build with _GNU_SOURCE
+ * util-linux-2.13-build_fix_intel_check.patch
+ detect also x86_64 as INTEL architecture
+- rename patches to identify them clearly by subsystem
+- schedutils now part of util-linux itself
+
+-------------------------------------------------------------------
Old:
----
guessfstype2.patch
guessfstype.8
loop-AES-v3.0a-util-linux-2.12p.diff
mount.8-acl.diff
mount-nfs-nonreserved
README.loop-AES-v2.2d
README.loop-AES-v2.2d.SuSE
schedutils-1.4.0.tar.bz2
stupid-programmer.diff
util-linux-2.11q-fs_mac.diff
util-linux-2.11u-nfs-mount_acl.diff
util-linux-2.11z-hwclock_geteuid.diff
util-linux-2.12a-mountbylabel-dm.patch
util-linux-2.12a-mountpointwithcolon.diff
util-linux-2.12a-procswapscheck.diff
util-linux-2.12-enablereplaybuild.diff
util-linux-2.12h-mtablock.diff
util-linux-2.12-hostid.diff
util-linux-2.12h-short-passwords.diff
util-linux-2.12i-x86_64intel.diff
util-linux-2.12-mountfallback.patch
util-linux-2.12-mount_guessfstype.diff
util-linux-2.12-multipleraw.diff
util-linux-2.12-nfs-tcp.diff
util-linux-2.12q-ionice.diff
util-linux-2.12q-mount--move.diff
util-linux-2.12q-nfsv4.patch
util-linux-2.12q-null.diff
util-linux-2.12q-strict-aliasing.diff
util-linux-2.12q-umount2-not-static.patch
util-linux-2.12r-cal_formatting.patch
util-linux-2.12r.diff
util-linux-2.12r-external-prog-on-guess.diff
util-linux-2.12r-fdiskcyl.patch
util-linux-2.12r-fdisk_llseek.patch
util-linux-2.12r-fdiskwrap.patch
util-linux-2.12r-losetup_password.patch
util-linux-2.12r-mkfs_open_exclusive.patch
util-linux-2.12r-mkswap_fix.patch
util-linux-2.12r-mount.8-xfs-update.patch
util-linux-2.12r-mount-by-uuid.patch
util-linux-2.12r-mount-doubleslashessourceprefix-cifs.diff
util-linux-2.12r-mount-mtab-update.patch
util-linux-2.12r-nfs_remount_options.patch
util-linux-2.12r-nonfsmountfallback.diff
util-linux-2.12r-pagesize.patch
util-linux-2.12r-partx_gpt_warning.patch
util-linux-2.12r-partx.patch
util-linux-2.12r-rawfixes.patch
util-linux-2.12r-readprofile-mapfile.patch
util-linux-2.12r-rpcsec-gss.patch
util-linux-2.12r-sec-manpage.patch
util-linux-2.12r.tar.bz2
util-linux-2.12r-umount_nosysfs.patch
util-linux-2.12-suse-compatibility.diff
util-linux-libvolume_id-support.patch
util-linux-nfs.8.diff
util-linux-nfs-timeo.diff
util-linux-nodiratime.diff
util-linux-opt-hotplug.diff
util-linux-wall.dif
util-linux-warn-nfsudp.diff
New:
----
etc_filesystems
util-linux-2.11q-fdisk_fs_mac.patch
util-linux-2.11u-mount_nfs_mount_acl.patch
util-linux-2.11z-hwclock_geteuid.patch
util-linux-2.12a-mount_mountbylabel-dm.patch
util-linux-2.12a-mount_mountpointwithcolon.patch
util-linux-2.12a-mount_procswapcheck.patch
util-linux-2.12-misc_utils_hostid.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_--move.patch
util-linux-2.12q-mount_strict_aliasing.patch
util-linux-2.12q-mount_umount2_not_static.patch
util-linux-2.12q-sys_utils_ionice.patch
util-linux-2.12r-disk_utils_mkfs_open_exclusive.patch
util-linux-2.12r-disk_utils_mkswap_fix.patch
util-linux-2.12r-fdisk_cyl.patch
util-linux-2.12r-fdisk_fdiskwrap.patch
util-linux-2.12r-misc_utils_cal_formatting.patch
util-linux-2.12r-mount_by_uuid.patch
util-linux-2.12r-mount_mount.8_xfs_update.patch
util-linux-2.12r-mount_mtab_update.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.12r-sys_utils_readprofile_mapfile.patch
util-linux-2.13-build_fix_intel_check.patch
util-linux-2.13-build_gnu_source.patch
util-linux-2.13-misc_utils_add_man_scriptreplay.patch
util-linux-2.13-mount_nfs_timeo.patch
util-linux-2.13-sys_utils_arch.patch
util-linux-2.13-tests_missing_include.patch
util-linux-login_utils_wall.patch
util-linux-mount_libvolume_id_support.patch
util-linux-mount_mount.8-acl.patch
util-linux-mount_nfs.8.patch
util-linux-mount_opt_hotplug.patch
util-linux-mount_warn_nfsudp.patch
util-linux-ng-2.12r+git20070330.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ util-linux.spec ++++++
++++ 630 lines (skipped)
++++ between util-linux/util-linux.spec
++++ and /mounts/work_src_done/STABLE/util-linux/util-linux.spec
++++++ util-linux-2.11q-fdisk_fs_mac.patch ++++++
Index: util-linux-ng-2.12r+git20070330/fdisk/fdiskmaclabel.c
===================================================================
--- /dev/null
+++ util-linux-ng-2.12r+git20070330/fdisk/fdiskmaclabel.c
@@ -0,0 +1,87 @@
+/*
+ Changes:
+ Sat Mar 20 09:51:38 EST 1999 Arnaldo Carvalho de Melo
+ Internationalization
+*/
+#include /* stderr */
+#include /* strstr */
+#include /* write */
+
+#include
+
+#include "common.h"
+#include "fdisk.h"
+#include "fdiskmaclabel.h"
+#include "nls.h"
+
+#define MAC_BITMASK 0xffff0000
+
+
+static int other_endian = 0;
+static short volumes=1;
+
+/*
+ * only dealing with free blocks here
+ */
+
+static void
+mac_info( void ) {
+ puts(
+ _("\n\tThere is a valid Mac label on this disk.\n"
+ "\tUnfortunately fdisk(1) cannot handle these disks.\n"
+ "\tUse either pdisk or parted to modify the partition table.\n"
+ "\tNevertheless some advice:\n"
+ "\t1. fdisk will destroy its contents on write.\n"
+ "\t2. Be sure that this disk is NOT a still vital\n"
+ "\t part of a volume group. (Otherwise you may\n"
+ "\t erase the other disks as well, if unmirrored.)\n")
+
+ );
+}
+
+void
+mac_nolabel( void )
+{
+ maclabel->magic = 0;
+ mac_label = 0;
+ partitions = 4;
+ memset( MBRbuffer, 0, sizeof(MBRbuffer) ); /* avoid fdisk cores */
+ return;
+}
+
+int
+check_mac_label( void )
+{
+ /*
+ Conversion: only 16 bit should compared
+ e.g.: HFS Label is only 16bit long
+ */
+
+ int magic_masked = 0 ;
+ magic_masked = maclabel->magic & MAC_BITMASK ;
+
+ switch (magic_masked) {
+ case MAC_LABEL_MAGIC :
+ case MAC_LABEL_MAGIC_2:
+ case MAC_LABEL_MAGIC_3:
+ goto IS_MAC;
+ break;
+ default:
+ mac_label = 0;
+ other_endian = 0;
+ return 0;
+
+
+ }
+
+ IS_MAC:
+ other_endian = (maclabel->magic == MAC_LABEL_MAGIC_SWAPPED); // =?
+ update_units();
+ mac_label = 1;
+ partitions= 1016; // =?
+ volumes = 15; // =?
+ mac_info();
+ mac_nolabel(); /* %% */
+ mac_label = 1; /* %% */
+ return 1;
+}
Index: util-linux-ng-2.12r+git20070330/fdisk/fdiskmaclabel.h
===================================================================
--- /dev/null
+++ util-linux-ng-2.12r+git20070330/fdisk/fdiskmaclabel.h
@@ -0,0 +1,40 @@
+#include /* for __u32 etc */
+/*
+ * Copyright (C) Andreas Neuper, Sep 1998.
+ * This file may be redistributed under
+ * the terms of the GNU Public License.
+ */
+
+typedef struct {
+ unsigned int magic; /* expect MAC_LABEL_MAGIC */
+ unsigned int fillbytes1[124];
+ unsigned int physical_volume_id;
+ unsigned int fillbytes2[124];
+} mac_partition;
+
+#define MAC_LABEL_MAGIC 0x45520000 // MAC magic number only 16bits, do i always know that there are 0200 following ? Problem, after magic the uint16_t res1; follows, i donnno know about the 200k
+#define MAC_LABEL_MAGIC_2 0x50530000
+#define MAC_LABEL_MAGIC_3 0x504d0000
+
+
+#define MAC_LABEL_MAGIC_SWAPPED 0x00002554
+
+#define MAC_LABEL_MAGIC_2_SWAPPED 0x00003505
+#define MAC_LABEL_MAGIC_3_SWAPPED 0x0000d405
+
+
+/* fdisk.c */
+#define maclabel ((mac_partition *)MBRbuffer)
+extern char MBRbuffer[MAX_SECTOR_SIZE];
+extern char changed[MAXIMUM_PARTS];
+extern unsigned int heads, sectors, cylinders;
+extern int show_begin;
+extern int mac_label;
+extern char *partition_type(unsigned char type);
+extern void update_units(void);
+extern char read_chars(char *mesg);
+
+/* fdiskmaclabel.c */
+extern struct systypes mac_sys_types[];
+extern void mac_nolabel( void );
+extern int check_mac_label( void );
Index: util-linux-ng-2.12r+git20070330/fdisk/fdisk.c
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/fdisk/fdisk.c
+++ util-linux-ng-2.12r+git20070330/fdisk/fdisk.c
@@ -26,6 +26,7 @@
#include "fdisksunlabel.h"
#include "fdisksgilabel.h"
#include "fdiskaixlabel.h"
+#include "fdiskmaclabel.h"
#ifdef HAVE_LINUX_COMPILER_H
#include
@@ -167,11 +168,12 @@ unsigned int heads,
unsigned long long total_number_of_sectors;
-#define dos_label (!sun_label && !sgi_label && !aix_label && !osf_label)
+#define dos_label (!sun_label && !sgi_label && !aix_label && !mac_label && !osf_label)
int sun_label = 0; /* looking at sun disklabel */
int sgi_label = 0; /* looking at sgi disklabel */
int aix_label = 0; /* looking at aix disklabel */
int osf_label = 0; /* looking at OSF/1 disklabel */
+int mac_label = 0; /* looking at mac disklabel */
int possibly_osf_label = 0;
jmp_buf listingbuf;
@@ -365,6 +367,10 @@ menu(void) {
puts(_(" v verify the partition table"));
puts(_(" w write table to disk and exit"));
}
+ else if (mac_label) {
+ puts(_("no Commands available"));
+
+ }
else if (aix_label) {
puts(_("Command action"));
puts(_(" m print this menu"));
@@ -445,6 +451,9 @@ xmenu(void) {
puts(_(" v verify the partition table"));
puts(_(" w write table to disk and exit"));
}
+ else if (mac_label) {
+ puts(_("no Commands available"));
+ }
else {
puts(_("Command action"));
puts(_(" b move beginning of data in a partition")); /* !sun */
@@ -945,6 +954,9 @@ get_boot(enum action what) {
if (check_aix_label())
return 0;
+ if (check_mac_label())
+ return 0;
+
if (check_osf_label()) {
possibly_osf_label = 1;
if (!valid_part_table_flag(MBRbuffer)) {
@@ -2077,6 +2089,15 @@ new_partition(void) {
return;
}
+ if (mac_label) {
+ printf(_("\tSorry - this fdisk cannot handle Mac disk labels."
+ "\n\tIf you want to add DOS-type partitions, create"
+ "\n\ta new empty DOS partition table first. (Use o.)"
+ "\n\tWARNING: "
+ "This will destroy the present disk contents.\n"));
+ return;
+ }
+
for (i = 0; i < 4; i++)
free_primary += !ptes[i].part_table->sys_ind;
@@ -2406,7 +2427,11 @@ try(char *device, int user_specified) {
if (gb > 0) { /* I/O error */
} else if (gb < 0) { /* no DOS signature */
list_disk_geometry();
- if (!aix_label && btrydev(device) < 0)
+ if (aix_label)
+ return;
+ if (mac_label)
+ return;
+ if (btrydev(device) < 0)
fprintf(stderr,
_("Disk %s doesn't contain a valid "
"partition table\n"), device);
Index: util-linux-ng-2.12r+git20070330/fdisk/Makefile.am
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/fdisk/Makefile.am
+++ util-linux-ng-2.12r+git20070330/fdisk/Makefile.am
@@ -8,6 +8,7 @@ sbin_PROGRAMS = fdisk
man_MANS = fdisk.8
fdisk_SOURCES = fdisk.c disksize.c fdiskbsdlabel.c fdisksgilabel.c \
fdisksunlabel.c fdiskaixlabel.c i386_sys_types.c partname.c \
+ fdiskmaclabel.c \
common.h fdisk.h fdisksunlabel.h fdisksgilabel.h fdiskaixlabel.h \
fdiskbsdlabel.h
++++++ util-linux-2.11u-mount_nfs_mount_acl.patch ++++++
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);
++++++ util-linux-2.11z-hwclock_geteuid.patch ++++++
Index: hwclock/hwclock.c
===================================================================
--- hwclock/hwclock.c.orig
+++ hwclock/hwclock.c
@@ -1480,7 +1480,7 @@ main(int argc, char **argv) {
show = 1; /* default to show */
- if (getuid() == 0)
+ if (geteuid() == 0)
permitted = TRUE;
else {
/* program is designed to run setuid (in some situations) */
++++++ util-linux-2.12a-mount_mountbylabel-dm.patch ++++++
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
++++++ util-linux-2.12a-mount_mountpointwithcolon.patch ++++++
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
@@ -1207,11 +1207,15 @@ mount_one (const char *spec, const char
if (types == NULL && !mounttype && !is_existing_file(spec)) {
if (strchr (spec, ':') != NULL) {
- types = "nfs";
- if (verbose)
- printf(_("mount: no type was given - "
+ types = do_guess_fstype(spec);
+ if(types == NULL) {
+ types = "nfs";
+ if (verbose) {
+ printf(_("mount: no type was given - "
"I'll assume nfs because of "
"the colon\n"));
+ }
+ }
} else if(!strncmp(spec, "//", 2)) {
types = "cifs";
if (verbose)
++++++ util-linux-2.12a-mount_procswapcheck.patch ++++++
Index: util-linux-ng-2.12r+git20070330/mount/swapon.c
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/mount/swapon.c
+++ util-linux-ng-2.12r+git20070330/mount/swapon.c
@@ -138,6 +138,7 @@ static int
is_in_proc_swaps(const char *fname) {
int i;
char canonical[PATH_MAX + 2];
+ struct stat stfname, stswapFile;
if (!myrealpath(fname, canonical, PATH_MAX + 1)) {
fprintf(stderr, _("%s: cannot canonicalize %s: %s\n"),
@@ -146,9 +147,15 @@ is_in_proc_swaps(const char *fname) {
*(canonical + (PATH_MAX + 1)) = '\0';
}
- for (i = 0; i < numSwaps; i++)
- if (swapFiles[i] && !strcmp(canonical, swapFiles[i]))
- return 1;
+ for (i = 0; i < numSwaps; i++) {
+ if(S_ISBLK(stfname.st_mode)) {
+ stat(swapFiles[i], &stswapFile);
+ if(S_ISBLK(stswapFile.st_mode))
+ if(stfname.st_rdev == stswapFile.st_rdev)
+ return 1;
+ } else if (swapFiles[i] && !strcmp(canonical, swapFiles[i]))
+ return 1;
+ }
return 0;
}
++++++ util-linux-2.12-misc_utils_hostid.patch ++++++
Index: util-linux-ng-2.12r+git20070330/misc-utils/hostid.1
===================================================================
--- /dev/null
+++ util-linux-ng-2.12r+git20070330/misc-utils/hostid.1
@@ -0,0 +1,24 @@
+.TH hostid 1
+.SH NAME
+hostid \- set or print system's host id.
+.SH SYNTAX
+.B hostid
+[\-v] [\|\fIdecimal-id\fR\|]
+.SH DESCRIPTION
+.\".NXR "hostid command"
+The
+.B hostid
+command prints the current host id number in hexadecimal and both
+decimal and hexadecimal in parenthesis if the \-v option is given.
+This numeric value is expected to be unique across all hosts
+and is normally set to resemble the host's Internet address.
+
+Only the super-user can set the hostid by giving an argument. This value is
+stored in the file /etc/hostid and need only be performed once.
+
+.SH AUTHOR
+Hostid is written by Mitch DSouza \- (m.dsouza@mrc-apu.cam.ac.uk)
+
+.SH SEE ALSO
+gethostid(2), sethostid(2)
+
Index: util-linux-ng-2.12r+git20070330/misc-utils/hostid.c
===================================================================
--- /dev/null
+++ util-linux-ng-2.12r+git20070330/misc-utils/hostid.c
@@ -0,0 +1,88 @@
+/* Program hostid. Changed on 7.10.1997
+ New: - Hostid 0 is not permitted.
+ - Set hostid dezimal or hexadezimal, both possible.
+ - Maximum Value for id is tested
+ - Wrong Parameters are caught
+ Nov 13 2003 - cleanup, mmj@suse.de
+ */
+
+#include
+#include
+#include
+#include
+#include
+
+void usage(void);
+
+void usage()
+{
+ printf ("usage : hostid [-h] [-v] [<id>]\n\n"
+ "no options: print hostid as hexadecimal number\n"
+ "-h print this helptext\n"
+ "-v print hostid decimal and hexadecimal\n"
+ "<id> set the hostid to <id>\n\n"
+ "The id String can be specified as\n"
+ " - decimal number\n"
+ " - hexadecimal number preceded by 0x\n"
+ " - octal number preceded by 0 \n\n"
+ "Remarks:\n"
+ " - only root can set the hostid\n"
+ " - it's not possible to set the hostid to 0\n\n");
+}
+
+int main (int argc, char *argv[])
+{
+ long id;
+ int verbose = 0;
+
+ if (argc > 2) {
+ printf ("wrong arguments\n");
+ usage();
+ exit(1);
+ }
+
+ if (argc == 2 && strcmp(argv[1], "-h") == 0) {
+ usage();
+ exit(0);
+ }
+
+ if (argc == 2 && strcmp(argv[1], "-v") == 0) {
+ verbose = 1;
+ argc--;
+ argv++;
+ }
+
+ switch (argc) {
+ case 2:
+ id = strtol(argv[1], NULL, 0);
+ if (errno == ERANGE) {
+ printf ("Overflow: given string was out of range\n");
+ exit(1);
+ }
+
+ if (id == 0) {
+ printf ("value not possible: Abort\n");
+ usage();
+ exit(1);
+ }
+ if (sethostid(id) != 0) {
+ perror("sethostid");
+ exit(1);
+ }
+ break;
+
+ case 1:
+ id = gethostid();
+ if(id && verbose) {
+ printf("Hostid is %ld (0x%lx)\n", id, id);
+ } else if(id) {
+ printf("0x%lx\n", id);
+ } else {
+ printf ("Error while trying: gethostid\n");
+ exit(1);
+ }
+ break;
+ }
+
+ return 0;
+}
Index: util-linux-ng-2.12r+git20070330/misc-utils/Makefile.am
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/misc-utils/Makefile.am
+++ util-linux-ng-2.12r+git20070330/misc-utils/Makefile.am
@@ -9,7 +9,7 @@ EXTRA_DIST = README.* \
bin_PROGRAMS =
usrbinexec_PROGRAMS = cal ddate logger look mcookie \
- namei script whereis
+ namei script whereis hostid
mcookie_LDADD = $(top_srcdir)/lib/libmd5.a
@@ -24,7 +24,7 @@ scriptreplay: scriptreplay.pl
CLEANFILES = chkdupexe scriptreplay
man_MANS = cal.1 chkdupexe.1 ddate.1 logger.1 look.1 mcookie.1 \
- namei.1 script.1 whereis.1
+ namei.1 script.1 whereis.1 hostid.1
if HAVE_NCURSES
cal_LDADD = -lncurses
++++++ util-linux-2.12-mount_base_nfsv4.patch ++++++
++++ 859 lines (skipped)
++++++ util-linux-2.12-mount_mountfallback.patch ++++++
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);
++++++ util-linux-2.12-mount_nfs_tcp.patch ++++++
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;
}
++++++ util-linux-2.12q-mount_--move.patch ++++++
Index: mount/mount.c
===================================================================
--- mount/mount.c.orig
+++ mount/mount.c
@@ -760,6 +760,25 @@ update_mtab_entry(const char *spec, cons
else {
mntFILE *mfp;
+ /* when moving a mount point, we have to make sure the mtab
+ * gets updated properly. We get info about the old mount
+ * point, copy it to the new mount point, and then delete
+ * the old mount point. */
+ if (flags & MS_MOVE) {
+ const char *olddir = mnt.mnt_fsname;
+ struct mntentchn *oldmc = oldmc = getmntfile(olddir);
+ if (oldmc != NULL) {
+ mnt.mnt_fsname = strdup(oldmc->m.mnt_fsname);
+ mnt.mnt_type = oldmc->m.mnt_type;
+ mnt.mnt_opts = oldmc->m.mnt_opts;
+ mnt.mnt_freq = oldmc->m.mnt_freq;
+ mnt.mnt_passno = oldmc->m.mnt_passno;
+ }
+ update_mtab(olddir, NULL);
+ if (oldmc != NULL)
+ my_free(olddir);
+ }
+
lock_mtab();
mfp = my_setmntent(MOUNTED, "a+");
if (mfp == NULL || mfp->mntent_fp == NULL) {
++++++ util-linux-2.12q-mount_strict_aliasing.patch ++++++
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
++++++ util-linux-2.12q-mount_umount2_not_static.patch ++++++
Index: mount/umount.c
===================================================================
--- mount/umount.c.orig
+++ mount/umount.c
@@ -38,7 +38,7 @@
#include
#ifdef __NR_umount2
-static int umount2(const char *path, int flags);
+int umount2(const char *path, int flags);
_syscall2(int, umount2, const char *, path, int, flags);
++++++ util-linux-2.12q-sys_utils_ionice.patch ++++++
Index: util-linux-ng-2.12r+2.13pre7/sys-utils/ionice.1
===================================================================
--- /dev/null
+++ util-linux-ng-2.12r+2.13pre7/sys-utils/ionice.1
@@ -0,0 +1,71 @@
+.TH ionice "1" "August 2005" ionice
+.SH NAME
+ionice \- get/set program io scheduling class and priority
+.SH SYNOPSIS
+.B ionice
+[\fI-c\fR] \fI[-n\fR] [\fI-p\fR] [COMMAND [ARG...]]
+
+.SH DESCRIPTION
+This program sets the io scheduling class and priority for a program. As of
+this writing, Linux supports 3 scheduling classes:
+
+\fBIdle\fR.
+A program running with idle io priority will only get disk time when no other
+program has asked for disk io for a defined grace period. The impact of idle
+io processes on normal system activity should be zero. This scheduling
+class does not take a priority argument.
+
+\fBBest effort\fR.
+This is the default scheduling class for any process that hasn't asked for
+a specific io priority. Programs inherit the CPU nice setting for io
+priorities. This class takes a priority argument from \fI0-7\fR, with lower
+number being higher priority. Programs running at the same best effort
+priority are served in a round-robin fashion.
+
+\fBReal time\fR.
+The RT scheduling class is given first access to the disk, regardless of
+what else is going on in the system. Thus the RT class needs to be used with
+some care, as it can starve other processes. As with the best effort class,
+8 priority levels are defined denoting how big a time slice a given process
+will receive on each scheduling window.
+
+If no arguments or just \fI-p\fR is given, \fIionice\fR will query the
+current io scheduling class and priority for that process.
+
+.SH OPTIONS
+.LP
+.TP 7
+\fB-c\fP
+The scheduling class. 1 for real time, 2 for best-effort, 3 for idle.
+.TP 7
+\fB-n\fP
+The scheduling class data. This defines the class data, if the class
+accepts an argument. For real time and best-effort, \fI0-7\fR is valid
+data.
+.TP 7
+\fB-p\fP
+Pass in a process pid to change an already running process. If this argument
+is not given, \fBionice\fP will run the listed program with the given
+parameters.
+
+.SH EXAMPLES
+.LP
+.TP 7
+# \fBionice\fP -c3 -p89
+.TP 7
+Sets process with PID 89 as an idle io process.
+.TP 7
+# \fBionice\fP -c2 -n0 bash
+.TP 7
+Runs 'bash' as a best-effort program with highest priority.
+.TP 7
+# \fBionice\fP -p89
+.TP 7
+Returns the class and priority of the process with PID 89.
+
+.SH NOTES
+Linux supports io scheduling priorities and classes since 2.6.13 with the CFQ
+io scheduler.
+
+.SH AUTHORS
+Jens Axboe
Index: util-linux-ng-2.12r+2.13pre7/sys-utils/ionice.c
===================================================================
--- /dev/null
+++ util-linux-ng-2.12r+2.13pre7/sys-utils/ionice.c
@@ -0,0 +1,144 @@
+/*
+ * ionice: set or get process io scheduling class and priority
+ *
+ * Copyright (C) 2005 Jens Axboe SUSE Labs
+ *
+ * Released under the terms of the GNU General Public License version 2
+ *
+ */
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#if defined(__i386__)
+#define __NR_ioprio_set 289
+#define __NR_ioprio_get 290
+#elif defined(__powerpc__) || defined(__powerpc64__)
+#define __NR_ioprio_set 273
+#define __NR_ioprio_get 274
+#elif defined(__x86_64__)
+#define __NR_ioprio_set 251
+#define __NR_ioprio_get 252
+#elif defined(__ia64__)
+#define __NR_ioprio_set 1274
+#define __NR_ioprio_get 1275
+#elif defined(__alpha__)
+#define __NR_ioprio_set 442
+#define __NR_ioprio_get 443
+#elif defined(__s390__) || defined(__s390x__)
+#define __NR_ioprio_set 282
+#define __NR_ioprio_get 283
+#elif defined(__arm__)
+#define __NR_ioprio_set 314
+#define __NR_ioprio_get 315
+#else
+#error "Unsupported arch"
+#endif
+
+static int ioprio_set(int which, int who, int ioprio)
+{
+ return syscall(__NR_ioprio_set, which, who, ioprio);
+}
+
+static int ioprio_get(int which, int who)
+{
+ return syscall(__NR_ioprio_get, which, who);
+}
+
+enum {
+ IOPRIO_CLASS_NONE,
+ IOPRIO_CLASS_RT,
+ IOPRIO_CLASS_BE,
+ IOPRIO_CLASS_IDLE,
+};
+
+enum {
+ IOPRIO_WHO_PROCESS = 1,
+ IOPRIO_WHO_PGRP,
+ IOPRIO_WHO_USER,
+};
+
+#define IOPRIO_CLASS_SHIFT 13
+
+const char *to_prio[] = { "none", "realtime", "best-effort", "idle", };
+
+static void usage(void)
+{
+ printf("Usage: ionice [OPTIONS] [COMMAND [ARG]...]\n");
+ printf("Sets or gets process io scheduling class and priority.\n");
+ printf("\n\t-n\tClass data (typically 0-7, lower being higher prio)\n");
+ printf("\t-c\tScheduling class\n");
+ printf("\t\t\t1: realtime, 2: best-effort, 3: idle\n");
+ printf("\t-p\tProcess pid\n");
+ printf("\t-h\tThis help page\n");
+ printf("\nJens Axboe (C) 2005\n");
+}
+
+int main(int argc, char *argv[])
+{
+ int ioprio = 4, set = 0, ioprio_class = IOPRIO_CLASS_BE;
+ int c, pid = 0;
+
+ while ((c = getopt(argc, argv, "+n:c:p:h")) != EOF) {
+ switch (c) {
+ case 'n':
+ ioprio = strtol(optarg, NULL, 10);
+ set = 1;
+ break;
+ case 'c':
+ ioprio_class = strtol(optarg, NULL, 10);
+ set = 1;
+ break;
+ case 'p':
+ pid = strtol(optarg, NULL, 10);
+ break;
+ case 'h':
+ default:
+ usage();
+ exit(0);
+ }
+ }
+
+ switch (ioprio_class) {
+ case IOPRIO_CLASS_NONE:
+ ioprio_class = IOPRIO_CLASS_BE;
+ break;
+ case IOPRIO_CLASS_RT:
+ case IOPRIO_CLASS_BE:
+ break;
+ case IOPRIO_CLASS_IDLE:
+ ioprio = 7;
+ break;
+ default:
+ printf("bad prio class %d\n", ioprio_class);
+ return 1;
+ }
+
+ if (!set) {
+ if (!pid && argv[optind])
+ pid = strtol(argv[optind], NULL, 10);
+
+ ioprio = ioprio_get(IOPRIO_WHO_PROCESS, pid);
+
+ if (ioprio == -1)
+ perror("ioprio_get");
+ else {
+ ioprio_class = ioprio >> IOPRIO_CLASS_SHIFT;
+ ioprio = ioprio & 0xff;
+ printf("%s: prio %d\n", to_prio[ioprio_class], ioprio);
+ }
+ } else {
+ if (ioprio_set(IOPRIO_WHO_PROCESS, pid, ioprio | ioprio_class << IOPRIO_CLASS_SHIFT) == -1)
+ perror("ioprio_set");
+
+ if (argv[optind])
+ execvp(argv[optind], &argv[optind]);
+ }
+
+ return 0;
+}
Index: util-linux-ng-2.12r+2.13pre7/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 @@
bin_PROGRAMS = dmesg
-usrbinexec_PROGRAMS = cytune flock ipcrm ipcs renice setsid
+usrbinexec_PROGRAMS = cytune flock ionice ipcrm ipcs renice setsid
cytune_SOURCES = cytune.c cyclades.h
sbin_PROGRAMS = ctrlaltdel
usrsbinexec_PROGRAMS = readprofile tunelp
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
++++++ util-linux-2.12r-disk_utils_mkfs_open_exclusive.patch ++++++
Index: util-linux-ng-2.12r+git20070330/disk-utils/mkswap.c
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/disk-utils/mkswap.c
+++ util-linux-ng-2.12r+git20070330/disk-utils/mkswap.c
@@ -660,7 +660,7 @@ main(int argc, char ** argv) {
usage();
}
- DEV = open(device_name,O_RDWR);
+ DEV = open(device_name, O_RDWR | O_EXCL);
if (DEV < 0 || fstat(DEV, &statbuf) < 0) {
perror(device_name);
exit(1);
Index: util-linux-ng-2.12r+git20070330/disk-utils/mkfs.minix.c
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/disk-utils/mkfs.minix.c
+++ util-linux-ng-2.12r+git20070330/disk-utils/mkfs.minix.c
@@ -699,7 +699,7 @@ main(int argc, char ** argv) {
tmp += dirsize;
*(short *)tmp = 2;
strcpy(tmp+2,".badblocks");
- DEV = open(device_name,O_RDWR );
+ DEV = open(device_name,O_RDWR | O_EXCL);
if (DEV<0)
die(_("unable to open %s"));
if (fstat(DEV,&statbuf)<0)
Index: util-linux-ng-2.12r+git20070330/disk-utils/mkfs.bfs.c
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/disk-utils/mkfs.bfs.c
+++ util-linux-ng-2.12r+git20070330/disk-utils/mkfs.bfs.c
@@ -170,7 +170,7 @@ main(int argc, char *argv[]) {
if (!S_ISBLK(statbuf.st_mode))
fatal(_("%s is not a block special device"), device);
- fd = open(device, O_RDWR);
+ fd = open(device, O_RDWR | O_EXCL);
if (fd == -1) {
perror(device);
fatal(_("cannot open %s"), device);
++++++ util-linux-2.12r-disk_utils_mkswap_fix.patch ++++++
default swap to V1 in any case [#205956]
Index: util-linux-ng-2.12r+git20070330/disk-utils/mkswap.c
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/disk-utils/mkswap.c
+++ util-linux-ng-2.12r+git20070330/disk-utils/mkswap.c
@@ -617,9 +617,7 @@ main(int argc, char ** argv) {
version = 1;
else
/* use version 1 as default, if possible */
- if (PAGES <= V0_MAX_PAGES && PAGES > V1_MAX_PAGES)
- version = 0;
- else if (linux_version_code() < MAKE_VERSION(2,1,117))
+ if (linux_version_code() < MAKE_VERSION(2,1,117))
version = 0;
else if (pagesize < 2048)
version = 0;
++++++ util-linux-2.12r-fdisk_cyl.patch ++++++
Index: util-linux-ng-2.12r+2.13pre7/fdisk/fdisk.c
===================================================================
--- util-linux-ng-2.12r+2.13pre7.orig/fdisk/fdisk.c
+++ util-linux-ng-2.12r+2.13pre7/fdisk/fdisk.c
@@ -1918,6 +1918,16 @@ verify(void) {
total_number_of_sectors - total);
}
+static unsigned long long
+roundup_to_cylinder_boundary(unsigned long long offset) {
+ if (units_per_sector) {
+ unsigned long long extra_sectors = offset % units_per_sector;
+ if (extra_sectors != 0)
+ offset += (units_per_sector - extra_sectors) - 1;
+ }
+ return offset;
+}
+
static void
add_partition(int n, int sys) {
char mesg[256]; /* 48 does not suffice in Japanese */
@@ -1953,8 +1963,10 @@ add_partition(int n, int sys) {
limit = get_start_sect(q) + get_nr_sects(q) - 1;
}
if (display_in_cyl_units)
- for (i = 0; i < partitions; i++)
+ for (i = 0; i < partitions; i++) {
first[i] = (cround(first[i]) - 1) * units_per_sector;
+ last[i] = roundup_to_cylinder_boundary(last[i]);
+ }
snprintf(mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR));
do {
++++++ util-linux-2.12r-fdisk_fdiskwrap.patch ++++++
Index: util-linux-ng-2.12r+2.13pre7/fdisk/fdisk.c
===================================================================
--- util-linux-ng-2.12r+2.13pre7.orig/fdisk/fdisk.c
+++ util-linux-ng-2.12r+2.13pre7/fdisk/fdisk.c
@@ -63,7 +63,7 @@ static void delete_partition(int i);
/* A valid partition table sector ends in 0x55 0xaa */
static unsigned int
-part_table_flag(char *b) {
+part_table_flag(unsigned char *b) {
return ((unsigned int) b[510]) + (((unsigned int) b[511]) << 8);
}
@@ -73,7 +73,7 @@ valid_part_table_flag(unsigned char *b)
}
static void
-write_part_table_flag(char *b) {
+write_part_table_flag(unsigned char *b) {
b[510] = 0x55;
b[511] = 0xaa;
}
@@ -100,17 +100,17 @@ set_start_sect(struct partition *p, unsi
store4_little_endian(p->start4, start_sect);
}
-unsigned int
+unsigned long long
get_start_sect(struct partition *p) {
return read4_little_endian(p->start4);
}
static void
-set_nr_sects(struct partition *p, unsigned int nr_sects) {
+set_nr_sects(struct partition *p, unsigned long long nr_sects) {
store4_little_endian(p->size4, nr_sects);
}
-unsigned int
+unsigned long long
get_nr_sects(struct partition *p) {
return read4_little_endian(p->size4);
}
@@ -122,7 +122,7 @@ static int type_open = O_RDWR;
* Raw disk label. For DOS-type partition tables the MBR,
* with descriptions of the primary partitions.
*/
-char MBRbuffer[MAX_SECTOR_SIZE];
+unsigned char MBRbuffer[MAX_SECTOR_SIZE];
/*
* per partition table entry data
@@ -136,8 +136,8 @@ struct pte {
struct partition *part_table; /* points into sectorbuffer */
struct partition *ext_pointer; /* points into sectorbuffer */
char changed; /* boolean */
- unsigned int offset; /* disk sector number */
- char *sectorbuffer; /* disk sector contents */
+ unsigned long long offset; /* disk sector number */
+ unsigned char *sectorbuffer; /* disk sector contents */
} ptes[MAXIMUM_PARTS];
char *disk_device, /* must be specified */
@@ -156,15 +156,14 @@ unsigned int user_cylinders, user_heads,
unsigned int pt_heads, pt_sectors;
unsigned int kern_heads, kern_sectors;
+unsigned long long sector_offset = 1, extended_offset = 0, sectors;
+
unsigned int heads,
- sectors,
cylinders,
sector_size = DEFAULT_SECTOR_SIZE,
user_set_sector_size = 0,
- sector_offset = 1,
units_per_sector = 1,
- display_in_cyl_units = 1,
- extended_offset = 0; /* offset of link pointers */
+ display_in_cyl_units = 1;
unsigned long long total_number_of_sectors;
@@ -242,21 +241,21 @@ void fatal(enum failure why) {
}
static void
-seek_sector(int fd, unsigned int secno) {
+seek_sector(int fd, unsigned long long secno) {
off_t offset = (off_t) secno * sector_size;
if (lseek(fd, offset, SEEK_SET) == (off_t) -1)
fatal(unable_to_seek);
}
static void
-read_sector(int fd, unsigned int secno, char *buf) {
+read_sector(int fd, unsigned long long secno, unsigned char *buf) {
seek_sector(fd, secno);
if (read(fd, buf, sector_size) != sector_size)
fatal(unable_to_read);
}
static void
-write_sector(int fd, unsigned int secno, char *buf) {
+write_sector(int fd, unsigned long long secno, unsigned char *buf) {
seek_sector(fd, secno);
if (write(fd, buf, sector_size) != sector_size)
fatal(unable_to_write);
@@ -264,11 +263,11 @@ write_sector(int fd, unsigned int secno,
/* Allocate a buffer and read a partition table sector */
static void
-read_pte(int fd, int pno, unsigned int offset) {
+read_pte(int fd, int pno, unsigned long long offset) {
struct pte *pe = &ptes[pno];
pe->offset = offset;
- pe->sectorbuffer = (char *) malloc(sector_size);
+ pe->sectorbuffer = malloc(sector_size);
if (!pe->sectorbuffer)
fatal(out_of_memory);
read_sector(fd, offset, pe->sectorbuffer);
@@ -276,7 +275,7 @@ read_pte(int fd, int pno, unsigned int o
pe->part_table = pe->ext_pointer = NULL;
}
-static unsigned int
+static unsigned long long
get_partition_start(struct pte *pe) {
return pe->offset + get_start_sect(pe->part_table);
}
@@ -549,10 +548,10 @@ clear_partition(struct partition *p) {
}
static void
-set_partition(int i, int doext, unsigned int start, unsigned int stop,
- int sysid) {
+set_partition(int i, int doext, unsigned long long start,
+ unsigned long long stop, int sysid) {
struct partition *p;
- unsigned int offset;
+ unsigned long long offset;
if (doext) {
p = ptes[i].ext_pointer;
@@ -1548,7 +1547,7 @@ list_disk_geometry(void) {
else
printf(_("\nDisk %s: %ld.%ld GB, %lld bytes\n"),
disk_device, megabytes/1000, (megabytes/100)%10, bytes);
- printf(_("%d heads, %d sectors/track, %d cylinders"),
+ printf(_("%d heads, %Ld sectors/track, %d cylinders"),
heads, sectors, cylinders);
if (units_per_sector == 1)
printf(_(", total %llu sectors"),
@@ -1780,20 +1779,21 @@ x_list_table(int extend) {
struct partition *p;
int i;
- printf(_("\nDisk %s: %d heads, %d sectors, %d cylinders\n\n"),
+ printf(_("\nDisk %s: %d heads, %Ld sectors, %d cylinders\n\n"),
disk_device, heads, sectors, cylinders);
printf(_("Nr AF Hd Sec Cyl Hd Sec Cyl Start Size ID\n"));
for (i = 0 ; i < partitions; i++) {
pe = &ptes[i];
p = (extend ? pe->ext_pointer : pe->part_table);
if (p != NULL) {
- printf("%2d %02x%4d%4d%5d%4d%4d%5d%11u%11u %02x\n",
+ printf("%2d %02x%4d%4d%5d%4d%4d%5d%11lu%11lu %02x\n",
i + 1, p->boot_ind, p->head,
sector(p->sector),
cylinder(p->sector, p->cyl), p->end_head,
sector(p->end_sector),
cylinder(p->end_sector, p->end_cyl),
- get_start_sect(p), get_nr_sects(p), p->sys_ind);
+ (unsigned long) get_start_sect(p),
+ (unsigned long) get_nr_sects(p), p->sys_ind);
if (p->sys_ind)
check_consistency(p, i);
}
@@ -1801,7 +1801,7 @@ x_list_table(int extend) {
}
static void
-fill_bounds(unsigned int *first, unsigned int *last) {
+fill_bounds(unsigned long long *first, unsigned long long *last) {
int i;
struct pte *pe = &ptes[0];
struct partition *p;
@@ -1834,7 +1834,7 @@ check(int n, unsigned int h, unsigned in
n, h + 1, heads);
if (real_s >= sectors)
fprintf(stderr, _("Partition %d: sector %d greater than "
- "maximum %d\n"), n, s, sectors);
+ "maximum %Ld\n"), n, s, sectors);
if (real_c >= cylinders)
fprintf(stderr, _("Partitions %d: cylinder %d greater than "
"maximum %d\n"), n, real_c + 1, cylinders);
@@ -1847,8 +1847,8 @@ check(int n, unsigned int h, unsigned in
static void
verify(void) {
int i, j;
- unsigned int total = 1;
- unsigned int first[partitions], last[partitions];
+ unsigned long total = 1;
+ unsigned long long first[partitions], last[partitions];
struct partition *p;
if (warn_geometry())
@@ -1892,7 +1892,7 @@ verify(void) {
if (extended_offset) {
struct pte *pex = &ptes[ext_index];
- unsigned int e_last = get_start_sect(pex->part_table) +
+ unsigned long long e_last = get_start_sect(pex->part_table) +
get_nr_sects(pex->part_table) - 1;
for (i = 4; i < partitions; i++) {
@@ -1911,8 +1911,8 @@ verify(void) {
}
if (total > total_number_of_sectors)
- printf(_("Total allocated sectors %d greater than the maximum "
- "%lld\n"), total, total_number_of_sectors);
+ printf(_("Total allocated sectors %ld greater than the maximum"
+ " %lld\n"), total, total_number_of_sectors);
else if (total < total_number_of_sectors)
printf(_("%lld unallocated sectors\n"),
total_number_of_sectors - total);
@@ -1925,7 +1925,7 @@ add_partition(int n, int sys) {
struct partition *p = ptes[n].part_table;
struct partition *q = ptes[ext_index].part_table;
long long llimit;
- unsigned int start, stop = 0, limit, temp,
+ unsigned long long start, stop = 0, limit, temp,
first[partitions], last[partitions];
if (p && p->sys_ind) {
@@ -1971,7 +1971,7 @@ add_partition(int n, int sys) {
if (start > limit)
break;
if (start >= temp+units_per_sector && read) {
- printf(_("Sector %d is already allocated\n"), temp);
+ printf(_("Sector %llu is already allocated\n"), temp);
temp = start;
read = 0;
}
@@ -2230,14 +2230,14 @@ reread_partition_table(int leave) {
#define MAX_PER_LINE 16
static void
-print_buffer(char pbuffer[]) {
+print_buffer(unsigned char pbuffer[]) {
int i,
l;
for (i = 0, l = 0; i < sector_size; i++, l++) {
if (l == 0)
printf("0x%03X:", i);
- printf(" %02X", (unsigned char) pbuffer[i]);
+ printf(" %02X", pbuffer[i]);
if (l == MAX_PER_LINE - 1) {
printf("\n");
l = -1;
Index: util-linux-ng-2.12r+2.13pre7/fdisk/fdisk.h
===================================================================
--- util-linux-ng-2.12r+2.13pre7.orig/fdisk/fdisk.h
+++ util-linux-ng-2.12r+2.13pre7/fdisk/fdisk.h
@@ -81,8 +81,8 @@ extern unsigned int read_int(unsigned in
#define SINGULAR 1
extern char *const str_units(int);
-extern unsigned int get_start_sect(struct partition *p);
-extern unsigned int get_nr_sects(struct partition *p);
+extern unsigned long long get_start_sect(struct partition *p);
+extern unsigned long long get_nr_sects(struct partition *p);
extern int osf_label;
Index: util-linux-ng-2.12r+2.13pre7/fdisk/fdiskaixlabel.h
===================================================================
--- util-linux-ng-2.12r+2.13pre7.orig/fdisk/fdiskaixlabel.h
+++ util-linux-ng-2.12r+2.13pre7/fdisk/fdiskaixlabel.h
@@ -19,9 +19,10 @@ typedef struct {
/* fdisk.c */
#define aixlabel ((aix_partition *)MBRbuffer)
-extern char MBRbuffer[MAX_SECTOR_SIZE];
+extern unsigned char MBRbuffer[MAX_SECTOR_SIZE];
extern char changed[MAXIMUM_PARTS];
-extern unsigned int heads, sectors, cylinders;
+extern unsigned int heads, cylinders;
+extern unsigned long long sectors;
extern int show_begin;
extern int aix_label;
extern char *partition_type(unsigned char type);
Index: util-linux-ng-2.12r+2.13pre7/fdisk/fdiskmaclabel.h
===================================================================
--- util-linux-ng-2.12r+2.13pre7.orig/fdisk/fdiskmaclabel.h
+++ util-linux-ng-2.12r+2.13pre7/fdisk/fdiskmaclabel.h
@@ -25,9 +25,10 @@ typedef struct {
/* fdisk.c */
#define maclabel ((mac_partition *)MBRbuffer)
-extern char MBRbuffer[MAX_SECTOR_SIZE];
+extern unsigned char MBRbuffer[MAX_SECTOR_SIZE];
extern char changed[MAXIMUM_PARTS];
-extern unsigned int heads, sectors, cylinders;
+extern unsigned int heads, cylinders;
+extern unsigned long long sectors;
extern int show_begin;
extern int mac_label;
extern char *partition_type(unsigned char type);
Index: util-linux-ng-2.12r+2.13pre7/fdisk/fdisksgilabel.c
===================================================================
--- util-linux-ng-2.12r+2.13pre7.orig/fdisk/fdisksgilabel.c
+++ util-linux-ng-2.12r+2.13pre7/fdisk/fdisksgilabel.c
@@ -197,7 +197,7 @@ sgi_list_table(int xtra) {
w = strlen(disk_device);
if (xtra) {
- printf(_("\nDisk %s (SGI disk label): %d heads, %d sectors\n"
+ printf(_("\nDisk %s (SGI disk label): %d heads, %llu sectors\n"
"%d cylinders, %d physical cylinders\n"
"%d extra sects/cyl, interleave %d:1\n"
"%s\n"
@@ -211,7 +211,7 @@ sgi_list_table(int xtra) {
sector_size);
} else {
printf(_("\nDisk %s (SGI disk label): "
- "%d heads, %d sectors, %d cylinders\n"
+ "%d heads, %llu sectors, %d cylinders\n"
"Units = %s of %d * %d bytes\n\n"),
disk_device, heads, sectors, cylinders,
str_units(PLURAL), units_per_sector,
Index: util-linux-ng-2.12r+2.13pre7/fdisk/fdisksgilabel.h
===================================================================
--- util-linux-ng-2.12r+2.13pre7.orig/fdisk/fdisksgilabel.h
+++ util-linux-ng-2.12r+2.13pre7/fdisk/fdisksgilabel.h
@@ -103,8 +103,9 @@ typedef struct {
/* fdisk.c */
#define sgilabel ((sgi_partition *)MBRbuffer)
#define sgiparam (sgilabel->devparam)
-extern char MBRbuffer[MAX_SECTOR_SIZE];
-extern unsigned int heads, sectors, cylinders, sector_size;
+extern unsigned char MBRbuffer[MAX_SECTOR_SIZE];
+extern unsigned int heads, cylinders, sector_size;
+extern unsigned long long sectors;
extern int show_begin;
extern int sgi_label;
extern char *partition_type(unsigned char type);
Index: util-linux-ng-2.12r+2.13pre7/fdisk/fdisksunlabel.c
===================================================================
--- util-linux-ng-2.12r+2.13pre7.orig/fdisk/fdisksunlabel.c
+++ util-linux-ng-2.12r+2.13pre7/fdisk/fdisksunlabel.c
@@ -348,7 +348,7 @@ void create_sunlabel(void)
}
snprintf(sunlabel->info, sizeof(sunlabel->info),
- "%s%s%s cyl %d alt %d hd %d sec %d",
+ "%s%s%s cyl %d alt %d hd %d sec %llu",
p ? p->vendor : "", (p && *p->vendor) ? " " : "",
p ? p->model
: (floppy ? _("3,5\" floppy") : _("Linux custom")),
@@ -655,7 +655,7 @@ sun_list_table(int xtra) {
w = strlen(disk_device);
if (xtra)
printf(
- _("\nDisk %s (Sun disk label): %d heads, %d sectors, %d rpm\n"
+ _("\nDisk %s (Sun disk label): %d heads, %llu sectors, %d rpm\n"
"%d cylinders, %d alternate cylinders, %d physical cylinders\n"
"%d extra sects/cyl, interleave %d:1\n"
"%s\n"
@@ -669,7 +669,7 @@ sun_list_table(int xtra) {
str_units(PLURAL), units_per_sector);
else
printf(
- _("\nDisk %s (Sun disk label): %d heads, %d sectors, %d cylinders\n"
+ _("\nDisk %s (Sun disk label): %d heads, %llu sectors, %d cylinders\n"
"Units = %s of %d * 512 bytes\n\n"),
disk_device, heads, sectors, cylinders,
str_units(PLURAL), units_per_sector);
Index: util-linux-ng-2.12r+2.13pre7/fdisk/fdisksunlabel.h
===================================================================
--- util-linux-ng-2.12r+2.13pre7.orig/fdisk/fdisksunlabel.h
+++ util-linux-ng-2.12r+2.13pre7/fdisk/fdisksunlabel.h
@@ -37,8 +37,9 @@ typedef struct {
: (__u32)(x))
/* fdisk.c */
-extern char MBRbuffer[MAX_SECTOR_SIZE];
-extern unsigned int heads, sectors, cylinders;
+extern unsigned char MBRbuffer[MAX_SECTOR_SIZE];
+extern unsigned int heads, cylinders;
+extern unsigned long long sectors;
extern int show_begin;
extern int sun_label;
extern char *partition_type(unsigned char type);
++++++ util-linux-2.12r-fdisk_remove_bogus_warnings.patch ++++++
--- /var/tmp/diff_new_pack.q24757/_old 2007-04-12 18:31:11.000000000 +0200
+++ /var/tmp/diff_new_pack.q24757/_new 2007-04-12 18:31:11.000000000 +0200
@@ -1,8 +1,8 @@
-Index: util-linux-2.12r/fdisk/fdisk.c
+Index: util-linux-ng-2.12r+2.13pre7/fdisk/fdisk.c
===================================================================
---- util-linux-2.12r.orig/fdisk/fdisk.c
-+++ util-linux-2.12r/fdisk/fdisk.c
-@@ -1496,6 +1496,7 @@ static void check_consistency(struct par
+--- util-linux-ng-2.12r+2.13pre7.orig/fdisk/fdisk.c
++++ util-linux-ng-2.12r+2.13pre7/fdisk/fdisk.c
+@@ -1498,6 +1498,7 @@ static void check_consistency(struct par
/* compute logical ending (c, h, s) */
long2chs(get_start_sect(p) + get_nr_sects(p) - 1, &lec, &leh, &les);
@@ -10,7 +10,7 @@
/* Same physical / logical beginning? */
if (cylinders <= 1024 && (pbc != lbc || pbh != lbh || pbs != lbs)) {
printf(_("Partition %d has different physical/logical "
-@@ -1512,7 +1513,6 @@ static void check_consistency(struct par
+@@ -1514,7 +1515,6 @@ static void check_consistency(struct par
printf(_("logical=(%d, %d, %d)\n"),lec, leh, les);
}
++++++ util-linux-2.12r-misc_utils_cal_formatting.patch ++++++
--- misc-utils/cal.c
+++ misc-utils/cal.c
@@ -702,18 +702,16 @@
}
void
-trim_trailing_spaces(s)
- char *s;
+trim_trailing_spaces(char *s)
{
char *p;
for (p = s; *p; ++p)
continue;
- while (p > s && isspace(*--p))
- continue;
- if (p > s)
- ++p;
- *p = '\0';
+
+ p--;
+ if (isspace(*p))
+ *p = '\0';
}
/*
++++++ util-linux-2.12r-mount_by_uuid.patch ++++++
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
@@ -295,7 +295,7 @@ has_uuid(const char *device, const char
const char *devuuid;
int ret;
- devuuid = mount_get_devname_by_uuid(device);
+ devuuid = mount_get_volume_uuid_by_spec(device);
ret = !strcmp(uuid, devuuid);
/* free(devuuid); */
return ret;
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
@@ -16,6 +16,11 @@ mount_blkid_put_cache(void) {
}
const char *
+mount_get_volume_uuid_by_spec(const char *spec) {
+ return blkid_get_tag_value(blkid, "UUID", spec);
+}
+
+const char *
mount_get_volume_label_by_spec(const char *spec) {
return blkid_get_tag_value(blkid, "LABEL", spec);
}
@@ -56,6 +61,11 @@ mount_blkid_put_cache(void) {
}
const char *
+mount_get_volume_uuid_by_spec(const char *spec) {
+ return xstrdup(get_volume_uuid_by_spec(spec));
+}
+
+const char *
mount_get_volume_label_by_spec(const char *spec) {
return xstrdup(get_volume_label_by_spec(spec));
}
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
@@ -7,6 +7,7 @@ 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_uuid_by_spec(const char *spec);
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);
++++++ util-linux-2.12r-mount_mount.8_xfs_update.patch ++++++
Index: mount/mount.8
===================================================================
--- mount/mount.8.orig
+++ mount/mount.8
@@ -1841,6 +1841,12 @@ system call.
.TP
.B dmapi " / " xdsm
Enable the DMAPI (Data Management API) event callouts.
+Use with the "mtpt" option.
+.TP
+.BI mtpt= mountpoint
+Use with the "dmapi" option. The value specified here will be
+included in the DMAPI mount event, and should be the path of
+the actual mountpoint that is used.
.TP
.BI logbufs= value
Set the number of in-memory log buffers.
++++++ util-linux-2.12r-mount_mtab_update.patch ++++++
Index: mount/mount.c
===================================================================
--- mount/mount.c.orig
+++ mount/mount.c
@@ -842,6 +842,7 @@ try_mount_one (const char *spec0, const
int mnt5_res = 0; /* only for gcc */
int mnt_err;
int flags;
+ int isroot;
char *extra_opts; /* written in mtab */
char *mount_opts; /* actually used on system call */
const char *opts, *spec, *node, *types;
@@ -942,13 +943,17 @@ retry_nfs:
if (loop)
opt_loopdev = loopdev;
- update_mtab_entry(loop ? loopfile : spec,
+ isroot = (streq (node, "/") || streq (node, "root") ||
+ streq (node, "rootfs"));
+ if (!isroot) {
+ update_mtab_entry(loop ? loopfile : spec,
node,
types ? types : "unknown",
fix_opts_string (flags & ~MS_NOMTAB, extra_opts, user),
flags,
freq,
pass);
+ }
block_signals (SIG_UNBLOCK);
res = 0;
++++++ util-linux-2.12r-mount_nfs_remount_options.patch ++++++
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.
++++++ util-linux-2.12r-mount_racy_loop.patch ++++++
--- /var/tmp/diff_new_pack.q24757/_old 2007-04-12 18:31:11.000000000 +0200
+++ /var/tmp/diff_new_pack.q24757/_new 2007-04-12 18:31:11.000000000 +0200
@@ -1,31 +1,30 @@
-Index: util-linux-2.12r/mount/lomount.c
+Index: util-linux-ng-2.12r+git20070330/mount/lomount.c
===================================================================
---- util-linux-2.12r.orig/mount/lomount.c
-+++ util-linux-2.12r/mount/lomount.c
-@@ -1005,7 +1005,17 @@ set_loop(const char *device, const char
+--- util-linux-ng-2.12r+git20070330.orig/mount/lomount.c
++++ util-linux-ng-2.12r+git20070330/mount/lomount.c
+@@ -341,8 +341,15 @@ set_loop(const char *device, const char
}
if (ioctl(fd, LOOP_SET_FD, ffd) < 0) {
- perror("ioctl: LOOP_SET_FD");
-+ switch (errno) {
-+ case EBUSY:
-+ ret = 2;
-+ if (verbose)
-+ perror("ioctl: LOOP_SET_FD");
-+ break;
-+ default:
-+ ret = 1;
-+ perror("ioctl: LOOP_SET_FD");
-+ break;
-+ }
- keyclean_close_fd_ffd_return1:
- memset(loopinfo.lo_encrypt_key, 0, sizeof(loopinfo.lo_encrypt_key));
- memset(&multiKeyBits[0][0], 0, sizeof(multiKeyBits));
-Index: util-linux-2.12r/mount/mount.c
+- return 1;
++ switch (errno) {
++ case EBUSY:
++ if (verbose)
++ perror("ioctl: LOOP_SET_FD");
++ return 2;
++ default:
++ perror("ioctl: LOOP_SET_FD");
++ return 1;
++ }
+ }
+ close (ffd);
+
+Index: util-linux-ng-2.12r+git20070330/mount/mount.c
===================================================================
---- util-linux-2.12r.orig/mount/mount.c
-+++ util-linux-2.12r/mount/mount.c
-@@ -653,18 +653,32 @@ loop_check(const char **spec, const char
+--- util-linux-ng-2.12r+git20070330.orig/mount/mount.c
++++ util-linux-ng-2.12r+git20070330/mount/mount.c
+@@ -712,20 +712,33 @@ loop_check(const char **spec, const char
printf(_("mount: skipping the setup of a loop device\n"));
} else {
int loopro = (*flags & MS_RDONLY);
@@ -37,7 +36,9 @@
- return EX_SYSERR; /* no more loop devices */
- if (verbose)
- printf(_("mount: going to use the loop device %s\n"), *loopdev);
-- if (set_loop (*loopdev, *loopfile, &loopro, type, AutoChmodPtr)) {
+- offset = opt_offset ? strtoull(opt_offset, NULL, 0) : 0;
+- if (set_loop(*loopdev, *loopfile, offset,
+- opt_encryption, pfd, &loopro)) {
+ do {
+ if (!*loopdev || !**loopdev)
+ *loopdev = find_unused_loop_device();
@@ -47,22 +48,23 @@
- printf(_("mount: failed setting up loop device\n"));
- return EX_FAIL;
- }
-+ printf(_("mount: going to use the loop device %s\n"), *loopdev);
-+ if (res = set_loop (*loopdev, *loopfile, &loopro, type, AutoChmodPtr)) {
-+ switch(res) {
-+ case 2:
-+ /* loop dev has been grabbed by some other process,
-+ try again */
-+ if (verbose)
-+ printf("mount: stolen loop=%s ...trying again\n", *loopdev);
-+ *loopdev = NULL;
-+ continue;
-+ default:
-+ if (verbose)
-+ printf(_("mount: failed setting up loop device\n"));
-+ return EX_FAIL;
-+ }
-+ }
++ printf(_("mount: going to use the loop device %s\n"), *loopdev);
++ if (res = set_loop (*loopdev, *loopfile, offset,
++ opt_encryption, pfd, &loopro)) {
++ switch(res) {
++ case 2:
++ /* loop dev has been grabbed by some other process,
++ try again */
++ if (verbose)
++ printf("mount: stolen loop=%s ...trying again\n", *loopdev);
++ *loopdev = NULL;
++ continue;
++ default:
++ if (verbose)
++ printf(_("mount: failed setting up loop device\n"));
++ return EX_FAIL;
++ }
++ }
+ } while (!*loopdev);
+
if (verbose > 1)
++++++ util-linux-2.12r-mount_rpcsec_gss.patch ++++++
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));
++++++ util-linux-2.12r-mount_sec_manpage.patch ++++++
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
++++++ util-linux-2.12r-mount_swapon_swsuspend_resume.patch ++++++
--- /var/tmp/diff_new_pack.q24757/_old 2007-04-12 18:31:11.000000000 +0200
+++ /var/tmp/diff_new_pack.q24757/_new 2007-04-12 18:31:11.000000000 +0200
@@ -1,8 +1,9 @@
## 30swsusp-resume.dpatch by Jeff Bailey
-diff -urNad --exclude=CVS --exclude=.svn ./mount/get_label_uuid.c /tmp/dpep-work.5ak7Cm/util-linux/mount/get_label_uuid.c
---- ./mount/get_label_uuid.c 2004-12-22 08:44:32.000000000 -0700
-+++ /tmp/dpep-work.5ak7Cm/util-linux/mount/get_label_uuid.c 2005-12-06 11:54:33.000000000 -0700
-@@ -93,7 +93,25 @@
+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;
}
@@ -29,7 +30,7 @@
/*
* Get both label and uuid.
-@@ -126,6 +143,8 @@
+@@ -126,6 +144,8 @@ get_label_uuid(const char *device, char
if (is_v1_swap_partition(fd, label, uuid))
goto done;
@@ -38,10 +39,21 @@
if (lseek(fd, 1024, SEEK_SET) == 1024
&& read(fd, (char *) &e2sb, sizeof(e2sb)) == sizeof(e2sb)
-diff -urNad --exclude=CVS --exclude=.svn ./mount/swapon.c /tmp/dpep-work.5ak7Cm/util-linux/mount/swapon.c
---- ./mount/swapon.c 2004-12-22 08:44:32.000000000 -0700
-+++ /tmp/dpep-work.5ak7Cm/util-linux/mount/swapon.c 2005-12-06 11:54:33.000000000 -0700
-@@ -22,6 +25,7 @@
+Index: util-linux-ng-2.12r+git20070330/mount/swapon.c
+===================================================================
+--- util-linux-ng-2.12r+git20070330.orig/mount/swapon.c
++++ util-linux-ng-2.12r+git20070330/mount/swapon.c
+@@ -10,7 +10,9 @@
+ #include
+ #include
+ #include
++#include
+ #include
++#include
+ #include "xmalloc.h"
+ #include "swap_constants.h"
+ #include "swapargs.h"
+@@ -23,6 +25,7 @@
#define _PATH_FSTAB "/etc/fstab"
#define PROC_SWAPS "/proc/swaps"
@@ -49,7 +61,7 @@
#define SWAPON_NEEDS_TWO_ARGS
-@@ -164,6 +168,85 @@
+@@ -179,6 +182,85 @@ display_summary(void)
return 0 ;
}
@@ -62,7 +74,7 @@
+static int
+swap_is_swsuspend(const char *device) {
+ const char *type = blkid_get_tag_value(blkid, "TYPE", device);
-+
++
+ if (type && strcmp(type, "swsuspend")==0)
+ return 0;
+ return 1;
@@ -72,7 +84,7 @@
+swap_is_swsuspend(const char *device) {
+ int fd, re = 1, n = getpagesize() - 10;
+ char buf[10];
-+
++
+ fd = open(device, O_RDONLY);
+ if (fd < 0)
+ return -1;
@@ -94,27 +106,27 @@
+swap_reinitialize(const char *device) {
+ const char *label = mount_get_volume_label_by_spec(device);
+ pid_t pid;
-+
++
+ switch((pid=fork())) {
+ case -1: /* fork error */
+ fprintf(stderr, _("%s: cannot fork: %s\n"),
+ progname, strerror(errno));
+ return -1;
-+
++
+ case 0: /* child */
+ if (label && *label)
+ execl(PATH_MKSWAP, PATH_MKSWAP, "-L", label, device, NULL);
+ else
+ execl(PATH_MKSWAP, PATH_MKSWAP, device, NULL);
+ exit(1); /* error */
-+
++
+ default: /* parent */
+ {
+ int status;
+ int ret;
+
+ do {
-+ if ((ret = waitpid(pid, &status, 0)) < 0
++ if ((ret = waitpid(pid, &status, 0)) < 0
+ && errno == EINTR)
+ continue;
+ else if (ret < 0) {
@@ -131,26 +143,26 @@
+ }
+ return -1; /* error */
+}
-+
++
static int
do_swapon(const char *orig_special, int prio) {
int status;
-@@ -187,6 +269,18 @@
+@@ -202,6 +284,18 @@ do_swapon(const char *orig_special, int
return -1;
}
-+ /* We have to reinitialize swap with old (=useless) software suspend
-+ * data. The problem is that if we don't do it, then we get data
++ /* We have to reinitialize swap with old (=useless) software suspend
++ * data. The problem is that if we don't do it, then we get data
+ * corruption the next time with suspended on.
+ */
+ if (swap_is_swsuspend(special)==0) {
+ fprintf(stdout, _("%s: %s: software suspend data detected. "
-+ "Reinitializing the swap.\n"),
++ "Reinitializing the swap.\n"),
+ progname, special);
+ if (swap_reinitialize(special) < 0)
+ return -1;
+ }
-+
++
/* people generally dislike this warning - now it is printed
only when `verbose' is set */
if (verbose) {
++++++ util-linux-2.12r-mount_umount_nosysfs.patch ++++++
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);
++++++ util-linux-2.12r-sys_utils_readprofile_mapfile.patch ++++++
diff -ruNp util-linux-2.12r/sys-utils/readprofile.c util-linux-2.12r.fix/sys-utils/readprofile.c
--- util-linux-2.12r/sys-utils/readprofile.c 2004-12-11 11:11:09.000000000 +1100
+++ util-linux-2.12r.fix/sys-utils/readprofile.c 2006-05-19 17:45:56.000000000 +1000
@@ -324,6 +324,7 @@ main(int argc, char **argv) {
*/
while (fgets(mapline,S_LEN,map)) {
unsigned int this=0;
+ int done = 0;
if (sscanf(mapline,"%llx %s %s",&next_add,mode,next_name)!=3) {
fprintf(stderr,_("%s: %s(%i): wrong map line\n"),
@@ -332,12 +333,17 @@ main(int argc, char **argv) {
}
header_printed = 0;
- /* ignore any LEADING (before a '[tT]' symbol is found)
- Absolute symbols */
- if ((*mode == 'A' || *mode == '?') && total == 0) continue;
- if (*mode != 'T' && *mode != 't' &&
- *mode != 'W' && *mode != 'w')
- break; /* only text is profiled */
+ /* the kernel only profiles up to _etext */
+ if (!strcmp(next_name, "_etext"))
+ done = 1;
+ else {
+ /* ignore any LEADING (before a '[tT]' symbol is found)
+ Absolute symbols */
+ if ((*mode == 'A' || *mode == '?') && total == 0) continue;
+ if (*mode != 'T' && *mode != 't' &&
+ *mode != 'W' && *mode != 'w')
+ break; /* only text is profiled */
+ }
if (indx >= len / sizeof(*buf)) {
fprintf(stderr, _("%s: profile address out of range. "
@@ -387,6 +393,8 @@ main(int argc, char **argv) {
strcpy(fn_name,next_name);
maplineno++;
+ if (done)
+ break;
}
/* clock ticks, out of kernel text - probably modules */
++++++ util-linux-2.13-build_fix_intel_check.patch ++++++
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
@@ -170,7 +170,7 @@ AC_TRY_COMPILE([
case "$host" in
- i?86-*) intel=true ;;
+ i?86-* | x86_64*) intel=true ;;
m68*) m68k=true ;;
sparc*) sparc=true ;;
esac
++++++ util-linux-2.13-build_gnu_source.patch ++++++
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
@@ -10,6 +10,7 @@ AC_CONFIG_SRCDIR(mount/mount.c)
AC_PREFIX_DEFAULT(/)
+AC_GNU_SOURCE
AC_PROG_CC_STDC
AC_PROG_RANLIB
AC_PROG_LIBTOOL
++++++ util-linux-2.13-misc_utils_add_man_scriptreplay.patch ++++++
Index: util-linux-ng-2.12r+git20070330/misc-utils/Makefile.am
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/misc-utils/Makefile.am
+++ util-linux-ng-2.12r+git20070330/misc-utils/Makefile.am
@@ -24,7 +24,7 @@ scriptreplay: scriptreplay.pl
CLEANFILES = chkdupexe scriptreplay
man_MANS = cal.1 chkdupexe.1 ddate.1 logger.1 look.1 mcookie.1 \
- namei.1 script.1 whereis.1 hostid.1
+ namei.1 script.1 whereis.1 hostid.1 scriptreplay.1
if HAVE_NCURSES
cal_LDADD = -lncurses
++++++ util-linux-2.13-mount_nfs_timeo.patch ++++++
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",
++++++ util-linux-2.13-sys_utils_arch.patch ++++++
Index: util-linux-ng-2.12r+git20070330/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
@@ -1,9 +1,11 @@
include $(top_srcdir)/config/include-Makefile.am
-bin_PROGRAMS = dmesg
+bin_PROGRAMS = arch dmesg
usrbinexec_PROGRAMS = cytune flock ionice ipcrm ipcs renice setsid
+arch_SOURCES = arch.c
+
cytune_SOURCES = cytune.c cyclades.h
sbin_PROGRAMS = ctrlaltdel
@@ -12,7 +14,7 @@ usrsbinexec_PROGRAMS = readprofile tunel
tunelp_SOURCES = tunelp.c lp.h
-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
Index: util-linux-ng-2.12r+git20070330/sys-utils/arch.1
===================================================================
--- /dev/null
+++ util-linux-ng-2.12r+git20070330/sys-utils/arch.1
@@ -0,0 +1,34 @@
+.\" arch.1 --
+.\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
+.\" Public domain: may be freely distributed.
+.TH ARCH 1 "4 July 1997" "Linux 2.0" "Linux Programmer's Manual"
+.SH NAME
+arch \- print machine architecture
+.SH SYNOPSIS
+.B arch
+.SH DESCRIPTION
+.B arch
+is equivalent to
+.BR "uname -m" .
+
+On current Linux systems,
+.B arch
+prints things such as "i386", "i486", "i586", "alpha", "sparc",
+"arm", "m68k", "mips", "ppc".
+.SH SEE ALSO
+.BR uname (1),
+.BR uname (2)
+.\"
+.\" Details:
+.\" arch prints the machine part of the system_utsname struct
+.\" This struct is defined in version.c, and this field is
+.\" initialized with UTS_MACHINE, which is defined as $ARCH
+.\" in the main Makefile.
+.\" That gives the possibilities
+.\" alpha arm i386 m68k mips ppc sparc sparc64
+.\"
+.\" If Makefile is not edited, ARCH is guessed by
+.\" ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/)
+.\" 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
===================================================================
--- /dev/null
+++ util-linux-ng-2.12r+git20070330/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
+ * Revised: Mon Dec 20 12:29:23 1993 by faith@cs.unc.edu
+ * Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
+
+ * 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.
+
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#include
+#include
+
+int main (void)
+{
+ struct utsname utsbuf;
+
+ if (uname( &utsbuf )) {
+ perror( "arch" );
+ return 1;
+ }
+
+ printf( "%s\n", utsbuf.machine );
+
+ return 0;
+}
++++++ util-linux-2.13-tests_missing_include.patch ++++++
Index: util-linux-ng-2.12r+git20070330/tests/helpers/mnt_test_sysinfo.c
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/tests/helpers/mnt_test_sysinfo.c
+++ util-linux-ng-2.12r+git20070330/tests/helpers/mnt_test_sysinfo.c
@@ -1,6 +1,7 @@
#include
#include
+#include
#include
#include
++++++ util-linux-login_utils_wall.patch ++++++
remove unwanted newline (#12181)
--- util-linux-2.12q/login-utils/wall.c
+++ util-linux-2.12q/login-utils/wall.c
@@ -217,8 +217,6 @@
if (cnt == 79 || ch == '\n') {
for (; cnt < 79; ++cnt)
putc(' ', fp);
- putc('\r', fp);
- putc('\n', fp);
cnt = 0;
}
carefulputc(ch, fp);
++++++ util-linux-mount_libvolume_id_support.patch ++++++
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
++++++ util-linux-mount_mount.8-acl.patch ++++++
Index: mount/mount.8
================================================================================
--- mount/mount.8
+++ mount/mount.8
@@ -943,6 +943,17 @@
Sync all data and metadata every
.I nrsec
seconds. The default value is 5 seconds. Zero means default.
+.RE
+.TP
+.BR user_xattr
+Enable Extended User Attributes. See the
+.BR attr (5)
+manual page.
+.TP
+.BR acl
+Enable POSIX Access Control Lists. See the
+.BR acl (5)
+manual page.
.SH "Mount options for fat"
(Note:
@@ -1495,6 +1506,16 @@
.I resizer
utility which can be obtained from
.IR ftp://ftp.namesys.com/pub/reiserfsprogs .
+.TP
+.BR user_xattr
+Enable Extended User Attributes. See the
+.BR attr (5)
+manual page.
+.TP
+.BR acl
+Enable POSIX Access Control Lists. See the
+.BR acl (5)
+manual page.
.SH "Mount options for romfs"
None.
++++++ util-linux-mount_nfs.8.patch ++++++
--- 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.
++++++ util-linux-mount_opt_hotplug.patch ++++++
mount/mount.8 | 7 +++++++
mount/mount.c | 15 +++++++++++++--
mount/mount_constants.h | 3 +++
3 files changed, 23 insertions(+), 2 deletions(-)
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
@@ -572,6 +572,10 @@ This option implies the options
(unless overridden by subsequent options, as in the option line
.BR group,dev,suid ).
.TP
+.B hotplug
+Do not report errors for this device if it doesn't exist.
+.BR fcntl (2).
+.TP
.B mand
Allow mandatory locks on this filesystem. See
.BR fcntl (2).
@@ -602,6 +606,9 @@ Do not allow direct execution of any bin
(Until recently it was possible to run binaries anyway using a command like
/lib/ld*.so /mnt/binary. This trick fails since Linux 2.4.25 / 2.6.0.)
.TP
+.B nohotplug
+Report an error if the device does not exist.
+.TP
.B nomand
Do not allow mandatory locks on this filesystem.
.TP
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
@@ -174,9 +174,14 @@ static const struct opt_map opt_map[] =
{ "diratime", 0, 1, MS_NODIRATIME }, /* Update dir access times */
{ "nodiratime", 0, 0, MS_NODIRATIME },/* Do not update dir access times */
#endif
+#ifdef MS_HOTPLUG
+ { "hotplug", 0, 0, MS_HOTPLUG }, /* Don't fail if ENOENT on dev */
+#endif
{ NULL, 0, 0, 0 }
};
+static int option_hotplug; /* can not invent our own MS_FLAGS */
+
static const char *opt_loopdev, *opt_vfstype, *opt_offset, *opt_encryption,
*opt_speed, *opt_comment;
@@ -269,6 +274,10 @@ parse_opt(const char *opt, int *mask, ch
for (om = opt_map; om->opt != NULL; om++)
if (streq (opt, om->opt)) {
+ if (om->mask & MS_HOTPLUG) {
+ option_hotplug = 1;
+ return;
+ }
if (om->inv)
*mask &= ~om->mask;
else
@@ -985,9 +994,11 @@ retry_nfs:
else if (stat (node, &statbuf))
error (_("mount: mount point %s is a symbolic link to nowhere"),
node);
- else if (stat (spec, &statbuf))
+ else if (stat (spec, &statbuf)) {
+ if (option_hotplug)
+ goto out;
error (_("mount: special device %s does not exist"), spec);
- else {
+ } else {
errno = mnt_err;
perror("mount");
}
Index: util-linux-ng-2.12r+git20070330/mount/mount_constants.h
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/mount/mount_constants.h
+++ util-linux-ng-2.12r+git20070330/mount/mount_constants.h
@@ -57,6 +57,9 @@ if we have a stack or plain mount - moun
#ifndef MS_VERBOSE
#define MS_VERBOSE 0x8000 /* 32768 */
#endif
+
+#define MS_HOTPLUG (1<<18) /* Don't fail if ENOENT on the dev, mount internal */
+
/*
* Magic mount flag number. Had to be or-ed to the flag values.
*/
++++++ util-linux-mount_warn_nfsudp.patch ++++++
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;
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org