3
0
forked from pool/util-linux
OBS User unknown 2006-12-18 23:18:10 +00:00 committed by Git OBS Bridge
parent eccc9ad8d1
commit cd951ec78c
106 changed files with 12653 additions and 16558 deletions

12
README.largedisk Normal file
View File

@ -0,0 +1,12 @@
Some hints on fdisk and large disks (> 2TB)
-------------------------------------------
Note that fdisk only supports legacy partition tables.
Legacy partition tables (like DOS) use 32 bit LBA addressing,
which means that you can only address partitions with a starting
sector and a size with a maximum of 2**32 sectors = 2TB.
This means you can not create partitions that are greater than 2TB
with fdisk!
If you want to use partition sizes above this limit, you need to use
GUID Partition Tables (GPT) which use 64 bit LBA addressing.
They are supported by parted.

1231
README.loop-AES-v2.2d Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
loop-AES patch in util-linux
============================
To enhance the feature of mount, umount, losetup, swapon and swapoff we have
included the patch to util-linux from Jari Ruusu's loop-AES package
(http://loop-aes.sourceforge.net/). More details about this patch can be found
in /usr/share/doc/packages/util-linux/README.loop-AES-*
Please note, that we have only used the patch to util-linux and not the ones
for gpg or the new kernel loop driver.
Your SuSE team <feedback@suse.de>

54
README.raw Normal file
View File

@ -0,0 +1,54 @@
Raw device driver support on SLS 9
On SLS 9, you will notice that by default, raw devices (nodes) (/dev/rawctl
and /dev/raw/rawN (1-15)) no longer exist whereas in SLES 8, the raw nodes were
created when the system was initially installed. SLS 9, by default, uses
the new dynamic userspace implementation "sysfs" together with "udev" which
replaces the previous static "dev" system.
Raw devices are moving towards eventual obsolescence with block+O_DIRECT
support intended as a replacement. The primary application users of raw
character devices have been databases so the database you are using will have
to support the O_DIRECT functionality before moving away from raw character
devices.
Using RAW with kernel 2.6 (SLS 9)
---------------------------------
Raw device usage in kernel 2.6 together with udev and sysfs was intended to be
quite seamless. Basically, all that is required is to load the raw module after
each reboot using the commands "modprobe raw" or "rcraw start". Then use the
"raw" command to create the bindings to the block character devices. The raw
device nodes are no longer required to exist before the bindings are assigned
and used.
Using a single script, you can you load the raw module and bind the raw nodes
to block devices.
#!/usr/bin
# load the raw module
modprobe raw # can also use "rcraw start"
# create the raw bindings
raw /dev/raw/raw1 /dev/sdb1
raw /dev/raw/raw2 /dev/sbc1
You can see if the raw driver is available by issuing "rcraw status". If the
raw driver is loaded, the command should return a status of "running". A status
of "dead" will usually indicate that the driver was not loaded or
the /dev/rawctl file does not exist. The /dev/rawctl file is automatically
created when the module is loaded. This file and the /dev/raw/rawN nodes can
also be viewed under the /sys/class/raw directory.
Raw node permissions
----------------------------------
When the raw devices are assigned, permission settings are determined from the
/etc/udev/udev.permission file. This file can be modified to assign different
owner, group and/or access permissions to the raw nodes. For example, by
default, the permission settings for raw nodes are as follows:
raw/raw*:root:disk:660
Here, root:disk is the default owner:group with read write access for owner and
group. As an example, to create the raw nodes with an owner:group of
user1:group1 and read write access for all, change the assignment as follows:
raw/raw*:user1:group1:666

205
addnote.c
View File

@ -1,205 +0,0 @@
/*
* Program to hack in a PT_NOTE program header entry in an ELF file.
* This is needed for OF on RS/6000s to load an image correctly.
* Note that OF needs a program header entry for the note, not an
* ELF section.
*
* Copyright 2000 Paul Mackerras.
*
* 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 of the License, or (at your option) any later version.
*
* Usage: addnote zImage
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
/* CHRP note section */
char arch[] = "PowerPC";
#define N_DESCR 6
unsigned int descr[N_DESCR] = {
0xffffffff, /* real-mode = true */
0x02000000, /* real-base, i.e. where we expect OF to be */
0xffffffff, /* real-size */
0xffffffff, /* virt-base */
0xffffffff, /* virt-size */
0x4000, /* load-base */
};
/* RPA note section */
char rpaname[] = "IBM,RPA-Client-Config";
/*
* Note: setting ignore_my_client_config *should* mean that OF ignores
* all the other fields, but there is a firmware bug which means that
* it looks at the splpar field at least. So these values need to be
* reasonable.
*/
#define N_RPA_DESCR 8
unsigned int rpanote[N_RPA_DESCR] = {
0, /* lparaffinity */
64, /* min_rmo_size */
0, /* min_rmo_percent */
40, /* max_pft_size */
1, /* splpar */
-1, /* min_load */
0, /* new_mem_def */
1, /* ignore_my_client_config */
};
#define ROUNDUP(len) (((len) + 3) & ~3)
unsigned char buf[512];
#define GET_16BE(off) ((buf[off] << 8) + (buf[(off)+1]))
#define GET_32BE(off) ((GET_16BE(off) << 16) + GET_16BE((off)+2))
#define PUT_16BE(off, v) (buf[off] = ((v) >> 8) & 0xff, \
buf[(off) + 1] = (v) & 0xff)
#define PUT_32BE(off, v) (PUT_16BE((off), (v) >> 16), \
PUT_16BE((off) + 2, (v)))
/* Structure of an ELF file */
#define E_IDENT 0 /* ELF header */
#define E_PHOFF 28
#define E_PHENTSIZE 42
#define E_PHNUM 44
#define E_HSIZE 52 /* size of ELF header */
#define EI_MAGIC 0 /* offsets in E_IDENT area */
#define EI_CLASS 4
#define EI_DATA 5
#define PH_TYPE 0 /* ELF program header */
#define PH_OFFSET 4
#define PH_FILESZ 16
#define PH_HSIZE 32 /* size of program header */
#define PT_NOTE 4 /* Program header type = note */
#define ELFCLASS32 1
#define ELFDATA2MSB 2
unsigned char elf_magic[4] = { 0x7f, 'E', 'L', 'F' };
int
main(int ac, char **av)
{
int fd, n, i;
int ph, ps, np;
int nnote, nnote2, ns;
if (ac != 2) {
fprintf(stderr, "Usage: %s elf-file\n", av[0]);
exit(1);
}
fd = open(av[1], O_RDWR);
if (fd < 0) {
perror(av[1]);
exit(1);
}
nnote = 12 + ROUNDUP(strlen(arch) + 1) + sizeof(descr);
nnote2 = 12 + ROUNDUP(strlen(rpaname) + 1) + sizeof(rpanote);
n = read(fd, buf, sizeof(buf));
if (n < 0) {
perror("read");
exit(1);
}
if (n < E_HSIZE || memcmp(&buf[E_IDENT+EI_MAGIC], elf_magic, 4) != 0)
goto notelf;
if (buf[E_IDENT+EI_CLASS] != ELFCLASS32
|| buf[E_IDENT+EI_DATA] != ELFDATA2MSB) {
fprintf(stderr, "%s is not a big-endian 32-bit ELF image\n",
av[1]);
exit(1);
}
ph = GET_32BE(E_PHOFF);
ps = GET_16BE(E_PHENTSIZE);
np = GET_16BE(E_PHNUM);
if (ph < E_HSIZE || ps < PH_HSIZE || np < 1)
goto notelf;
if (ph + (np + 2) * ps + nnote + nnote2 > n)
goto nospace;
for (i = 0; i < np; ++i) {
if (GET_32BE(ph + PH_TYPE) == PT_NOTE) {
fprintf(stderr, "%s already has a note entry\n",
av[1]);
exit(0);
}
ph += ps;
}
/* XXX check that the area we want to use is all zeroes */
for (i = 0; i < 2 * ps + nnote + nnote2; ++i)
if (buf[ph + i] != 0)
goto nospace;
/* fill in the program header entry */
ns = ph + 2 * ps;
PUT_32BE(ph + PH_TYPE, PT_NOTE);
PUT_32BE(ph + PH_OFFSET, ns);
PUT_32BE(ph + PH_FILESZ, nnote);
/* fill in the note area we point to */
/* XXX we should probably make this a proper section */
PUT_32BE(ns, strlen(arch) + 1);
PUT_32BE(ns + 4, N_DESCR * 4);
PUT_32BE(ns + 8, 0x1275);
strcpy((char *) &buf[ns + 12], arch);
ns += 12 + strlen(arch) + 1;
for (i = 0; i < N_DESCR; ++i, ns += 4)
PUT_32BE(ns, descr[i]);
/* fill in the second program header entry and the RPA note area */
ph += ps;
PUT_32BE(ph + PH_TYPE, PT_NOTE);
PUT_32BE(ph + PH_OFFSET, ns);
PUT_32BE(ph + PH_FILESZ, nnote2);
/* fill in the note area we point to */
PUT_32BE(ns, strlen(rpaname) + 1);
PUT_32BE(ns + 4, sizeof(rpanote));
PUT_32BE(ns + 8, 0x12759999);
strcpy((char *) &buf[ns + 12], rpaname);
ns += 12 + ROUNDUP(strlen(rpaname) + 1);
for (i = 0; i < N_RPA_DESCR; ++i, ns += 4)
PUT_32BE(ns, rpanote[i]);
/* Update the number of program headers */
PUT_16BE(E_PHNUM, np + 2);
/* write back */
lseek(fd, (long) 0, SEEK_SET);
i = write(fd, buf, n);
if (i < 0) {
perror("write");
exit(1);
}
if (i < n) {
fprintf(stderr, "%s: write truncated\n", av[1]);
exit(1);
}
exit(0);
notelf:
fprintf(stderr, "%s does not appear to be an ELF file\n", av[1]);
exit(1);
nospace:
fprintf(stderr, "sorry, I can't find space in %s to put the note\n",
av[1]);
exit(1);
}

View File

@ -0,0 +1,18 @@
--- adjtimex-1.20/adjtimex.c
+++ adjtimex-1.20/adjtimex.c
@@ -35,15 +35,6 @@
#include <sys/ioctl.h>
#include <linux/rtc.h>
-#ifdef __alpha__
-extern int adjtimex(struct timex *);
-#else
-#ifdef __ia64__
-extern int adjtimex(struct timex *);
-#else
-_syscall1(int, adjtimex, struct timex *, txcp)
-#endif
-#endif
int F_print = 0;
#ifndef LOG_PATH

3
adjtimex-1.20.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ad3619a6f4f04d278ac3d3e0261649465a9748dc84220aa5f4060aadaea839ba
size 50096

View File

@ -1,12 +0,0 @@
libuuid1
libuuid-devel
requires -libuuid-<targettype>
requires "libuuid1-<targettype> = <version>"
libblkid1
libblkid-devel
requires -libblkid-<targettype>
requires "libblkid1-<targettype> = <version>"
libmount1
libmount-devel
requires -libmount-<targettype>
requires "libmount1-<targettype> = <version>"

View File

@ -1,5 +0,0 @@
# do not keep cache file across reboots
CACHE_FILE=/dev/.blkid.tab
# never try to sequentially scan all devices in /dev
EVALUATE=udev

169
cryptoloop.txt Normal file
View File

@ -0,0 +1,169 @@
cryptoloop - a generic cryptographic loop device filter
=======================================================
To enable cryptoloop, you must fetch the cryptoloop-version.tar.gz source from
your kernel.org mirror or directly from the non-US <http://www.kerneli.org>.
Quickstart
~~~~~~~~~~
(if you have old encrypted volumes, please read the section about
conversion below)
you need a kernel compiled with
*) loop device driver
*) cryptographic support
*) generic crypto loop filter
*) one or more ciphers you want to use for encryption either as module or
statically (if you build them as module, don't forget to insmod them!)
Download the cryptoloop latest version tarball from the Internet and enter
the untarred directory. The following commands will patch your kernel and
copy the cryptoloop source in.
$ make patch-kernel KDIR=/your/kernel/source LOOP=[iv or jari]
Which will patch your kernel, and enable you to select cryptoloop in the
Cryptography section of the kernel configuration. Note, you have to manually
enable both CryptoAPI and cryptoloop in your kernel configuration.
If you would rather build modules you can use the following commands.
$ make modules KDIR=/your/kernel/source CDIR=/cryptoapi/source \
LOOP=[iv or jari]
$ make modules_install KDIR=/your/kernel/source
You also need a util-linux patched package (see
<http://www.kernel.org/pub/linux/kernel/people/hvr/> for some recent
patches)
Read on at <http://encryptionhowto.sourceforge.net/>
How Loopback Encryption Works
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here is a small overview of how the loopback filesystem encryption works.
For all the of the data to be encrypted on a drive we need to interrupt the
disk write/read *after* the filesystem meta data is attached. Instead of hi-
jacking the system call we pipe the the filesystem commands through a loopback
device.
One advantage of this is that you can either encrypt a device(hard drive) or
a file already on a drive and mount it as a file system. This allows you to
have encrypted folders on an unencrypted drive, useful if you don't want to
encrypt everything.
The loopback device fits in like this:
device-->loop-->mountpoint
The loop stage is actually divided into a couple stages, which is why the
cryptoloop module is included. It splits the input and output from the
loopback into pieces for the ciphers. Since they operate on a specific
blocksize(i.e. 64-bits, 128-bits) the data must be chopped up for them.
device-->cryptoloop-->loop-->mountpoint
The cryptoloop module is also where the actual encryption and decryption of
the data takes place.
Some words about IV Calculation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are some problems with the IV calculation up to recent 2.4.x
linux kernels. It's been calculated more or less by
IV = rel_sector / (blocksize >> 9) + (lo_offset / blocksize)
The first problem which arises, is that data transfers are not always
guaranteed to have a size of an integral multiple of the blocksize;
This is a problem, because of CBC mode's property of needing the
complete ciphertext block, i.e. you can't cipher or decipher only the
2nd half of a block if you don't know the first half of it!
Another problem which may be experienced is, when the soft blocksize
changes, i.e. due to different medias, as CDROM block devices and
alike, or when the filesystem layer sets the blocksize to some other
size.
But there's hope, as all transfer sizes are usually (except for the
last block on file backed loop devices sometimes...) an integral
multiple of 512 byte units (which is linux' atomic sector size);
So the solution is to stick to a portable, uniform 512 byte based IV
metric! Alas this can't be accomplished without modifying the loop
driver, as the more granular IV metric can't be calculated from the
current dynamic IV metric.
This change also renders most previously used encrypted volumes
unreadable, which need to be converted to the new IV metric.
Converting from Older IV Metrics
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The recommended procedure is as follow, in case you don't want to
backup your old data in a conventional manner, and then restore it to
a freshly created encrypted volume with the new IV-metric.
The more valuable your data is, the more important it is, that you try
the following procedure with some dummy data, before risking your real
data! Cause if something goes wrong you'll have to keep both pieces...
1) decrypt from within your old kernel version
1.1) setup your encrypted loop device, and mount it (this is also
important for making sure, the filesystem layer sets the soft block
size accordingly!)
1.2) unmount the filesystem (but leave the loop device setted up)
1.3) dd if=/dev/loop0 of=/dev/<underlying blockdev/file> make sure
the process does not get interrupted, otherwise you will have a hard
time, reconstructing your data, since you are decrypting the data
back to the same area where the ciphertext was.
3) make sure the block/file contains the properly deciphered content!!
2) boot the new kernel featuring the 512byte based IV
follow the instructions for 'encrypting unencrypted volumes' below
Encrypting Unencrypted Volumes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
just as simple as that (please test this before trying on important data)
1) set up a new encrypted loop device over the still unencrypted data
2) dd if=/dev/<underlying blockdev/file> of=/dev/loop0
Migrating from loop-AES to CryptoAPI
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you want to move from using the loop-AES filesystem encryption to
CryptoAPI it only requires a small tweak. After loading cryptoapi and loading
the cipher-aes module use the following line when setting up your loopback
device:
$ losetup -e aes -k 256 -P sha512 /dev/loop0 /dev/<your drive>
Then proceed to mount your loop device as you normall would. Here is the
table for mapping loop-AES to cryptoapi losetup flags:
loop-AES cryptoapi
============================================================
-e aes128 -H rmd160 -e aes -k 128
-e aes128 -H sha256 -e aes -k 128 -P sha256
-e aes128 -H sha384 -e aes -k 128 -P sha384
-e aes128 -H sha512 -e aes -k 128 -P sha512
-e aes256 -H rmd160 -e aes -k 256
-e aes256 -H sha256 -e aes -k 256 -P sha256
-e aes256 -H sha384 -e aes -k 256 -P sha384
-e aes256 -H sha512 -e aes -k 256 -P sha512
-e aes128 -e aes -k 128 -P sha256
-e aes192 -e aes -k 192 -P sha384
-e aes256 -e aes -k 256 -P sha512
--
$Id: cryptoloop.txt,v 1.3 2002/08/03 19:29:58 kyle Exp $

View File

@ -8,8 +8,8 @@
#
# example:
# ---------
# raw1:sdb1
# raw1:hdb1
#
# this means: bind /dev/raw/raw1 to /dev/sdb1
# this means: bind /dev/raw/raw1 to /dev/hdb1
#
# ...

View File

@ -1,5 +0,0 @@
vfat
hfs
minix
reiserfs
*

3
freeramdisk.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:de3d43efba1e5968f4ef748b7a02674929404a80c24bae287ed3490f8c1acf2e
size 2453

13
guessfstype.8 Normal file
View File

@ -0,0 +1,13 @@
.\" Michal Svec <msvec@suse.cz>
.TH GUESSFSTYPE 8 "25 January 2002" "Linux 2.4" "Linux Programmer's Manual"
.SH NAME
guessfstype \- guess the device file system type
.SH SYNOPSIS
.BI guessfstype " device"
.SH DESCRIPTION
.B guessfstype
guess the device file system type from the device super block
.SH "SEE ALSO"
.BR mount (8)
.SH AUTHOR
Michal Svec <msvec@suse.cz>

48
guessfstype2.patch Normal file
View File

@ -0,0 +1,48 @@
--- util-linux-2.12q/mount/guessfstype.c
+++ util-linux-2.12q/mount/guessfstype.c
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include "mount_guess_fstype.h"
+
+int verbose = 0;
+int mount_quiet=0;
+int sloppy = 0;
+
+char *progname;
+
+int main(int argc, char *argv[]) {
+ char *device, *type;
+
+ if(argc != 2) return 1;
+
+ progname = argv[0];
+ device = argv[1];
+
+ type = do_guess_fstype(device);
+ printf("%s *appears* to be: %s\n", device, type);
+
+ return 0;
+}
--- util-linux-2.12q/mount/Makefile
+++ util-linux-2.12q/mount/Makefile
@@ -11,7 +11,7 @@
LINK = $(CC) $(LDFLAGS)
SUID_PROGS = mount umount
-NOSUID_PROGS = swapon losetup
+NOSUID_PROGS = swapon losetup guessfstype
MAN5 = fstab.5 nfs.5
MAN8 = mount.8 swapoff.8 swapon.8 umount.8 losetup.8
@@ -57,6 +57,11 @@
version.o $(LIB)/env.o loumount.o
$(LINK) $^ -o $@ $(BLKID_LIB)
+guessfstype: guessfstype.o mount_guess_fstype.o sundries.o realpath.o \
+ fstab.o mntent.o get_label_uuid.o mount_blkid.o mount_by_label.o \
+ xmalloc.o
+ $(LINK) $^ -o $@
+
swapon: swapon.o version.o xmalloc.o \
get_label_uuid.o mount_by_label.o mount_blkid.o loop.o sha512.o $(LIB)/xstrncpy.o
$(LINK) $^ -o $@ $(BLKID_LIB)

11
klogconsole-quiet.patch Normal file
View File

@ -0,0 +1,11 @@
--- klogconsole/klogconsole.c
+++ klogconsole/klogconsole.c
@@ -59,7 +59,7 @@
exit(1);
}
if( ioctl( vt, TIOCLINUX, &newvt ) ) {
- perror("ioctl(TIOCLINUX)");
+ /* shut up perror("ioctl(TIOCLINUX)"); */
exit(1);
}
close(vt);

27
klogconsole.diff Normal file
View File

@ -0,0 +1,27 @@
--- klogconsole/Makefile
+++ klogconsole/Makefile
@@ -15,11 +15,11 @@
all: klogconsole
klogconsole: klogconsole.c
- $(CC) $(CFLAGS) -s -o $@ $<
+ $(CC) $(CFLAGS) -o $@ $<
clean:
$(RM) klogconsole
install: klogconsole klogconsole.man
- $(INSTALL) -s -m 0700 klogconsole $(DEST)/usr/sbin/
+ $(INSTALL) -m 0700 klogconsole $(DEST)/usr/sbin/
$(INSTALL) -c -m 0444 klogconsole.man $(DEST)/usr/share/man/man8/klogconsole.8
--- klogconsole/klogconsole.c
+++ klogconsole/klogconsole.c
@@ -46,7 +46,7 @@
char newvt[2];
int vt;
- if ((new_console < 1) || (new_console > MAX_CONSOLE)) {
+ if ((new_console < 0) || (new_console > MAX_CONSOLE)) {
fprintf(stderr,"wrong console number\n");
exit(1);
}

3
klogconsole.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a1efa9f001c8a92fb91a544d62a3f43356f31955dd5125364300827c239ee611
size 1942

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a4cd7c96ea647ad6ede62f93675acf3fa3c21ce225f9b771b82618fb2e676e4e
size 2060

View File

@ -1,9 +0,0 @@
#%PAM-1.0
auth requisite pam_nologin.so
auth include common-auth
account include common-account
password include common-password
session required pam_loginuid.so
session include common-session
#session optional pam_lastlog.so nowtmp showfailed
session optional pam_mail.so standard

File diff suppressed because it is too large Load Diff

View File

@ -1,143 +0,0 @@
--- a/login-utils/su-common.c
+++ b/login-utils/su-common.c
@@ -523,6 +523,117 @@ set_path(const struct passwd* pw)
err (EXIT_FAILURE, _("failed to set the %s environment variable"), "PATH");
}
+/* Add or clear /sbin and /usr/sbin for the su command
+ used without `-'. */
+
+/* Set if /sbin is found in path. */
+#define SBIN_MASK 0x01
+/* Set if /usr/sbin is found in path. */
+#define USBIN_MASK 0x02
+
+static char *
+addsbin (const char *const path)
+{
+ unsigned char smask = 0;
+ char *ptr, *tmp, *cur, *ret = NULL;
+ size_t len;
+
+ if (!path || *path == 0)
+ return NULL;
+
+ tmp = xstrdup (path);
+ cur = tmp;
+ for (ptr = strsep (&cur, ":"); ptr != NULL; ptr = strsep (&cur, ":"))
+ {
+ if (!strcmp (ptr, "/sbin"))
+ smask |= SBIN_MASK;
+ if (!strcmp (ptr, "/usr/sbin"))
+ smask |= USBIN_MASK;
+ }
+
+ if ((smask & (USBIN_MASK|SBIN_MASK)) == (USBIN_MASK|SBIN_MASK))
+ {
+ free (tmp);
+ return NULL;
+ }
+
+ len = strlen (path);
+ if (!(smask & USBIN_MASK))
+ len += strlen ("/usr/sbin:");
+
+ if (!(smask & SBIN_MASK))
+ len += strlen (":/sbin");
+
+ ret = xmalloc (len + 1);
+ strcpy (tmp, path);
+
+ *ret = 0;
+ cur = tmp;
+ for (ptr = strsep (&cur, ":"); ptr; ptr = strsep (&cur, ":"))
+ {
+ if (!strcmp (ptr, "."))
+ continue;
+ if (*ret)
+ strcat (ret, ":");
+ if (!(smask & USBIN_MASK) && !strcmp (ptr, "/bin"))
+ {
+ strcat (ret, "/usr/sbin:");
+ strcat (ret, ptr);
+ smask |= USBIN_MASK;
+ continue;
+ }
+ if (!(smask & SBIN_MASK) && !strcmp (ptr, "/usr/bin"))
+ {
+ strcat (ret, ptr);
+ strcat (ret, ":/sbin");
+ smask |= SBIN_MASK;
+ continue;
+ }
+ strcat (ret, ptr);
+ }
+ free (tmp);
+
+ if (!(smask & USBIN_MASK))
+ strcat (ret, ":/usr/sbin");
+
+ if (!(smask & SBIN_MASK))
+ strcat (ret, ":/sbin");
+
+ return ret;
+}
+
+static char *
+clearsbin (const char *const path)
+{
+ char *ptr, *tmp, *cur, *ret = NULL;
+
+ if (!path || *path == 0)
+ return NULL;
+
+ tmp = strdup (path);
+ if (!tmp)
+ return NULL;
+
+ ret = xmalloc (strlen (path) + 1);
+ *ret = 0;
+ cur = tmp;
+ for (ptr = strsep (&cur, ":"); ptr; ptr = strsep (&cur, ":"))
+ {
+ if (!strcmp (ptr, "/sbin"))
+ continue;
+ if (!strcmp (ptr, "/usr/sbin"))
+ continue;
+ if (!strcmp (ptr, "/usr/local/sbin"))
+ continue;
+ if (*ret)
+ strcat (ret, ":");
+ strcat (ret, ptr);
+ }
+ free (tmp);
+
+ return ret;
+}
+
/* Update `environ' for the new shell based on PW, with SHELL being
the value for the SHELL environment variable. */
@@ -560,6 +671,22 @@ modify_environment (const struct passwd *pw, const char *shell)
xsetenv ("SHELL", shell, 1);
if (getlogindefs_bool ("ALWAYS_SET_PATH", 0))
set_path(pw);
+ else
+ {
+ char const *path = getenv ("PATH");
+ char *new = NULL;
+
+ if (pw->pw_uid)
+ new = clearsbin (path);
+ else
+ new = addsbin (path);
+
+ if (new)
+ {
+ xsetenv ("PATH", new, 1);
+ free (new);
+ }
+ }
if (pw->pw_uid)
{

View File

@ -93,8 +93,6 @@ int main(int argc, char **argv)
exit(1);
}
set = 1;
if (!activate)
activate = 1;
break;
case 'v':
my_version();
@ -162,9 +160,9 @@ int main(int argc, char **argv)
if (clear)
memset(s, 0x0, tmp - s);
if (set)
snprintf((char*)s, tmp - s, "%s", string);
snprintf(s, tmp - s, "%s", string);
} else {
fprintf(stdout, "cmd_line size:%td\n", tmp - s);
fprintf(stdout, "cmd_line size:%d\n", tmp - s);
fprintf(stdout, "cmd_line: %s\n", s);
fprintf(stdout, "active: %c\n", *active);
}

61
mount-nfs-nonreserved Normal file
View File

@ -0,0 +1,61 @@
diff -u util-linux-2.11z/mount/nfsmount.c-o util-linux-2.11z/mount/nfsmount.c
--- util-linux-2.11z/mount/nfsmount.c-o 2003-06-18 15:23:06.000000000 +0200
+++ util-linux-2.11z/mount/nfsmount.c 2003-06-18 15:25:35.000000000 +0200
@@ -215,7 +215,7 @@
} status;
struct stat statbuf;
char *s;
- int port, mountport, proto, bg, soft, intr;
+ int port, mountport, proto, bg, soft, intr, nonreserved;
int posix, nocto, noac, nolock, broken_suid, noacl;
int retry, tcp;
int mountprog, mountvers, nfsprog, nfsvers;
@@ -320,6 +320,7 @@
noac = 0;
retry = 10000; /* 10000 minutes ~ 1 week */
tcp = 0;
+ nonreserved = 0;
mountprog = MOUNTPROG;
mountvers = 0;
@@ -411,6 +412,8 @@
soft = !val;
else if (!strcmp(opt, "intr"))
intr = val;
+ else if (!strcmp(opt, "reserved"))
+ nonreserved = !val;
else if (!strcmp(opt, "posix"))
posix = val;
else if (!strcmp(opt, "cto"))
@@ -445,7 +448,8 @@
| (intr ? NFS_MOUNT_INTR : 0)
| (posix ? NFS_MOUNT_POSIX : 0)
| (nocto ? NFS_MOUNT_NOCTO : 0)
- | (noac ? NFS_MOUNT_NOAC : 0);
+ | (noac ? NFS_MOUNT_NOAC : 0)
+ | (nonreserved ? NFS_MOUNT_NONRESERVED : 0);
#if NFS_MOUNT_VERSION >= 2
if (nfs_mount_version >= 2)
data.flags |= (tcp ? NFS_MOUNT_TCP : 0);
diff -u util-linux-2.11z/mount/nfs_mount4.h-o util-linux-2.11z/mount/nfs_mount4.h
--- util-linux-2.11z/mount/nfs_mount4.h-o 2003-06-18 15:23:06.000000000 +0200
+++ util-linux-2.11z/mount/nfs_mount4.h 2003-06-18 15:26:04.000000000 +0200
@@ -52,3 +52,4 @@
#define NFS_MOUNT_NONLM 0x0200 /* 3 */
#define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */
#define NFS_MOUNT_NOACL 0x0800 /* 4 */
+#define NFS_MOUNT_NONRESERVED 0x1000
--- util-linux-2.11z/mount/nfs.5-o 2003-06-18 07:10:54.000000000 -0700
+++ util-linux-2.11z/mount/nfs.5 2003-06-18 07:14:05.000000000 -0700
@@ -213,6 +213,11 @@
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.
+.TP 1.5i
+.I noreserved
+Don't use a reserved source port. This usually requires special options
+on the NFS server (insecure for linux knfsd), but allows more than 1024
+mounts from a single IP address.
.P
All of the non-value options have corresponding nooption forms.
For example, nointr means don't allow file operations to be

39
mount.8-acl.diff Normal file
View File

@ -0,0 +1,39 @@
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.

50
nfsboot Normal file
View File

@ -0,0 +1,50 @@
#! /bin/sh
# Copyright (c) 2004 SuSE AG, Nuernberg, Germany. All rights reserved.
#
# Author: Mads Martin Joergensen <mmj@suse.de>
#
# /etc/init.d/nfsboot
#
# System startup script for service(s) needed with NFS
#
### BEGIN INIT INFO
# Provides: nfsboot
# Required-Start: $network $portmap
# Required-Stop:
# Default-Start: 3 5
# Default-Stop:
# Description: Service(s) needed with NFS
### END INIT INFO
SMNOTIFYBIN=/sbin/sm-notify
OPTIONS=" -q"
test -x $SMNOTIFYBIN || exit 5
. /etc/rc.status
rc_reset
case "$1" in
# It's a one shot binary notifying clients, so the below is
# ok in this special case.
start|restart|try-restart|reload|force-reload)
echo -n "Starting nfsboot (`/bin/basename $SMNOTIFYBIN`) "
$SMNOTIFYBIN $OPTIONS
rc_status -v
;;
stop)
# we had rc_reset above, so we return 0 anyway
;;
status)
# sm-notify is not a daemon, but a one-shot binary
# nothing to be checked, status is unknown
rc_failed 4
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|restart|try-restart|reload|force-reload|status}"
exit 1
;;
esac
rc_exit

63
nologin.8 Normal file
View File

@ -0,0 +1,63 @@
.\" $OpenBSD: nologin.8,v 1.8 1999/06/04 02:45:19 aaron Exp $
.\" $NetBSD: nologin.8,v 1.3 1995/03/18 14:59:09 cgd Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)nologin.8 8.1 (Berkeley) 6/19/93
.\"
.Dd February 15, 1997
.Dt NOLOGIN 8
.Os
.Sh NAME
.Nm nologin
.Nd politely refuse a login
.Sh SYNOPSIS
.Nm nologin
.Sh DESCRIPTION
.Nm
displays a message that an account is not available and
exits non-zero.
It is intended as a replacement shell field for accounts that
have been disabled.
.Pp
If the file
.Pa /etc/nologin.txt
exists,
.Nm
displays its contents to the user instead of the default message.
.Sh SEE ALSO
.Xr login 1
.Sh HISTORY
The
.Nm
command appeared in
.Bx 4.4 .

58
nologin.c Normal file
View File

@ -0,0 +1,58 @@
/* $OpenBSD: nologin.c,v 1.2 1997/04/04 16:51:37 millert Exp $ */
/*
* Copyright (c) 1997, Jason Downs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/types.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
/* Distinctly different from _PATH_NOLOGIN. */
#define _PATH_NOLOGIN_TXT "/etc/nologin.txt"
#define DEFAULT_MESG "This account is currently not available.\n"
/*ARGSUSED*/
int main(argc, argv)
int argc;
char *argv[];
{
int nfd, nrd;
char nbuf[128];
nfd = open(_PATH_NOLOGIN_TXT, O_RDONLY);
if (nfd < 0) {
write(STDOUT_FILENO, DEFAULT_MESG, strlen(DEFAULT_MESG));
exit (1);
}
while ((nrd = read(nfd, nbuf, sizeof(nbuf))) > 0)
write(STDOUT_FILENO, nbuf, nrd);
close (nfd);
exit (1);
}

View File

@ -1,37 +0,0 @@
#!/bin/sh
if test util-linux.spec -ot python-libmount.spec ; then
echo "util-linux.spec is older than python-libmount.spec. Please merge changes manually and call pre-checkin.sh again."
exit 1
fi
if test util-linux.changes -ot python-libmount.changes ; then
echo "util-linux.changes is older than python-libmount.changes. Please merge changes manually and call pre-checkin.sh again."
exit 1
fi
if test util-linux.spec -ot util-linux-systemd.spec ; then
echo "util-linux.spec is older than util-linux-systemd.spec. Please merge changes manually and call pre-checkin.sh again."
exit 1
fi
if test util-linux.changes -ot util-linux-systemd.changes ; then
echo "util-linux.changes is older than util-linux-systemd.changes. Please merge changes manually and call pre-checkin.sh again."
exit 1
fi
sed '
s/spec file for package util-linux/spec file for package python-libmount/;
/^Name:/s/util-linux/python-libmount/;
s/WARNING: After editing this file please/WARNING: Never edit this file!!! Edit util-linux.spec and/
' <util-linux.spec >python-libmount.spec
sed '
s/spec file for package util-linux/spec file for package util-linux-systemd/;
/^Name:/s/util-linux/util-linux-systemd/;
s/WARNING: After editing this file please/WARNING: Never edit this file!!! Edit util-linux.spec and/
' <util-linux.spec >util-linux-systemd.spec
cp -a util-linux.changes python-libmount.changes
cp -a util-linux.changes util-linux-systemd.changes
touch util-linux.spec util-linux.changes

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

61
raw.init Normal file
View File

@ -0,0 +1,61 @@
#! /bin/sh
# Copyright (c) 1995-2001 SuSE GmbH Nuernberg, Germany.
#
# Author: Dirk Lerner <feedback@suse.de>
#
# /etc/init.d/raw
#
# and symbolic its link
#
# /usr/sbin/rcraw
#
### BEGIN INIT INFO
# Provides: raw
# Required-Start: $local_fs $remote_fs
# Required-Stop:
# Default-Start: 2 3 5
# Default-Stop: 0 1 6
# Description: raw-devices
### END INIT INFO
. /etc/rc.status
CONFIG=/etc/raw
RAW_BIN=/usr/sbin/raw
RAW_MODULE=raw
test -x $RAW_BIN || exit 5
if [ ! -f $CONFIG ];then
echo "file: $CONFIG not found"
exit 6
fi
rc_reset
case "$1" in
start)
/sbin/modprobe $RAW_MODULE && sleep 2
line=`grep -v ^# < $CONFIG`
for i in $line;do
rawdev=`echo $i | cut -f1 -d:`
rawbind=`echo $i | cut -f2- -d:`
echo -n "bind /dev/raw/$rawdev to /dev/$rawbind..."
$RAW_BIN /dev/raw/$rawdev /dev/$rawbind > /dev/null 2>&1
rc_status -v
done
;;
stop)
echo -n "to unbind the rawdevice please perform a system shutdown"
rc_failed 3
rc_status -v
;;
status)
$RAW_BIN -qa 2> /dev/null
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status}"
exit 1
;;
esac
rc_exit

View File

@ -1,17 +0,0 @@
[Unit]
Description=raw devices
After=local-fs.target remote-fs.target
[Service]
Type=oneshot
ExecStart=/bin/sh -c "\
/sbin/modprobe raw;\
/sbin/udevadm settle;\
for i in `grep -v ^# /etc/raw`; do\
rawdev=`echo $i | cut -f1 -d:`;\
rawbind=`echo $i | cut -f2- -d:`;\
/usr/sbin/raw /dev/raw/$rawdev /dev/$rawbind;\
done"
[Install]
WantedBy=multi-user.target

0
ready Normal file
View File

View File

@ -1,12 +0,0 @@
#%PAM-1.0
# This file is used by /bin/login in case of remote logins (means where
# the -h option is used
auth requisite pam_nologin.so
auth [user_unknown=ignore success=ok ignore=ignore auth_err=die default=bad] pam_securetty.so
auth include common-auth
account include common-account
password include common-password
session required pam_loginuid.so
session include common-session
session optional pam_lastlog.so nowtmp showfailed
session optional pam_mail.so standard

136
renice.8 Normal file
View File

@ -0,0 +1,136 @@
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)renice.8 8.1 (Berkeley) 6/9/93
.\"
.Dd June 9, 1993
.Dt RENICE 8
.Os BSD 4
.Sh NAME
.Nm renice
.Nd alter priority of running processes
.Sh SYNOPSIS
.Nm renice
.Ar priority
.Oo
.Op Fl p
.Ar pid ...
.Oc
.Oo
.Op Fl g
.Ar pgrp ...
.Oc
.Oo
.Op Fl u
.Ar user ...
.Oc
.Sh DESCRIPTION
.Nm Renice
alters the
scheduling priority of one or more running processes.
The following
.Ar who
parameters are interpreted as process ID's, process group
ID's, or user names.
.Nm Renice Ns 'ing
a process group causes all processes in the process group
to have their scheduling priority altered.
.Nm Renice Ns 'ing
a user causes all processes owned by the user to have
their scheduling priority altered.
By default, the processes to be affected are specified by
their process ID's.
.Pp
Options supported by
.Nm renice :
.Bl -tag -width Ds
.It Fl g
Force
.Ar who
parameters to be interpreted as process group ID's.
.It Fl u
Force the
.Ar who
parameters to be interpreted as user names.
.It Fl p
Resets the
.Ar who
interpretation to be (the default) process ID's.
.El
.Pp
For example,
.Bd -literal -offset
renice +1 987 -u daemon root -p 32
.Ed
.Pp
would change the priority of process ID's 987 and 32, and
all processes owned by users daemon and root.
.Pp
Users other than the super-user may only alter the priority of
processes they own,
and can only monotonically increase their ``nice value''
within the range 0 to
.Dv PRIO_MAX
(20).
(This prevents overriding administrative fiats.)
The super-user
may alter the priority of any process
and set the priority to any value in the range
.Dv PRIO_MIN
(\-20)
to
.Dv PRIO_MAX .
Useful priorities are:
20 (the affected processes will run only when nothing else
in the system wants to),
0 (the ``base'' scheduling priority),
anything negative (to make things go very fast).
.Sh FILES
.Bl -tag -width /etc/passwd -compact
.It Pa /etc/passwd
to map user names to user ID's
.El
.Sh SEE ALSO
.Xr getpriority 2 ,
.Xr setpriority 2
.Sh BUGS
Non super-users can not increase scheduling priorities of their own processes,
even if they were the ones that decreased the priorities in the first place.
.br
The Linux kernel (at least version 2.0.0) and linux libc (at least
version 5.2.18) does not agree entirely on what the specifics of the
systemcall interface to set nice values is. Thus causes renice to
report bogus previous nice values.
.Sh HISTORY
The
.Nm
command appeared in
.Bx 4.0 .

View File

@ -1,5 +0,0 @@
#%PAM-1.0
# Note that runuser requires only "session" setting (and for example "auth sufficient pam_rootok.so" dummy line).
auth sufficient pam_rootok.so
session include common-session
session optional pam_xauth.so

3
schedutils-1.4.0.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:84038ab2b3ea6ff4b31b46638b9ceae56aebc95742e9b75276c6e6f5465f05b1
size 15930

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ffe524be61389246a7ebb71832bf3f750834dbf8e5a38d4cc1548e267a8fb853
size 5843

38
stupid-programmer.diff Normal file
View File

@ -0,0 +1,38 @@
--- disk-utils/fsck.cramfs.c
+++ disk-utils/fsck.cramfs.c
@@ -76,16 +76,7 @@
#define PAD_SIZE 512
-#include <asm/page.h>
-#ifdef PAGE_SIZE
-#define PAGE_CACHE_SIZE ((int) PAGE_SIZE)
-#elif defined __ia64__
-#define PAGE_CACHE_SIZE (16384)
-#elif defined __alpha__
-#define PAGE_CACHE_SIZE (8192)
-#else
-#define PAGE_CACHE_SIZE (4096)
-#endif
+#define PAGE_CACHE_SIZE getpagesize() /* Stupid programmer */
/* Guarantee access to at least 8kB at a time */
#define ROMBUFFER_BITS 13
@@ -95,7 +86,7 @@
static unsigned long read_buffer_block = ~0UL;
/* Uncompressing data structures... */
-static char outbuffer[PAGE_CACHE_SIZE*2];
+static char *outbuffer; /* Stupid programmer */
z_stream stream;
#endif /* INCLUDE_FS_TESTS */
@@ -464,6 +455,8 @@
int c; /* for getopt */
int start = 0;
+ outbuffer = malloc(PAGE_CACHE_SIZE); /* Stupid programmer */
+
if (argc)
progname = argv[0];

View File

@ -1,11 +0,0 @@
# Per default, only "su -" will set a new PATH.
# If this variable is changed to "yes" (default is "no"),
# every su call will overwrite the PATH variable.
ALWAYS_SET_PATH=no
# Default path.
PATH=/usr/local/bin:/bin:/usr/bin
# Default path for a user invoking su to root.
SUPATH=/usr/sbin:/bin:/usr/bin:/sbin

View File

@ -1,8 +0,0 @@
#%PAM-1.0
auth sufficient pam_rootok.so
auth include common-auth
account sufficient pam_rootok.so
account include common-account
password include common-password
session include common-session
session optional pam_xauth.so

20
time-1.7.dif Normal file
View File

@ -0,0 +1,20 @@
--- resuse.h
+++ resuse.h
@@ -39,6 +39,9 @@
# if HAVE_WAIT3
# include <sys/resource.h>
# else
+# if defined(__linux__) && defined(__alpha__)
+# include <sys/resource.h>
+# else
/* Process resource usage structure. */
struct rusage
{
@@ -49,6 +52,7 @@
ru_oublock, ru_msgsnd, ru_msgrcv, ru_nsignals,
ru_nvcsw, ru_nivcsw;
};
+# endif
# endif
#endif

3
time-1.7.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e37ea79a253bf85a85ada2f7c632c14e481a5fd262a362f6f4fd58e68601496d
size 103066

View File

@ -0,0 +1,250 @@
--- util-linux-2.12q/fdisk/fdiskmaclabel.c
+++ util-linux-2.12q/fdisk/fdiskmaclabel.c
@@ -0,0 +1,87 @@
+/*
+ Changes:
+ Sat Mar 20 09:51:38 EST 1999 Arnaldo Carvalho de Melo <acme@conectiva.com.br>
+ Internationalization
+*/
+#include <stdio.h> /* stderr */
+#include <string.h> /* strstr */
+#include <unistd.h> /* write */
+
+#include <endian.h>
+
+#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;
+}
--- util-linux-2.12q/fdisk/fdiskmaclabel.h
+++ util-linux-2.12q/fdisk/fdiskmaclabel.h
@@ -0,0 +1,40 @@
+#include <linux/types.h> /* 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 );
--- util-linux-2.12q/fdisk/Makefile
+++ util-linux-2.12q/fdisk/Makefile
@@ -39,7 +39,7 @@
endif
endif
-cfdisk: cfdisk.o llseek.o disksize.o i386_sys_types.o $(LIB)/xstrncpy.o
+cfdisk: cfdisk.o llseek.o disksize.o i386_sys_types.o $(LIB)/xstrncpy.o
ifeq "$(HAVE_SLANG)" "yes"
$(CC) $(LDFLAGS) $^ -o $@ $(LIBSLANG)
else
@@ -55,15 +55,17 @@
rm -f activate
ln -s sfdisk activate
-fdisk: fdisk.o llseek.o disksize.o fdiskbsdlabel.o fdisksgilabel.o \
- fdisksunlabel.o fdiskaixlabel.o i386_sys_types.o partname.o
+fdisk: fdisk.o llseek.o disksize.o fdiskbsdlabel.o fdisksgilabel.o fdisksunlabel.o \
+ fdiskmaclabel.o fdiskaixlabel.o i386_sys_types.o partname.o
fdisk.o: fdisk.c fdisk.h
fdiskbsdlabel.o: fdiskbsdlabel.c fdisk.h fdiskbsdlabel.h
fdisksunlabel.o: fdisksunlabel.c fdisksunlabel.h fdisk.h
fdiskaixlabel.o: fdiskaixlabel.c fdiskaixlabel.h fdisk.h
+fdiskmaclabel.o: fdiskmaclabel.c fdiskmaclabel.h fdisk.h
+
fdisk.o cfdisk.o sfdisk.o fdiskbsdlabel.o fdisksunlabel.o \
- fdisksgilabel.o fdiskaixlabel.o i386_sys_types.o partname.o: common.h
-sfdisk: sfdisk.o disksize.o i386_sys_types.o partname.o
+ fdisksgilabel.o fdiskaixlabel.o fdiskmaclabel.o i386_sys_types.o partname.o: common.h
+sfdisk: sfdisk.o disksize.o i386_sys_types.o partname.o
install: all
$(INSTALLDIR) $(SBINDIR)
--- util-linux-2.12q/fdisk/fdisk.c
+++ util-linux-2.12q/fdisk/fdisk.c
@@ -26,6 +26,7 @@
#include "fdisksunlabel.h"
#include "fdisksgilabel.h"
#include "fdiskaixlabel.h"
+#include "fdiskmaclabel.h"
#include "../defines.h"
#ifdef HAVE_blkpg_h
@@ -165,11 +166,12 @@
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;
@@ -363,6 +365,10 @@
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"));
@@ -443,6 +449,9 @@
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 */
@@ -943,6 +952,9 @@
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)) {
@@ -2074,6 +2086,15 @@
"This will destroy the present disk contents.\n"));
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;
@@ -2404,7 +2425,11 @@
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);

View File

@ -0,0 +1,85 @@
Adds the [no]acl NFS mount option that was added to the kernel. This
change has been discussed and accepted by Trond Myklebust
<trond.myklebust@fys.uio.no> and Olaf Kirch <okir@suse.de>.
-- Andreas Gruenbacher <agruen@suse.de>
================================================================================
--- util-linux-2.12q/mount/mount.8
+++ util-linux-2.12q/mount/mount.8
@@ -1335,7 +1335,8 @@
.BR ac ,
.BR tcp ,
.BR udp ,
-.BR lock .
+.BR lock ,
+.BR acl .
For details, see
.BR nfs (5).
--- util-linux-2.12q/mount/nfs.5
+++ util-linux-2.12q/mount/nfs.5
@@ -204,6 +204,15 @@
.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
--- util-linux-2.12q/mount/nfs_mount4.h
+++ util-linux-2.12q/mount/nfs_mount4.h
@@ -51,4 +51,4 @@
#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 */
--- util-linux-2.12q/mount/nfsmount.c
+++ util-linux-2.12q/mount/nfsmount.c
@@ -216,7 +216,7 @@
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;
@@ -316,6 +316,7 @@
nocto = 0;
nolock = 0;
broken_suid = 0;
+ noacl = 0;
noac = 0;
retry = 10000; /* 10000 minutes ~ 1 week */
tcp = 0;
@@ -427,6 +428,8 @@
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: "
@@ -452,8 +455,10 @@
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);

View File

@ -0,0 +1,11 @@
--- hwclock/hwclock.c
+++ hwclock/hwclock.c
@@ -1446,7 +1446,7 @@
show = 1; /* default to show */
- if (getuid() == 0)
+ if (geteuid() == 0)
permitted = TRUE;
else {
/* program is designed to run setuid (in some situations) */

View File

@ -0,0 +1,20 @@
--- misc-utils/Makefile
+++ misc-utils/Makefile
@@ -12,7 +12,7 @@
# Where to put man pages?
MAN1= cal.1 chkdupexe.1 ddate.1 logger.1 look.1 mcookie.1 \
- namei.1 rename.1 script.1 whereis.1 hostid.1
+ namei.1 rename.1 script.1 whereis.1 hostid.1 scriptreplay.1
# Where to put binaries?
# See the "install" rule for the links. . .
@@ -20,7 +20,7 @@
BIN=
USRBIN= cal chkdupexe ddate hostid logger look mcookie \
- namei rename script whereis
+ namei rename script scriptreplay whereis
MAYBE= reset setterm

137
util-linux-2.12-hostid.diff Normal file
View File

@ -0,0 +1,137 @@
--- util-linux-2.12q/misc-utils/hostid.1
+++ util-linux-2.12q/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)
+
--- util-linux-2.12q/misc-utils/hostid.c
+++ util-linux-2.12q/misc-utils/hostid.c
@@ -0,0 +1,88 @@
+/* Program hostid. Changed on 7.10.1997 <ms@suse.de>
+ 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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+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;
+}
--- util-linux-2.12q/misc-utils/Makefile
+++ util-linux-2.12q/misc-utils/Makefile
@@ -12,14 +12,14 @@
# Where to put man pages?
MAN1= cal.1 chkdupexe.1 ddate.1 logger.1 look.1 mcookie.1 \
- namei.1 rename.1 script.1 whereis.1
+ namei.1 rename.1 script.1 whereis.1 hostid.1
# Where to put binaries?
# See the "install" rule for the links. . .
BIN=
-USRBIN= cal chkdupexe ddate logger look mcookie \
+USRBIN= cal chkdupexe ddate hostid logger look mcookie \
namei rename script whereis
MAYBE= reset setterm

View File

@ -0,0 +1,183 @@
--- util-linux-2.12q/configure
+++ util-linux-2.12q/configure
@@ -190,6 +190,7 @@
#
# H9. For raw.c: do we have <linux/raw.h>?
+# H10. For guessfstype of CD-Extra, do we have <linux/cdrom.h>?
#
if ./testincl "linux/raw.h"; then
echo "HAVE_RAW_H=yes" >> make_include
@@ -552,6 +553,12 @@
echo "HAVE_XGETTEXT=no" >> make_include
fi
+#
+# H10. For guessfstype of CD-Extra, do we have <linux/cdrom.h>
+#
+if ./testincl "linux/cdrom.h"; then
+ echo "#define HAVE_cdrom_h" >> defines.h
+fi
#
# 8. For err.c: do we have __progname?
--- util-linux-2.12q/mount/mount_guess_fstype.c
+++ util-linux-2.12q/mount/mount_guess_fstype.c
@@ -26,6 +26,9 @@
* 2001-10-26 Tim Launchbury
* added sysv magic.
*
+ * 2003-11-21 Mads Martin Joergensen <mmj@suse.de>
+ * added guessfstype support for CD-Extra
+ *
* aeb - many changes.
*
*/
@@ -37,11 +40,16 @@
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <sys/ioctl.h>
#include "linux_fs.h"
#include "mount_blkid.h"
#include "mount_guess_fstype.h"
#include "sundries.h" /* for xstrdup */
#include "nls.h"
+#include "../defines.h"
+#ifdef HAVE_cdrom_h
+#include <linux/cdrom.h>
+#endif
#define ETC_FILESYSTEMS "/etc/filesystems"
#define PROC_FILESYSTEMS "/proc/filesystems"
@@ -249,7 +257,51 @@
return 0;
/* do seeks and reads in disk order, otherwise a very short
- partition may cause a failure because of read error */
+ partition may cause a failure because of read error
+ Rearranged a tiny bit to check ext2/3 before vfat. We still
+ have to make sure it's not iso9660 first, or otherwise we
+ might bail out wrongly due to an io-error */
+
+ if (!type) {
+ /* block 0 */
+ if (lseek(fd, 0, SEEK_SET) != 0
+ || read(fd, (char *) &xsb, sizeof(xsb)) != sizeof(xsb))
+ goto try_iso9660;
+ }
+
+ if (!type) {
+ /* block 1 */
+ if (lseek(fd, 1024, SEEK_SET) != 1024 ||
+ read(fd, (char *) &sb, sizeof(sb)) != sizeof(sb))
+ goto io_error;
+
+ /* ext2 has magic in little-endian on disk, so "swapped" is
+ superfluous; however, there have existed strange byteswapped
+ PPC ext2 systems */
+ if (ext2magic(sb.e2s) == EXT2_SUPER_MAGIC ||
+ ext2magic(sb.e2s) == EXT2_PRE_02B_MAGIC ||
+ ext2magic(sb.e2s) == swapped(EXT2_SUPER_MAGIC)) {
+ type = "ext2";
+
+ /* maybe even ext3? */
+ if ((assemble4le(sb.e2s.s_feature_compat)
+ & EXT3_FEATURE_COMPAT_HAS_JOURNAL) &&
+ assemble4le(sb.e2s.s_journal_inum) != 0)
+ type = "ext3"; /* "ext3,ext2" */
+ }
+
+ else if (minixmagic(sb.ms) == MINIX_SUPER_MAGIC ||
+ minixmagic(sb.ms) == MINIX_SUPER_MAGIC2 ||
+ minixmagic(sb.ms) == MINIX2_SUPER_MAGIC ||
+ minixmagic(sb.ms) == MINIX2_SUPER_MAGIC2)
+ type = "minix";
+
+ else if (extmagic(sb.es) == EXT_SUPER_MAGIC)
+ type = "ext";
+
+ else if (vxfsmagic(sb.vs) == VXFS_SUPER_MAGIC)
+ type = "vxfs";
+ }
if (!type) {
/* block 0 */
@@ -307,40 +359,6 @@
type = "sysv";
}
- if (!type) {
- /* block 1 */
- if (lseek(fd, 1024, SEEK_SET) != 1024 ||
- read(fd, (char *) &sb, sizeof(sb)) != sizeof(sb))
- goto io_error;
-
- /* ext2 has magic in little-endian on disk, so "swapped" is
- superfluous; however, there have existed strange byteswapped
- PPC ext2 systems */
- if (ext2magic(sb.e2s) == EXT2_SUPER_MAGIC ||
- ext2magic(sb.e2s) == EXT2_PRE_02B_MAGIC ||
- ext2magic(sb.e2s) == swapped(EXT2_SUPER_MAGIC)) {
- type = "ext2";
-
- /* maybe even ext3? */
- if ((assemble4le(sb.e2s.s_feature_compat)
- & EXT3_FEATURE_COMPAT_HAS_JOURNAL) &&
- assemble4le(sb.e2s.s_journal_inum) != 0)
- type = "ext3"; /* "ext3,ext2" */
- }
-
- else if (minixmagic(sb.ms) == MINIX_SUPER_MAGIC ||
- minixmagic(sb.ms) == MINIX_SUPER_MAGIC2 ||
- minixmagic(sb.ms) == swapped(MINIX_SUPER_MAGIC2) ||
- minixmagic(sb.ms) == MINIX2_SUPER_MAGIC ||
- minixmagic(sb.ms) == MINIX2_SUPER_MAGIC2)
- type = "minix";
-
- else if (extmagic(sb.es) == EXT_SUPER_MAGIC)
- type = "ext";
-
- else if (vxfsmagic(sb.vs) == VXFS_SUPER_MAGIC)
- type = "vxfs";
- }
if (!type) {
/* block 1 */
@@ -416,8 +434,34 @@
/* block 32 */
try_iso9660:
if (lseek(fd, 0x8000, SEEK_SET) != 0x8000
- || read(fd, (char *) &isosb, sizeof(isosb)) != sizeof(isosb))
- goto io_error;
+ || read(fd, (char *) &isosb, sizeof(isosb)) != sizeof(isosb)) {
+#ifdef HAVE_cdrom_h
+ /* Try and see if we have an iso9660 data track later on */
+ char toc_header[2];
+ struct cdrom_tocentry *toc[CDROM_LEADOUT + 1];
+ int i, offset;
+
+ if (ioctl(fd, CDROMREADTOCHDR, &toc_header))
+ goto io_error;
+ for (i = toc_header[0]; i <= toc_header[1]; i++) {
+ toc[i] = malloc(sizeof(struct cdrom_tocentry));
+ memset(toc[i],0,sizeof(struct cdrom_tocentry));
+ toc[i]->cdte_track = i;
+ toc[i]->cdte_format = CDROM_LBA;
+ if(ioctl(fd,CDROMREADTOCENTRY,toc[i]))
+ goto io_error;
+ if((toc[i]->cdte_ctrl & CDROM_DATA_TRACK)) {
+ offset = 2048 * (toc[i]->cdte_addr.lba + 16);
+ if(lseek(fd, offset, SEEK_SET) != offset)
+ goto io_error;
+ if(read(fd,(char *) &isosb,sizeof(isosb))==-1)
+ goto io_error;
+ }
+ }
+#else
+ goto io_error;
+#endif
+ }
if (strncmp(isosb.hs.id, HS_STANDARD_ID, sizeof(isosb.hs.id)) == 0) {
/* "CDROM" */

View File

@ -0,0 +1,34 @@
--- util-linux-2.12q/mount/nfsmount.c
+++ util-linux-2.12q/mount/nfsmount.c
@@ -169,8 +169,20 @@
}
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,
@@ -584,7 +596,8 @@
pm_mnt = get_mountport(&mount_server_addr,
mountprog,
mountvers,
- proto,
+ 0, /* TCP or UDP: pick
+ whatever is available */
mountport,
nfs_mount_version);

View File

@ -0,0 +1,65 @@
--- disk-utils/raw.c
+++ disk-utils/raw.c
@@ -100,7 +100,7 @@
}
/*
- * It's a bind or a single query. Either way we need a raw device.
+ * It's a bind or a single query.
*/
if (optind >= argc)
@@ -108,27 +108,38 @@
raw_name = argv[optind++];
err = stat(raw_name, &statbuf);
- if (err) {
+ if (err && do_query) {
fprintf (stderr, "Cannot locate raw device '%s' (%s)\n",
raw_name, strerror(errno));
exit(2);
}
- if (!S_ISCHR(statbuf.st_mode)) {
- fprintf (stderr, "raw device '%s' is not a character dev\n",
- raw_name);
- exit(2);
- }
- if (major(statbuf.st_rdev) != RAW_MAJOR) {
- fprintf (stderr, "Device '%s' is not a raw dev\n",
- raw_name);
- exit(2);
- }
-
- raw_minor = minor(statbuf.st_rdev);
+ if (!err) {
+ if (!S_ISCHR(statbuf.st_mode)) {
+ fprintf (stderr, "raw device '%s' is not a character dev\n",
+ raw_name);
+ exit(2);
+ }
+ if (major(statbuf.st_rdev) != RAW_MAJOR) {
+ fprintf (stderr, "Device '%s' is not a raw dev\n",
+ raw_name);
+ exit(2);
+ }
- if (do_query)
- return query(raw_minor, 0);
+ raw_minor = minor(statbuf.st_rdev);
+ if (do_query)
+ return query(raw_minor, 0);
+ } else {
+ char *p;
+ p = strrchr(raw_name, '/');
+ if (p) {
+ p = strpbrk(p, "0123456789");
+ if (p)
+ raw_minor = atoi(p);
+ }
+ if (!p)
+ raw_minor = -1;
+ }
/*
* It's not a query, so we still have some parsing to do. Have

View File

@ -0,0 +1,61 @@
--- util-linux-2.12q/mount/nfs.5
+++ util-linux-2.12q/mount/nfs.5
@@ -199,11 +199,11 @@
.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 @@
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.
--- util-linux-2.12q/mount/nfsmount.c
+++ util-linux-2.12q/mount/nfsmount.c
@@ -319,7 +319,7 @@
noacl = 0;
noac = 0;
retry = 10000; /* 10000 minutes ~ 1 week */
- tcp = 0;
+ tcp = 2;
mountprog = MOUNTPROG;
mountvers = 0;
@@ -439,6 +439,8 @@
}
}
}
+
+retry_udp:
proto = (tcp) ? IPPROTO_TCP : IPPROTO_UDP;
data.flags = (soft ? NFS_MOUNT_SOFT : 0)
@@ -742,7 +744,13 @@
* '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;
}

View File

@ -0,0 +1,149 @@
--- util-linux-2.12q/mount/lomount.c
+++ util-linux-2.12q/mount/lomount.c
@@ -52,6 +52,24 @@
extern void show_all_loops(void);
extern int read_options_from_fstab(char *, char **);
+int passphrase_timeout=0;
+struct sigaction alrmact;
+
+static void
+alrmhandler() {
+ /* let the SIGINT handler do the work: */
+ kill(getpid(),SIGINT);
+ usleep(1000000);
+ kill(getpid(),SIGTERM);
+ usleep(1000000);
+ /* stubborn... */
+ exit(0);
+}
+
+
+
+
+
#if !defined(LOOP_PASSWORD_MIN_LENGTH)
# define LOOP_PASSWORD_MIN_LENGTH 20
#endif
@@ -460,6 +478,15 @@
int i, ask2;
if(!passFDnumber) {
+
+ if(passphrase_timeout) {
+ alrmact.sa_handler = &alrmhandler;
+ memset(&alrmact.sa_mask, 0, sizeof(alrmact.sa_mask));
+ alrmact.sa_flags = 0;
+ sigaction(SIGALRM, &alrmact, NULL);
+ alarm(passphrase_timeout);
+ }
+
p = getpass(_("Password: "));
ask2 = passAskTwice ? 1 : 0;
} else {
@@ -493,6 +520,15 @@
s = malloc(i + 1);
if(!s) goto nomem;
strcpy(s, p);
+
+ if(passphrase_timeout) {
+ alrmact.sa_handler = &alrmhandler;
+ memset(&alrmact.sa_mask, 0, sizeof(alrmact.sa_mask));
+ alrmact.sa_flags = 0;
+ sigaction(SIGALRM, &alrmact, NULL);
+ alarm(passphrase_timeout);
+ }
+
p = getpass(_("Retype password: "));
if(!p) goto nomem;
if(strcmp(s, p)) goto compareErr;
@@ -524,6 +560,15 @@
strcpy(s, p);
memset(p, 0, i);
if(ask2) {
+
+ if(passphrase_timeout) {
+ alrmact.sa_handler = &alrmhandler;
+ memset(&alrmact.sa_mask, 0, sizeof(alrmact.sa_mask));
+ alrmact.sa_flags = 0;
+ sigaction(SIGALRM, &alrmact, NULL);
+ alarm(passphrase_timeout);
+ }
+
p = getpass(_("Retype password: "));
if(!p) goto nomem;
if(strcmp(s, p)) {
@@ -738,7 +783,7 @@
struct loop_info64 loopinfo;
int fd, ffd, mode, i;
char *pass, *apiName = NULL;
- void (*hashFunc)(unsigned char *, int, unsigned char *, int);
+ void (*hashFunc)(unsigned char *, int, unsigned char *, int) = NULL;
unsigned char multiKeyBits[65][32];
int minPassLen = LOOP_PASSWORD_MIN_LENGTH;
int run_mkfs_command = 0;
@@ -762,8 +807,23 @@
memset (&loopinfo, 0, sizeof (loopinfo));
xstrncpy (loopinfo.lo_file_name, file, LO_NAME_SIZE);
- if (loopEncryptionType)
+ if (loopEncryptionType) {
+ if (strcasecmp(loopEncryptionType,"twofish")==0
+ && !passHashFuncName) {
+ loopinfo.lo_encrypt_type = 3; /*LO_CRYPT_FISH*/
+ loopinfo.lo_encrypt_key_size = 20;
+ passHashFuncName = strdup("rmd160");
+ fprintf(stderr,"Switching to old S.u.S.E. loop_fish2 compatibility mode.\n");
+ } else if (strcasecmp(loopEncryptionType,"twofishSL92")==0
+ && !passHashFuncName) {
+ loopinfo.lo_encrypt_type = 3; /*LO_CRYPT_FISH*/
+ loopinfo.lo_encrypt_key_size = 32;
+ passHashFuncName = strdup("sha512");
+ fprintf(stderr,"Switching to SuSE 9.2 loop_fish2 compatibility mode.\n");
+ } else {
loopinfo.lo_encrypt_type = loop_crypt_type (loopEncryptionType, &loopinfo.lo_encrypt_key_size, &apiName);
+ }
+ }
if (loopOffsetBytes)
loopinfo.lo_offset = mystrtoull(loopOffsetBytes, 1);
if (loopSizeBytes)
@@ -995,7 +1055,7 @@
%s loop_device # give info\n\
%s -a # give info of all loops\n\
%s -d loop_device # delete\n\
-options: -o offset -s sizelimit -p passwdfd -S pseed -H phash\n\
+options: -o offset -s sizelimit -p passwdfd -S pseed -H phash -t timeout\n\
-I loinit -T -K gpgkey -G gpghome -C itercountk -v -r\n"),
progname, progname, progname, progname, progname);
exit(1);
@@ -1139,7 +1199,7 @@
delete = 0;
progname = argv[0];
- while ((c = getopt(argc,argv,"aC:de:FG:H:I:K:o:p:rs:S:Tv")) != -1) {
+ while ((c = getopt(argc,argv,"aC:de:FG:H:I:K:o:p:rs:S:t:Tv")) != -1) {
switch (c) {
case 'a': /* show status of all loops */
option_a = 1;
@@ -1183,6 +1243,9 @@
case 'S': /* optional seed for passphrase */
passSeedString = optarg;
break;
+ case 't':
+ passphrase_timeout = atoi(optarg);
+ break;
case 'T': /* ask passphrase _twice_ */
passAskTwice = "T";
break;
--- util-linux-2.12q/mount/losetup.8
+++ util-linux-2.12q/mount/losetup.8
@@ -128,6 +128,9 @@
password before hashing. Using different seeds for different partitions
makes dictionary attacks slower but does not prevent them if user supplied
password is guessable. Seed is not used in multi-key mode.
+.IP "\fB\-t \fItimeout\fP"
+make the password prompt time out after \fItimeout\fP seconds have
+passed by.
.IP "\fB\-T\fP"
Asks password twice.
.IP "\fB\-v\fP"

View File

@ -0,0 +1,63 @@
--- util-linux-2.12a/mount/mount_by_label.c.old 2004-08-11 22:25:06.000000000 +0100
+++ util-linux-2.12a/mount/mount_by_label.c 2004-08-11 22:25:21.000000000 +0100
@@ -17,6 +17,8 @@
* - Added JFS v2 format support
* 2002-07-26 Luciano Chavez <lnx1138@us.ibm.com>
* - Added EVMS support
+ * 2004-08-11 Alasdair Kergon <agk@redhat.com>
+ * - Added LVM2/device-mapper support
*/
#include <stdio.h>
@@ -38,6 +40,7 @@
#define VG_DIR "/proc/lvm/VGs"
#define EVMS_VOLUME_NAME_SIZE 127
#define PROC_EVMS_VOLUMES "/proc/evms/volumes"
+#define DEVICEMAPPERDIR "/dev/mapper"
static struct uuidCache_s {
struct uuidCache_s *next;
@@ -101,6 +104,34 @@
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;
@@ -250,6 +281,8 @@
fclose(procpt);
uuidcache_init_lvm();
+
+ uuidcache_init_dm();
}
#define UUID 1

View File

@ -0,0 +1,21 @@
--- util-linux-2.12q/mount/mount.c
+++ util-linux-2.12q/mount/mount.c
@@ -1178,11 +1178,15 @@
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 = "smbfs";
if (verbose)

View File

@ -0,0 +1,24 @@
--- util-linux-2.12q/mount/swapon.c
+++ util-linux-2.12q/mount/swapon.c
@@ -160,10 +160,19 @@
static int
is_in_proc_swaps(const char *fname) {
int i;
+ struct stat stfname, stswapFile;
- for (i = 0; i < numSwaps; i++)
- if (swapFiles[i] && !strcmp(fname, swapFiles[i]))
+ stat(fname, &stfname);
+
+ 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(fname, swapFiles[i]))
return 1;
+ }
return 0;
}

View File

@ -0,0 +1,86 @@
--- util-linux-2.12q/mount/fstab.c
+++ util-linux-2.12q/mount/fstab.c
@@ -395,6 +395,7 @@
/* Flag for already existing lock file. */
static int we_created_lockfile = 0;
+static int lock_file_desc = -1;
/* Flag to indicate that signals have been set up. */
static int signals_have_been_setup = 0;
@@ -417,6 +418,8 @@
unlock_mtab (void) {
if (we_created_lockfile) {
unlink (MOUNTED_LOCK);
+ close(lock_file_desc);
+ lock_file_desc = -1;
we_created_lockfile = 0;
}
}
@@ -443,6 +446,7 @@
void
lock_mtab (void) {
+ sigset_t sigmask;
int tries = 3;
char linktargetfile[MOUNTLOCK_LINKTARGET_LTH];
@@ -467,6 +471,10 @@
signals_have_been_setup = 1;
}
+ /* Allow all signals while trying to lock mtab */
+ sigemptyset(&sigmask);
+ sigprocmask(SIG_SETMASK, &sigmask, &sigmask);
+
sprintf(linktargetfile, MOUNTLOCK_LINKTARGET, getpid ());
/* Repeat until it was us who made the link */
@@ -521,12 +529,21 @@
if (j == 0) {
/* We made the link. Now claim the lock. */
if (fcntl (fd, F_SETLK, &flock) == -1) {
+ int errsv = errno;
+ if (!tries--)
+ die(EX_FILEIO,
+ _("Can't lock lock file %s: %s\n"),
+ MOUNTED_LOCK, strerror (errsv));
if (verbose) {
- int errsv = errno;
printf(_("Can't lock lock file %s: %s\n"),
MOUNTED_LOCK, strerror (errsv));
}
- /* proceed anyway */
+ /* bummer - someone raced us to the file
+ * lock. Start all over again. */
+ unlink(MOUNTED_LOCK);
+ } else {
+ we_created_lockfile = 1;
+ lock_file_desc = fd;
}
} else {
static int tries = 0;
@@ -551,8 +568,14 @@
}
}
- close(fd);
+ /* If we created the lock file, keep the fd else
+ * our POSIX lock will go away immediately */
+ if (!we_created_lockfile)
+ close(fd);
}
+
+ /* Restore original signal mask */
+ sigprocmask(SIG_SETMASK, &sigmask, NULL);
}
/*
--- util-linux-2.12q/mount/paths.h
+++ util-linux-2.12q/mount/paths.h
@@ -7,4 +7,4 @@
#define MOUNTED_LOCK "/etc/mtab~"
#define MOUNTED_TEMP "/etc/mtab.tmp"
#endif
-#define LOCK_TIMEOUT 10
+#define LOCK_TIMEOUT 30

View File

@ -0,0 +1,55 @@
--- util-linux-2.12q/mount/lomount.c
+++ util-linux-2.12q/mount/lomount.c
@@ -73,6 +73,7 @@
#if !defined(LOOP_PASSWORD_MIN_LENGTH)
# define LOOP_PASSWORD_MIN_LENGTH 20
#endif
+#define SUSE_PASSWORD_MIN_LENGTH 8
char *passFDnumber = (char *)0;
char *passAskTwice = (char *)0;
@@ -459,7 +460,7 @@
multiKeyPass[0] = 0;
break;
}
- if(strlen(multiKeyPass[x]) < LOOP_PASSWORD_MIN_LENGTH) break;
+ if(strlen(multiKeyPass[x]) < SUSE_PASSWORD_MIN_LENGTH) break;
x++;
}
if(x == 65)
@@ -498,7 +499,7 @@
while(x < 65) {
multiKeyPass[x] = get_FD_pass(i);
if(!multiKeyPass[x]) goto nomem;
- if(strlen(multiKeyPass[x]) < LOOP_PASSWORD_MIN_LENGTH) break;
+ if(strlen(multiKeyPass[x]) < SUSE_PASSWORD_MIN_LENGTH) break;
x++;
}
if(x == 65) {
@@ -579,7 +580,7 @@
memset(p, 0, i);
}
if(i < warnLen) {
- fprintf(stderr, _("WARNING - Please use longer password (%d or more characters)\n"), LOOP_PASSWORD_MIN_LENGTH);
+ fprintf(stderr, _("WARNING - Please use longer password (%d or more characters)\n"), SUSE_PASSWORD_MIN_LENGTH);
}
strcat(s, seed);
return(s);
@@ -785,7 +786,7 @@
char *pass, *apiName = NULL;
void (*hashFunc)(unsigned char *, int, unsigned char *, int) = NULL;
unsigned char multiKeyBits[65][32];
- int minPassLen = LOOP_PASSWORD_MIN_LENGTH;
+ int minPassLen = SUSE_PASSWORD_MIN_LENGTH;
int run_mkfs_command = 0;
loopFileName = (char *)file;
@@ -900,7 +901,7 @@
break; /* out of switch(loopinfo.lo_encrypt_type) */
}
}
- pass = sGetPass (minPassLen, LOOP_PASSWORD_MIN_LENGTH);
+ pass = sGetPass (minPassLen, SUSE_PASSWORD_MIN_LENGTH);
if(!pass) goto close_fd_ffd_return1;
i = strlen(pass);
if(hashFunc == unhashed1_key_setup) {

View File

@ -0,0 +1,22 @@
--- util-linux-2.12q/MCONFIG
+++ util-linux-2.12q/MCONFIG
@@ -17,7 +17,7 @@
# Select for CPU i386 if the binaries must be able to run on an intel 386
# (by default i486 code is generated, see below)
CPU=$(shell uname -m)
-ARCH=$(shell echo $(CPU) | sed 's/i.86/intel/;s/arm.*/arm/')
+ARCH=$(shell echo $(CPU) | sed 's/i.86/intel/;s/arm.*/arm/;s/x86_64/intel/')
# If HAVE_PAM is set to "yes", then login, chfn, chsh, and newgrp
# will use PAM for authentication. Additionally, passwd will not be
@@ -137,6 +137,10 @@
else
CPUTAIL=486
endif
+ ifeq "$(CPU)" "x86_64"
+ CPUHEAD=-mcpu=
+ CPUTAIL=nocona
+ endif
CPUOPT= $(CPUHEAD)$(CPUTAIL)
OPT= -pipe -O2 $(CPUOPT) -fomit-frame-pointer
else

View File

@ -0,0 +1,249 @@
--- util-linux-2.12q/sys-utils/Makefile
+++ util-linux-2.12q/sys-utils/Makefile
@@ -8,7 +8,7 @@
# Where to put man pages?
-MAN1= arch.1 flock.1 readprofile.1
+MAN1= arch.1 flock.1 readprofile.1 ionice.1
MAN8= ctrlaltdel.8 cytune.8 dmesg.8 \
ipcrm.8 ipcs.8 renice.8 \
@@ -19,7 +19,7 @@
BIN= arch dmesg
-USRBIN= cytune flock ipcrm ipcs renice setsid
+USRBIN= cytune flock ipcrm ipcs renice setsid ionice
USRSBIN= readprofile tunelp
@@ -71,6 +71,7 @@
ctrlaltdel: ctrlaltdel.o $(LIB)/my_reboot.o
cytune.o: cytune.c cyclades.h
cytune: cytune.o
+ionice: ionice.o
ipcrm: ipcrm.o
ipcs: ipcs.o
rdev: rdev.o
--- util-linux-2.12q/sys-utils/ionice.1
+++ util-linux-2.12q/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 <axboe@suse.de>
--- util-linux-2.12q/sys-utils/ionice.c
+++ util-linux-2.12q/sys-utils/ionice.c
@@ -0,0 +1,144 @@
+/*
+ * ionice: set or get process io scheduling class and priority
+ *
+ * Copyright (C) 2005 Jens Axboe <axboe@suse.de> SUSE Labs
+ *
+ * Released under the terms of the GNU General Public License version 2
+ *
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <getopt.h>
+#include <unistd.h>
+#include <sys/ptrace.h>
+#include <sys/syscall.h>
+#include <asm/unistd.h>
+
+#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 <axboe@suse.de> (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;
+}

View File

@ -0,0 +1,29 @@
--- mount/mount.c
+++ mount/mount.c
@@ -665,6 +665,25 @@
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) {

View File

@ -0,0 +1,628 @@
--- util-linux-2.12q/mount/Makefile
+++ util-linux-2.12q/mount/Makefile
@@ -29,7 +29,7 @@
MAYBE = pivot_root swapoff
-NFS_OBJS = nfsmount.o nfsmount_xdr.o nfsmount_clnt.o
+NFS_OBJS = nfsmount.o nfsmount_xdr.o nfsmount_clnt.o nfs4mount.o
GEN_FILES = nfsmount.h nfsmount_xdr.c nfsmount_clnt.c
all: $(PROGS)
--- util-linux-2.12q/mount/mount.c
+++ util-linux-2.12q/mount/mount.c
@@ -847,8 +847,23 @@
"without support for the type `nfs'"));
#endif
}
+#ifdef HAVE_NFS
+ /*
+ * NFSv4 support
+ */
+ if (!fake && types && streq (types, "nfs4")) {
+ mnt_err = nfs4mount(spec, node, &flags, &extra_opts, &mount_opts, bg);
+ if (mnt_err)
+ return mnt_err;
+ goto nosigblock;
+#else
+ die (EX_SOFTWARE, _("mount: this version was compiled "
+ "without support for the type `nfs4'"));
+#endif
+ }
block_signals (SIG_BLOCK);
+nosigblock:
if (!fake) {
mnt5_res = guess_fstype_and_mount (spec, node, &types, flags & ~MS_NOSYS,
--- util-linux-2.12q/mount/nfs4mount.c
+++ util-linux-2.12q/mount/nfs4mount.c
@@ -0,0 +1,460 @@
+/*
+ * nfs4mount.c -- Linux NFS mount
+ * Copyright (C) 2002 Trond Myklebust <trond.myklebust@fys.uio.no>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * Note: this file based on the original nfsmount.c
+ */
+
+#include "../defines.h" /* for HAVE_rpcsvc_nfs_prot_h and HAVE_inet_aton */
+
+#include <linux/posix_types.h>
+#include <asm/posix_types.h>
+#undef __FD_CLR
+#undef __FD_SET
+#undef __FD_ISSET
+#undef __FD_ZERO
+
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <netdb.h>
+#include <time.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <sys/utsname.h>
+#include <sys/stat.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <rpc/auth.h>
+#ifdef HAVE_rpcsvc_nfs_prot_h
+#include <rpcsvc/nfs_prot.h>
+#else
+#include <linux/nfs.h>
+#define nfsstat nfs_stat
+#endif
+
+#include "sundries.h"
+
+#include "mount_constants.h"
+#include "nfs4_mount.h"
+
+#include "nls.h"
+
+#ifndef NFS_PORT
+#define NFS_PORT 2049
+#endif
+
+extern int clnt_ping(struct sockaddr_in *, const u_long, const u_long, const u_int);
+extern void rpc_strerror(void);
+
+struct {
+ char *flavour;
+ int fnum;
+} flav_map[] = {
+ { "krb5", RPC_AUTH_GSS_KRB5 },
+ { "krb5i", RPC_AUTH_GSS_KRB5I },
+ { "krb5p", RPC_AUTH_GSS_KRB5P },
+ { "lipkey", RPC_AUTH_GSS_LKEY },
+ { "lipkey-i", RPC_AUTH_GSS_LKEYI },
+ { "lipkey-p", RPC_AUTH_GSS_LKEYP },
+ { "spkm3", RPC_AUTH_GSS_SPKM },
+ { "spkm3i", RPC_AUTH_GSS_SPKMI },
+ { "spkm3p", RPC_AUTH_GSS_SPKMP },
+ { "unix", AUTH_UNIX },
+ { "sys", AUTH_SYS },
+ { "null", AUTH_NULL },
+ { "none", AUTH_NONE },
+};
+
+#define FMAPSIZE (sizeof(flav_map)/sizeof(flav_map[0]))
+#define MAX_USER_FLAVOUR 16
+
+static int parse_sec(char *sec, int *pseudoflavour)
+{
+ int i, num_flavour = 0;
+
+ for (sec = strtok(sec, ":"); sec; sec = strtok(NULL, ":")) {
+ if (num_flavour >= MAX_USER_FLAVOUR) {
+ fprintf(stderr,
+ _("mount: maximum number of security flavors "
+ "exceeded\n"));
+ return 0;
+ }
+ for (i = 0; i < FMAPSIZE; i++) {
+ if (strcmp(sec, flav_map[i].flavour) == 0) {
+ pseudoflavour[num_flavour++] = flav_map[i].fnum;
+ break;
+ }
+ }
+ if (i == FMAPSIZE) {
+ fprintf(stderr,
+ _("mount: unknown security type %s\n"), sec);
+ return 0;
+ }
+ }
+ if (!num_flavour)
+ fprintf(stderr,
+ _("mount: no security flavors passed to sec= option\n"));
+ return num_flavour;
+}
+
+static int parse_devname(char *hostdir, char **hostname, char **dirname)
+{
+ char *s;
+
+ if (!(s = strchr(hostdir, ':'))) {
+ fprintf(stderr,
+ _("mount: "
+ "directory to mount not in host:dir format\n"));
+ return -1;
+ }
+ *hostname = hostdir;
+ *dirname = s + 1;
+ *s = '\0';
+ /* Ignore all but first hostname in replicated mounts
+ until they can be fully supported. (mack@sgi.com) */
+ if ((s = strchr(hostdir, ','))) {
+ *s = '\0';
+ fprintf(stderr,
+ _("mount: warning: "
+ "multiple hostnames not supported\n"));
+ }
+ return 0;
+}
+
+static int fill_ipv4_sockaddr(const char *hostname, struct sockaddr_in *addr)
+{
+ struct hostent *hp;
+ addr->sin_family = AF_INET;
+
+ if (inet_aton(hostname, &addr->sin_addr))
+ return 0;
+ if ((hp = gethostbyname(hostname)) == NULL) {
+ fprintf(stderr, _("mount: can't get address for %s\n"),
+ hostname);
+ return -1;
+ }
+ if (hp->h_length > sizeof(struct in_addr)) {
+ fprintf(stderr,
+ _("mount: got bad hp->h_length\n"));
+ hp->h_length = sizeof(struct in_addr);
+ }
+ memcpy(&addr->sin_addr, hp->h_addr, hp->h_length);
+ return 0;
+}
+
+static int get_my_ipv4addr(char *ip_addr, int len)
+{
+ char myname[1024];
+ struct sockaddr_in myaddr;
+
+ if (gethostname(myname, sizeof(myname))) {
+ fprintf(stderr, _("mount: can't determine client address\n"));
+ return -1;
+ }
+ if (fill_ipv4_sockaddr(myname, &myaddr))
+ return -1;
+ snprintf(ip_addr, len, "%s", inet_ntoa(myaddr.sin_addr));
+ ip_addr[len-1] = '\0';
+ return 0;
+}
+
+/* Convert RPC errors into strings */
+void rpc_strerror(void)
+{
+ int cf_stat = rpc_createerr.cf_stat;
+ int cf_errno = rpc_createerr.cf_error.re_errno;
+ char *ptr, *estr = clnt_sperrno(cf_stat);
+
+ if (estr) {
+ if ((ptr = index(estr, ':')))
+ estr = ++ptr;
+
+ fprintf(stderr, "RPC Error: %d (%s )\n", cf_stat, estr);
+ if (cf_stat == RPC_SYSTEMERROR)
+ fprintf(stderr, "System Error: %d (%s)\n", cf_errno, strerror(cf_errno));
+ }
+}
+
+int
+clnt_ping(struct sockaddr_in *saddr, const u_long prog, const u_long vers,
+ const u_int prot)
+{
+ static const struct timeval TIMEOUT = { 20, 0 };
+ static const struct timeval RETRY_TIMEOUT = { 3, 0 };
+ CLIENT *clnt=NULL;
+ int sock, stat;
+ static char clnt_res;
+
+ rpc_createerr.cf_stat = stat = 0;
+ sock = RPC_ANYSOCK;
+ switch(prot) {
+ case IPPROTO_UDP:
+ clnt = clntudp_bufcreate(saddr, prog, vers,
+ RETRY_TIMEOUT, &sock,
+ RPCSMALLMSGSIZE, RPCSMALLMSGSIZE);
+ break;
+ case IPPROTO_TCP:
+ clnt = clnttcp_create(saddr, prog, vers, &sock,
+ RPCSMALLMSGSIZE, RPCSMALLMSGSIZE);
+ break;
+ default:
+ goto out_bad;
+ }
+ if (!clnt)
+ goto out_bad;
+ memset(&clnt_res, 0, sizeof(clnt_res));
+ stat = clnt_call(clnt, NULLPROC,
+ (xdrproc_t)xdr_void, (caddr_t)NULL,
+ (xdrproc_t)xdr_void, (caddr_t)&clnt_res,
+ TIMEOUT);
+ clnt_destroy(clnt);
+ close(sock);
+ if (stat != RPC_PROGVERSMISMATCH)
+ return 1;
+
+ out_bad:
+ return 0;
+}
+
+
+int nfs4mount(const char *spec, const char *node, int *flags,
+ char **extra_opts, char **mount_opts,
+ int running_bg)
+{
+ static struct nfs4_mount_data data;
+ static char hostdir[1024];
+ static char ip_addr[16] = "127.0.0.1";
+ static struct sockaddr_in server_addr;
+ static int pseudoflavour[MAX_USER_FLAVOUR];
+ int num_flavour = 0;
+
+ char *hostname, *dirname, *old_opts;
+ char new_opts[1024];
+ char *opt, *opteq;
+ char *s;
+ int val;
+ int bg, soft, intr;
+ int nocto, noac;
+ int retry;
+ int retval;
+
+ retval = EX_FAIL;
+ if (strlen(spec) >= sizeof(hostdir)) {
+ fprintf(stderr, _("mount: "
+ "excessively long host:dir argument\n"));
+ goto fail;
+ }
+ strcpy(hostdir, spec);
+ if (parse_devname(hostdir, &hostname, &dirname))
+ goto fail;
+
+ if (fill_ipv4_sockaddr(hostname, &server_addr))
+ goto fail;
+ if (get_my_ipv4addr(ip_addr, sizeof(ip_addr)))
+ goto fail;
+
+ /* add IP address to mtab options for use when unmounting */
+ s = inet_ntoa(server_addr.sin_addr);
+ old_opts = *extra_opts;
+ if (!old_opts)
+ old_opts = "";
+ if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) {
+ fprintf(stderr, _("mount: "
+ "excessively long option argument\n"));
+ goto fail;
+ }
+ snprintf(new_opts, sizeof(new_opts), "%s%saddr=%s",
+ old_opts, *old_opts ? "," : "", s);
+ *extra_opts = xstrdup(new_opts);
+
+ /* Set default options.
+ * rsize/wsize and timeo are left 0 in order to
+ * let the kernel decide.
+ */
+ memset(&data, 0, sizeof(data));
+ data.retrans = 3;
+ data.acregmin = 3;
+ data.acregmax = 60;
+ data.acdirmin = 30;
+ data.acdirmax = 60;
+ data.proto = IPPROTO_TCP;
+
+ bg = 0;
+ soft = 0;
+ intr = NFS4_MOUNT_INTR;
+ nocto = 0;
+ noac = 0;
+ retry = 10000; /* 10000 minutes ~ 1 week */
+
+ /*
+ * NFSv4 specifies that the default port should be 2049
+ */
+ server_addr.sin_port = htons(NFS_PORT);
+
+ /* parse options */
+
+ for (opt = strtok(old_opts, ","); opt; opt = strtok(NULL, ",")) {
+ if ((opteq = strchr(opt, '='))) {
+ val = atoi(opteq + 1);
+ *opteq = '\0';
+ if (!strcmp(opt, "rsize"))
+ data.rsize = val;
+ else if (!strcmp(opt, "wsize"))
+ data.wsize = val;
+ else if (!strcmp(opt, "timeo"))
+ data.timeo = val;
+ else if (!strcmp(opt, "retrans"))
+ data.retrans = val;
+ else if (!strcmp(opt, "acregmin"))
+ data.acregmin = val;
+ else if (!strcmp(opt, "acregmax"))
+ data.acregmax = val;
+ else if (!strcmp(opt, "acdirmin"))
+ data.acdirmin = val;
+ else if (!strcmp(opt, "acdirmax"))
+ data.acdirmax = val;
+ else if (!strcmp(opt, "actimeo")) {
+ data.acregmin = val;
+ data.acregmax = val;
+ data.acdirmin = val;
+ data.acdirmax = val;
+ }
+ else if (!strcmp(opt, "retry"))
+ retry = val;
+ else if (!strcmp(opt, "port"))
+ server_addr.sin_port = htons(val);
+ else if (!strcmp(opt, "proto")) {
+ if (!strncmp(opteq+1, "tcp", 3))
+ data.proto = IPPROTO_TCP;
+ else if (!strncmp(opteq+1, "udp", 3))
+ data.proto = IPPROTO_UDP;
+ else
+ printf(_("Warning: Unrecognized proto= option.\n"));
+ } else if (!strcmp(opt, "clientaddr")) {
+ if (strlen(opteq+1) >= sizeof(ip_addr))
+ printf(_("Invalid client address %s"),
+ opteq+1);
+ strncpy(ip_addr,opteq+1, sizeof(ip_addr));
+ ip_addr[sizeof(ip_addr)-1] = '\0';
+ } else if (!strcmp(opt, "sec")) {
+ num_flavour = parse_sec(opteq+1, pseudoflavour);
+ if (!num_flavour)
+ goto fail;
+ } else if (!strcmp(opt, "addr")) {
+ /* ignore */;
+ } else {
+ printf(_("unknown nfs mount parameter: "
+ "%s=%d\n"), opt, val);
+ goto fail;
+ }
+ } else {
+ val = 1;
+ if (!strncmp(opt, "no", 2)) {
+ val = 0;
+ opt += 2;
+ }
+ if (!strcmp(opt, "bg"))
+ bg = val;
+ else if (!strcmp(opt, "fg"))
+ bg = !val;
+ else if (!strcmp(opt, "soft"))
+ soft = val;
+ else if (!strcmp(opt, "hard"))
+ soft = !val;
+ else if (!strcmp(opt, "intr"))
+ intr = val;
+ else if (!strcmp(opt, "cto"))
+ nocto = !val;
+ else if (!strcmp(opt, "ac"))
+ noac = !val;
+ else {
+ if (!sloppy) {
+ printf(_("unknown nfs mount option: "
+ "%s%s\n"), val ? "" : "no", opt);
+ goto fail;
+ }
+ }
+ }
+ }
+
+ data.flags = (soft ? NFS4_MOUNT_SOFT : 0)
+ | (intr ? NFS4_MOUNT_INTR : 0)
+ | (nocto ? NFS4_MOUNT_NOCTO : 0)
+ | (noac ? NFS4_MOUNT_NOAC : 0);
+
+ if (num_flavour == 0)
+ pseudoflavour[num_flavour++] = AUTH_UNIX;
+ data.auth_flavourlen = num_flavour;
+ data.auth_flavours = pseudoflavour;
+
+ data.client_addr.data = ip_addr;
+ data.client_addr.len = strlen(ip_addr);
+
+ data.mnt_path.data = dirname;
+ data.mnt_path.len = strlen(dirname);
+
+ data.hostname.data = hostname;
+ data.hostname.len = strlen(hostname);
+ data.host_addr = (struct sockaddr *)&server_addr;
+ data.host_addrlen = sizeof(server_addr);
+
+#ifdef NFS_MOUNT_DEBUG
+ printf("rsize = %d, wsize = %d, timeo = %d, retrans = %d\n",
+ data.rsize, data.wsize, data.timeo, data.retrans);
+ printf("acreg (min, max) = (%d, %d), acdir (min, max) = (%d, %d)\n",
+ data.acregmin, data.acregmax, data.acdirmin, data.acdirmax);
+ printf("port = %d, bg = %d, retry = %d, flags = %.8x\n",
+ ntohs(server_addr.sin_port), bg, retry, data.flags);
+ printf("soft = %d, intr = %d, nocto = %d, noac = %d\n",
+ (data.flags & NFS4_MOUNT_SOFT) != 0,
+ (data.flags & NFS4_MOUNT_INTR) != 0,
+ (data.flags & NFS4_MOUNT_NOCTO) != 0,
+ (data.flags & NFS4_MOUNT_NOAC) != 0);
+
+ if (num_flavour > 0) {
+ int pf_cnt, i;
+
+ printf("sec = ");
+ for (pf_cnt = 0; pf_cnt < num_flavour; pf_cnt++) {
+ for (i = 0; i < FMAPSIZE; i++) {
+ if (flav_map[i].fnum == pseudoflavour[pf_cnt]) {
+ printf("%s", flav_map[i].flavour);
+ break;
+ }
+ }
+ printf("%s", (pf_cnt < num_flavour-1) ? ":" : "\n");
+ }
+ }
+ printf("proto = %s\n", (data.proto == IPPROTO_TCP) ? "tcp" : "udp");
+#endif
+
+ data.version = NFS4_MOUNT_VERSION;
+
+ clnt_ping(&server_addr, NFS_PROGRAM, 4, data.proto);
+ if (rpc_createerr.cf_stat) {
+ fprintf(stderr, "mount to NFS server '%s' failed.\n", data.hostname.data);
+ goto fail;
+ }
+
+ *mount_opts = (char *) &data;
+ /* clean up */
+ return 0;
+
+fail:
+ if (verbose) {
+ rpc_strerror();
+ }
+ return retval;
+}
--- util-linux-2.12q/mount/nfs4_mount.h
+++ util-linux-2.12q/mount/nfs4_mount.h
@@ -0,0 +1,82 @@
+#ifndef _LINUX_NFS4_MOUNT_H
+#define _LINUX_NFS4_MOUNT_H
+
+/*
+ * linux/include/linux/nfs4_mount.h
+ *
+ * Copyright (C) 2002 Trond Myklebust
+ *
+ * structure passed from user-space to kernel-space during an nfsv4 mount
+ */
+
+/*
+ * WARNING! Do not delete or change the order of these fields. If
+ * a new field is required then add it to the end. The version field
+ * tracks which fields are present. This will ensure some measure of
+ * mount-to-kernel version compatibility. Some of these aren't used yet
+ * but here they are anyway.
+ */
+#define NFS4_MOUNT_VERSION 1
+
+struct nfs_string {
+ unsigned int len;
+ const char* data;
+};
+
+struct nfs4_mount_data {
+ int version; /* 1 */
+ int flags; /* 1 */
+ int rsize; /* 1 */
+ int wsize; /* 1 */
+ int timeo; /* 1 */
+ int retrans; /* 1 */
+ int acregmin; /* 1 */
+ int acregmax; /* 1 */
+ int acdirmin; /* 1 */
+ int acdirmax; /* 1 */
+
+ /* see the definition of 'struct clientaddr4' in RFC3010 */
+ struct nfs_string client_addr; /* 1 */
+
+ /* Mount path */
+ struct nfs_string mnt_path; /* 1 */
+
+ /* Server details */
+ struct nfs_string hostname; /* 1 */
+ /* Server IP address */
+ unsigned int host_addrlen; /* 1 */
+ struct sockaddr* host_addr; /* 1 */
+
+ /* Transport protocol to use */
+ int proto; /* 1 */
+
+ /* Pseudo-flavours to use for authentication. See RFC2623 */
+ int auth_flavourlen; /* 1 */
+ int *auth_flavours; /* 1 */
+};
+
+/* bits in the flags field */
+/* Note: the fields that correspond to existing NFSv2/v3 mount options
+ * should mirror the values from include/linux/nfs_mount.h
+ */
+
+#define NFS4_MOUNT_SOFT 0x0001 /* 1 */
+#define NFS4_MOUNT_INTR 0x0002 /* 1 */
+#define NFS4_MOUNT_NOCTO 0x0010 /* 1 */
+#define NFS4_MOUNT_NOAC 0x0020 /* 1 */
+#define NFS4_MOUNT_STRICTLOCK 0x1000 /* 1 */
+#define NFS4_MOUNT_FLAGMASK 0xFFFF
+
+/* pseudoflavors: */
+
+#define RPC_AUTH_GSS_KRB5 390003
+#define RPC_AUTH_GSS_KRB5I 390004
+#define RPC_AUTH_GSS_KRB5P 390005
+#define RPC_AUTH_GSS_LKEY 390006
+#define RPC_AUTH_GSS_LKEYI 390007
+#define RPC_AUTH_GSS_LKEYP 390008
+#define RPC_AUTH_GSS_SPKM 390009
+#define RPC_AUTH_GSS_SPKMI 390010
+#define RPC_AUTH_GSS_SPKMP 390011
+
+#endif
--- util-linux-2.12q/mount/nfs_mount4.h
+++ util-linux-2.12q/mount/nfs_mount4.h
@@ -8,7 +8,9 @@
* so it is easiest to ignore the kernel altogether (at compile time).
*/
-#define NFS_MOUNT_VERSION 4
+#define NFS_MOUNT_VERSION 6
+#define NFS_MAX_CONTEXT_LEN 256
+
struct nfs2_fh {
char data[32];
@@ -36,6 +38,9 @@
int namlen; /* 2 */
unsigned int bsize; /* 3 */
struct nfs3_fh root; /* 4 */
+ int pseudoflavor; /* 5 */
+ char context[NFS_MAX_CONTEXT_LEN + 1]; /* 6 */
+
};
/* bits in the flags field */
@@ -52,3 +57,19 @@
#define NFS_MOUNT_NONLM 0x0200 /* 3 */
#define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */
#define NFS_MOUNT_NOACL 0x0800 /* 4 */
+#define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */
+
+/* security pseudoflavors */
+
+#ifndef AUTH_GSS_KRB5
+#define AUTH_GSS_KRB5 390003
+#define AUTH_GSS_KRB5I 390004
+#define AUTH_GSS_KRB5P 390005
+#define AUTH_GSS_LKEY 390006
+#define AUTH_GSS_LKEYI 390007
+#define AUTH_GSS_LKEYP 390008
+#define AUTH_GSS_SPKM 390009
+#define AUTH_GSS_SPKMI 390010
+#define AUTH_GSS_SPKMP 390011
+#endif
+

View File

@ -0,0 +1,14 @@
--- util-linux-2.12q/misc-utils/script.c
+++ util-linux-2.12q/misc-utils/script.c
@@ -325,9 +325,9 @@
shname = shell;
if (cflg)
- execl(shell, shname, "-c", cflg, 0);
+ execl(shell, shname, "-c", cflg, NULL);
else
- execl(shell, shname, "-i", 0);
+ execl(shell, shname, "-i", NULL);
perror(shell);
fail();

View File

@ -0,0 +1,11 @@
--- util-linux-2.12q/mount/Makefile
+++ util-linux-2.12q/mount/Makefile
@@ -110,7 +110,7 @@
$(COMPILE) $(RPC_CFLAGS) nfsmount_clnt.c
nfsmount_xdr.o: nfsmount_xdr.c
- $(COMPILE) $(RPC_CFLAGS) nfsmount_xdr.c
+ $(COMPILE) -fno-strict-aliasing $(RPC_CFLAGS) nfsmount_xdr.c
ifeq "$(HAVE_GOOD_RPC)" "yes"
nfsmount.h: nfsmount.x

View File

@ -0,0 +1,11 @@
--- mount/umount.c
+++ mount/umount.c
@@ -40,7 +40,7 @@
#include <linux/unistd.h>
#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);

View File

@ -0,0 +1,26 @@
--- 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';
}
/*

View File

@ -0,0 +1,133 @@
From: Jeff Mahoney <jeffm@suse.com>
Subject: [PATCH] mount: needs to handle special mountprog even on guessed file systems.
If the user doesn't specify -t <fstype> mount.fstype will never be called.
This patch fixes that.
Update: Fixes a bug where the mount would get added to mtab twice.
--
mount.c | 47 +++++++++++++++++++++++++++++++++++++++++------
mount_guess_fstype.c | 3 +--
2 files changed, 42 insertions(+), 8 deletions(-)
diff -rup util-linux-2.12r/mount/mount.c util-linux-2.12r.updated/mount/mount.c
--- util-linux-2.12r/mount/mount.c 2006-05-17 17:35:37.000000000 -0400
+++ util-linux-2.12r.updated/mount/mount.c 2006-05-17 17:35:17.000000000 -0400
@@ -451,6 +451,10 @@ create_mtab (void) {
unlock_mtab();
}
+static int check_special_mountprog(const char *spec, const char *node,
+ const char *type, int flags,
+ char *extra_opts, int *status);
+
/* count successful mount system calls */
static int mountcount = 0;
@@ -462,12 +466,30 @@ static int mountcount = 0;
static int
do_mount_syscall (struct mountargs *args) {
int flags = args->flags;
- int ret;
if ((flags & MS_MGC_MSK) == 0)
flags |= MS_MGC_VAL;
- ret = mount (args->spec, args->node, args->type, flags, args->data);
+ return mount (args->spec, args->node, args->type, flags, args->data);
+}
+
+/*
+ * do_mount()
+ * Mount a single file system, possibly invoking an external handler to
+ * do so. Keep track of successes.
+ * returns: 0: OK, -1: error in errno
+ */
+static int
+do_mount (struct mountargs *args) {
+ int ret;
+ if (check_special_mountprog(args->spec, args->node, args->type,
+ args->flags, args->data, &ret) == 0)
+ ret = do_mount_syscall(args);
+ else if (ret == 0) { /* set by the call */
+ mountcount++;
+ ret = 1;
+ }
+
if (ret == 0)
mountcount++;
return ret;
@@ -507,10 +529,11 @@ guess_fstype_and_mount(const char *spec,
char *p;
while((p = index(t,',')) != NULL) {
+ int ret;
*p = 0;
args.type = *types = t;
- if(do_mount_syscall (&args) == 0)
- return 0;
+ if((ret = do_mount (&args)) >= 0)
+ return ret;
t = p+1;
}
/* do last type below */
@@ -519,10 +542,10 @@ guess_fstype_and_mount(const char *spec,
if (*types || (flags & MS_REMOUNT)) {
args.type = *types;
- return do_mount_syscall (&args);
+ return do_mount (&args);
}
- return procfsloop(do_mount_syscall, &args, types);
+ return procfsloop(do_mount, &args, types);
}
/*
@@ -895,8 +918,16 @@ retry_nfs:
nosigblock:
if (!fake) {
+ int skip_mtab = 0;
mnt5_res = guess_fstype_and_mount (spec, node, &types, flags & ~MS_NOSYS,
mount_opts);
+ /* External program was executed to mount the file system, skip updating
+ * mtab. */
+ if (mnt5_res == 1) {
+ skip_mtab = 1;
+ mnt5_res = 0;
+ res = 0;
+ }
if(!mnt5_res && LoopMountAutomaticChmod && (getuid() == 0)) {
/*
* If loop was set up using random keys and new file system
@@ -907,8 +938,12 @@ nosigblock:
error (_("Error: encrypted file system chmod() failed"));
}
}
+
+ if (skip_mtab)
+ goto out;
}
+
if (fake || mnt5_res == 0) {
/* Mount succeeded, report this (if verbose) and write mtab entry. */
if (loop)
diff -rup util-linux-2.12r/mount/mount_guess_fstype.c util-linux-2.12r.updated/mount/mount_guess_fstype.c
--- util-linux-2.12r/mount/mount_guess_fstype.c 2006-05-17 17:35:37.000000000 -0400
+++ util-linux-2.12r.updated/mount/mount_guess_fstype.c 2006-05-17 17:19:44.000000000 -0400
@@ -695,9 +695,8 @@ procfsloop(int (*mount_fn)(struct mounta
printf(_("Trying %s\n"), fsname);
fflush(stdout);
}
- if ((*mount_fn) (args) == 0) {
+ if ((ret = (*mount_fn) (args)) >= 0) {
*types = fsname;
- ret = 0;
break;
} else if (errno != EINVAL &&
is_in_procfs(fsname) == 1) {

View File

@ -0,0 +1,234 @@
--- fdisk/Makefile
+++ fdisk/Makefile
@@ -39,7 +39,7 @@
endif
endif
-cfdisk: cfdisk.o llseek.o disksize.o i386_sys_types.o $(LIB)/xstrncpy.o
+cfdisk: cfdisk.o disksize.o i386_sys_types.o $(LIB)/xstrncpy.o
ifeq "$(HAVE_SLANG)" "yes"
$(CC) $(LDFLAGS) $^ -o $@ $(LIBSLANG)
else
@@ -55,7 +55,7 @@
rm -f activate
ln -s sfdisk activate
-fdisk: fdisk.o llseek.o disksize.o fdiskbsdlabel.o fdisksgilabel.o fdisksunlabel.o \
+fdisk: fdisk.o disksize.o fdiskbsdlabel.o fdisksgilabel.o fdisksunlabel.o \
fdiskmaclabel.o fdiskaixlabel.o i386_sys_types.o partname.o
fdisk.o: fdisk.c fdisk.h
fdiskbsdlabel.o: fdiskbsdlabel.c fdisk.h fdiskbsdlabel.h
--- fdisk/cfdisk.c
+++ fdisk/cfdisk.c
@@ -84,9 +84,6 @@
#include "xstrncpy.h"
#include "common.h"
-extern long long ext2_llseek(unsigned int fd, long long offset,
- unsigned int origin);
-
#define VERSION UTIL_LINUX_VERSION
#define DEFAULT_DEVICE "/dev/hda"
@@ -552,7 +549,7 @@
static void
read_sector(char *buffer, long long sect_num) {
- if (ext2_llseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)
+ if (lseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)
fatal(_("Cannot seek on disk drive"), 2);
if (read(fd, buffer, SECTOR_SIZE) != SECTOR_SIZE)
fatal(_("Cannot read disk drive"), 2);
@@ -560,7 +557,7 @@
static void
write_sector(char *buffer, long long sect_num) {
- if (ext2_llseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)
+ if (lseek(fd, sect_num*SECTOR_SIZE, SEEK_SET) < 0)
fatal(_("Cannot seek on disk drive"), 2);
if (write(fd, buffer, SECTOR_SIZE) != SECTOR_SIZE)
fatal(_("Cannot write disk drive"), 2);
@@ -587,7 +584,7 @@
long long offset;
offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE;
- if (ext2_llseek(fd, offset, SEEK_SET) == offset
+ if (lseek(fd, offset, SEEK_SET) == offset
&& read(fd, &sector, sizeof(sector)) == sizeof(sector)) {
dos_copy_to_info(p_info[i].ostype, OSTYPESZ,
sector+DOS_OSTYPE_OFFSET, DOS_OSTYPE_SZ);
@@ -672,7 +669,7 @@
offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE
+ 1024;
- if (ext2_llseek(fd, offset, SEEK_SET) == offset
+ if (lseek(fd, offset, SEEK_SET) == offset
&& read(fd, &e2fsb, sizeof(e2fsb)) == sizeof(e2fsb)
&& e2fsb.s_magic[0] + (e2fsb.s_magic[1]<<8) == EXT2_SUPER_MAGIC) {
label = e2fsb.s_volume_name;
@@ -688,7 +685,7 @@
}
offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE + 0;
- if (ext2_llseek(fd, offset, SEEK_SET) == offset
+ if (lseek(fd, offset, SEEK_SET) == offset
&& read(fd, &xfsb, sizeof(xfsb)) == sizeof(xfsb)
&& !strncmp(xfsb.s_magic, XFS_SUPER_MAGIC, 4)) {
label = xfsb.s_fname;
@@ -702,7 +699,7 @@
/* jfs? */
offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE
+ JFS_SUPER1_OFF;
- if (ext2_llseek(fd, offset, SEEK_SET) == offset
+ if (lseek(fd, offset, SEEK_SET) == offset
&& read(fd, &jfsb, sizeof(jfsb)) == sizeof(jfsb)
&& !strncmp(jfsb.s_magic, JFS_MAGIC, strlen(JFS_MAGIC))) {
label = jfsb.s_label;
@@ -716,7 +713,7 @@
/* reiserfs? */
offset = (p_info[i].first_sector + p_info[i].offset) * SECTOR_SIZE
+ REISERFS_DISK_OFFSET_IN_BYTES;
- if (ext2_llseek(fd, offset, SEEK_SET) == offset
+ if (lseek(fd, offset, SEEK_SET) == offset
&& read(fd, &reiserfsb, sizeof(reiserfsb)) == sizeof(reiserfsb)
&& has_reiserfs_magic_string(&reiserfsb, &reiserfs_is_3_6)) {
if (reiserfs_is_3_6) {
--- fdisk/fdiskbsdlabel.c
+++ fdisk/fdiskbsdlabel.c
@@ -566,7 +566,7 @@
sector = get_start_sect(xbsd_part);
#endif
- if (ext2_llseek (fd, (long long) sector * SECTOR_SIZE, SEEK_SET) == -1)
+ if (lseek (fd, (long long) sector * SECTOR_SIZE, SEEK_SET) == -1)
fatal (unable_to_seek);
if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE))
fatal (unable_to_write);
@@ -735,7 +735,7 @@
sector = 0;
#endif
- if (ext2_llseek (fd, (long long) sector * SECTOR_SIZE, SEEK_SET) == -1)
+ if (lseek (fd, (long long) sector * SECTOR_SIZE, SEEK_SET) == -1)
fatal (unable_to_seek);
if (BSD_BBSIZE != read (fd, disklabelbuffer, BSD_BBSIZE))
fatal (unable_to_read);
@@ -781,12 +781,12 @@
#if defined (__alpha__) && BSD_LABELSECTOR == 0
alpha_bootblock_checksum (disklabelbuffer);
- if (ext2_llseek (fd, (long long) 0, SEEK_SET) == -1)
+ if (lseek (fd, (long long) 0, SEEK_SET) == -1)
fatal (unable_to_seek);
if (BSD_BBSIZE != write (fd, disklabelbuffer, BSD_BBSIZE))
fatal (unable_to_write);
#else
- if (ext2_llseek (fd, (long long) sector * SECTOR_SIZE + BSD_LABELOFFSET,
+ if (lseek (fd, (long long) sector * SECTOR_SIZE + BSD_LABELOFFSET,
SEEK_SET) == -1)
fatal (unable_to_seek);
if (sizeof (struct xbsd_disklabel) != write (fd, d, sizeof (struct xbsd_disklabel)))
--- fdisk/fdisksgilabel.c
+++ fdisk/fdisksgilabel.c
@@ -379,7 +379,7 @@
*/
sgiinfo *info = fill_sgiinfo();
int infostartblock = SSWAP32(sgilabel->directory[0].vol_file_start);
- if (ext2_llseek(fd, (long long)infostartblock*
+ if (lseek(fd, (long long)infostartblock*
SECTOR_SIZE, SEEK_SET) < 0)
fatal(unable_to_seek);
if (write(fd, info, SECTOR_SIZE) != SECTOR_SIZE)
--- fdisk/llseek.c
+++ fdisk/llseek.c
@@ -13,31 +13,12 @@
extern long long ext2_llseek (unsigned int, long long, unsigned int);
#ifdef __linux__
-
-#ifdef HAVE_LLSEEK
-#include <syscall.h>
-
-#else /* HAVE_LLSEEK */
-
-#if defined(__alpha__) || defined(__ia64__) || defined(__s390x__)
-
-#define my_llseek lseek
-
-#else
-#include <linux/unistd.h> /* for __NR__llseek */
-
-static int _llseek (unsigned int, unsigned long,
- unsigned long, long long *, unsigned int);
-
-#ifdef __NR__llseek
-
-static _syscall5(int,_llseek,unsigned int,fd,unsigned long,offset_high,
- unsigned long, offset_low,long long *,result,
- unsigned int, origin)
-
-#else
+# if defined(__alpha__) || defined(__ia64__) || defined(__s390x__)
+# define my_llseek lseek
+# else
/* no __NR__llseek on compilation machine - might give it explicitly */
+# ifndef __NR__llseek
static int _llseek (unsigned int fd, unsigned long oh,
unsigned long ol, long long *result,
unsigned int origin) {
@@ -45,10 +26,10 @@
return -1;
}
-#endif
+# endif /* __NR__llseek */
static long long my_llseek (unsigned int fd, long long offset,
- unsigned int origin)
+ unsigned int origin)
{
long long result;
int retval;
--- fdisk/sfdisk.c
+++ fdisk/sfdisk.c
@@ -164,36 +164,16 @@
/*
* sseek: seek to specified sector - return 0 on failure
*
- * For >4GB disks lseek needs a > 32bit arg, and we have to use llseek.
- * On the other hand, a 32 bit sector number is OK until 2TB.
- * The routines _llseek and sseek below are the only ones that
- * know about the loff_t type.
- *
* Note: we use 512-byte sectors here, irrespective of the hardware ss.
*/
-#undef use_lseek
-#if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (__s390x__)
-#define use_lseek
-#endif
-
-#ifndef use_lseek
-static __attribute__used
-_syscall5(int, _llseek, unsigned int, fd, ulong, hi, ulong, lo,
- loff_t *, res, unsigned int, wh);
-#endif
-
static int
sseek(char *dev, unsigned int fd, unsigned long s) {
- loff_t in, out;
- in = ((loff_t) s << 9);
+ off_t in, out;
+ in = ((off_t) s << 9);
out = 1;
-#ifndef use_lseek
- if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0) {
-#else
if ((out = lseek(fd, in, SEEK_SET)) != in) {
-#endif
- perror("llseek");
+ perror("lseek");
error(_("seek error on %s - cannot seek to %lu\n"), dev, s);
return 0;
}

View File

@ -0,0 +1,32 @@
--- util-linux-2.12r/fdisk/fdisk.c.old 2006-05-11 19:20:15.000000000 -0400
+++ util-linux-2.12r/fdisk/fdisk.c 2006-05-11 19:33:44.000000000 -0400
@@ -1916,6 +1916,16 @@
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 */
@@ -1951,8 +1961,10 @@
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 {

View File

@ -0,0 +1,382 @@
--- util-linux-2.12r/fdisk/fdisk.c
+++ util-linux-2.12r/fdisk/fdisk.c
@@ -61,7 +61,7 @@
/* 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);
}
@@ -71,7 +71,7 @@
}
static void
-write_part_table_flag(char *b) {
+write_part_table_flag(unsigned char *b) {
b[510] = 0x55;
b[511] = 0xaa;
}
@@ -98,17 +98,17 @@
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);
}
@@ -120,7 +120,7 @@
* 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
@@ -134,8 +134,8 @@
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 */
@@ -154,15 +154,14 @@
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;
@@ -240,21 +239,21 @@
}
static void
-seek_sector(int fd, unsigned int secno) {
- long long offset = (long long) secno * sector_size;
- if (ext2_llseek(fd, offset, SEEK_SET) == (long long) -1)
+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);
@@ -262,11 +261,11 @@
/* 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);
@@ -274,7 +273,7 @@
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);
}
@@ -547,10 +546,10 @@
}
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;
@@ -1546,7 +1545,7 @@
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"),
@@ -1778,20 +1777,21 @@
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);
}
@@ -1799,7 +1799,7 @@
}
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;
@@ -1832,7 +1832,7 @@
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);
@@ -1845,8 +1845,8 @@
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())
@@ -1890,7 +1890,7 @@
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++) {
@@ -1909,8 +1909,8 @@
}
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);
@@ -1923,7 +1923,7 @@
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) {
@@ -1969,7 +1969,7 @@
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;
}
@@ -2228,14 +2228,14 @@
#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;
--- util-linux-2.12r/fdisk/fdisk.h
+++ util-linux-2.12r/fdisk/fdisk.h
@@ -84,8 +84,8 @@
#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;
--- util-linux-2.12r/fdisk/fdiskaixlabel.h
+++ util-linux-2.12r/fdisk/fdiskaixlabel.h
@@ -19,9 +19,10 @@
/* 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);
--- util-linux-2.12r/fdisk/fdiskmaclabel.h
+++ util-linux-2.12r/fdisk/fdiskmaclabel.h
@@ -25,9 +25,10 @@
/* 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);
--- util-linux-2.12r/fdisk/fdisksgilabel.c
+++ util-linux-2.12r/fdisk/fdisksgilabel.c
@@ -197,7 +197,7 @@
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 @@
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,
--- util-linux-2.12r/fdisk/fdisksgilabel.h
+++ util-linux-2.12r/fdisk/fdisksgilabel.h
@@ -103,8 +103,9 @@
/* 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);
--- util-linux-2.12r/fdisk/fdisksunlabel.c
+++ util-linux-2.12r/fdisk/fdisksunlabel.c
@@ -349,7 +349,7 @@
}
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")),
@@ -656,7 +656,7 @@
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"
@@ -670,7 +670,7 @@
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);
--- util-linux-2.12r/fdisk/fdisksunlabel.h
+++ util-linux-2.12r/fdisk/fdisksunlabel.h
@@ -37,8 +37,9 @@
: (__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);

View File

@ -0,0 +1,231 @@
Index: util-linux-2.12r/mount/lomount.c
===================================================================
--- util-linux-2.12r.orig/mount/lomount.c
+++ util-linux-2.12r/mount/lomount.c
@@ -46,24 +46,24 @@
#include "rmd160.h"
#include "aes.h"
+#define LO_PASS_OK EXIT_SUCCESS
+#define LO_PASS_ERR EXIT_FAILURE
+#define LO_PASS_EMPTY 5
+#define LO_PASS_SHORT 6
+
extern int verbose;
extern char *xstrdup (const char *s); /* not: #include "sundries.h" */
extern void error (const char *fmt, ...); /* idem */
extern void show_all_loops(void);
extern int read_options_from_fstab(char *, char **);
+volatile int timeout=0;
int passphrase_timeout=0;
struct sigaction alrmact;
static void
alrmhandler() {
- /* let the SIGINT handler do the work: */
- kill(getpid(),SIGINT);
- usleep(1000000);
- kill(getpid(),SIGTERM);
- usleep(1000000);
- /* stubborn... */
- exit(0);
+ timeout = 1;
}
@@ -473,11 +473,14 @@ static char *do_GPG_pipe(char *pass)
return multiKeyPass[0];
}
-static char *sGetPass(int minLen, int warnLen)
+static int sGetPass(char **pass, int minLen, int warnLen)
{
char *p, *s, *seed;
int i, ask2;
+ *pass = NULL;
+ timeout = 0;
+
if(!passFDnumber) {
if(passphrase_timeout) {
@@ -489,6 +492,9 @@ static char *sGetPass(int minLen, int wa
}
p = getpass(_("Password: "));
+ alarm(0);
+ if (timeout)
+ return LO_PASS_EMPTY;
ask2 = passAskTwice ? 1 : 0;
} else {
i = atoi(passFDnumber);
@@ -504,11 +510,13 @@ static char *sGetPass(int minLen, int wa
}
if(x == 65) {
multiKeyMode = 65;
- return multiKeyPass[0];
+ *pass = multiKeyPass[0];
+ return LO_PASS_OK;
}
if(x == 64) {
multiKeyMode = 64;
- return multiKeyPass[0];
+ *pass = multiKeyPass[0];
+ return LO_PASS_OK;
}
p = multiKeyPass[0];
}
@@ -531,6 +539,9 @@ static char *sGetPass(int minLen, int wa
}
p = getpass(_("Retype password: "));
+ alarm(0);
+ if (timeout)
+ return LO_PASS_EMPTY;
if(!p) goto nomem;
if(strcmp(s, p)) goto compareErr;
memset(s, 0, i);
@@ -538,17 +549,25 @@ static char *sGetPass(int minLen, int wa
ask2 = 0;
}
p = do_GPG_pipe(p);
- if(!p) return(NULL);
+ if(!p)
+ return LO_PASS_ERR;
if(!p[0]) {
fprintf(stderr, _("Error: gpg key file decryption failed\n"));
- return(NULL);
+ return LO_PASS_ERR;
+ }
+ if(multiKeyMode) {
+ *pass = p;
+ return LO_PASS_OK;
}
- if(multiKeyMode) return(p);
}
i = strlen(p);
+ if(i == 0) {
+ fprintf(stderr, _("Error: Empty password\n"));
+ return LO_PASS_EMPTY;
+ }
if(i < minLen) {
fprintf(stderr, _("Error: Password must be at least %d characters.\n"), minLen);
- return(NULL);
+ return LO_PASS_SHORT;
}
seed = passSeedString;
if(!seed) seed = "";
@@ -556,7 +575,7 @@ static char *sGetPass(int minLen, int wa
if(!s) {
nomem:
fprintf(stderr, _("Error: Unable to allocate memory\n"));
- return(NULL);
+ return LO_PASS_ERR;
}
strcpy(s, p);
memset(p, 0, i);
@@ -571,11 +590,14 @@ static char *sGetPass(int minLen, int wa
}
p = getpass(_("Retype password: "));
+ alarm(0);
+ if (timeout)
+ return LO_PASS_EMPTY;
if(!p) goto nomem;
if(strcmp(s, p)) {
compareErr:
fprintf(stderr, _("Error: Passwords are not identical\n"));
- return(NULL);
+ return LO_PASS_ERR;
}
memset(p, 0, i);
}
@@ -583,7 +605,8 @@ static char *sGetPass(int minLen, int wa
fprintf(stderr, _("WARNING - Please use longer password (%d or more characters)\n"), SUSE_PASSWORD_MIN_LENGTH);
}
strcat(s, seed);
- return(s);
+ *pass = s;
+ return LO_PASS_OK;
}
/* this is for compatibility with historic loop-AES version */
@@ -788,6 +811,7 @@ set_loop(const char *device, const char
unsigned char multiKeyBits[65][32];
int minPassLen = SUSE_PASSWORD_MIN_LENGTH;
int run_mkfs_command = 0;
+ int ret;
loopFileName = (char *)file;
multiKeyMode = 0;
@@ -848,8 +872,8 @@ set_loop(const char *device, const char
loopinfo.lo_encrypt_key_size = 0;
break;
case LO_CRYPT_XOR:
- pass = sGetPass (1, 0);
- if(!pass) goto close_fd_ffd_return1;
+ ret = sGetPass (&pass, 1, 0);
+ if(ret) goto close_fd_ffd_return1;
xstrncpy (loopinfo.lo_encrypt_key, pass, LO_KEY_SIZE);
loopinfo.lo_encrypt_key_size = strlen(loopinfo.lo_encrypt_key);
break;
@@ -886,6 +910,7 @@ set_loop(const char *device, const char
/* This is not compatible with gpgkey= mount option */
if(rd_wr_retry(atoi(passFDnumber), (char *)&loopinfo.lo_encrypt_key[0], LO_KEY_SIZE, 0) < 1) {
fprintf(stderr, _("Error: couldn't read binary key\n"));
+ ret = 1;
goto close_fd_ffd_return1;
}
break; /* out of switch(loopinfo.lo_encrypt_type) */
@@ -894,6 +919,7 @@ set_loop(const char *device, const char
/* WARNING! DO NOT USE RANDOM HASH TYPE ON PARTITION WITH EXISTING */
/* IMPORTANT DATA ON IT. RANDOM HASH TYPE WILL DESTROY YOUR DATA. */
if(loop_create_random_keys((char*)file, *loopro, &multiKeyBits[0][0])) {
+ ret = 1;
goto close_fd_ffd_return1;
}
memcpy(&loopinfo.lo_encrypt_key[0], &multiKeyBits[0][0], sizeof(loopinfo.lo_encrypt_key));
@@ -901,8 +927,8 @@ set_loop(const char *device, const char
break; /* out of switch(loopinfo.lo_encrypt_type) */
}
}
- pass = sGetPass (minPassLen, SUSE_PASSWORD_MIN_LENGTH);
- if(!pass) goto close_fd_ffd_return1;
+ ret = sGetPass (&pass, minPassLen, SUSE_PASSWORD_MIN_LENGTH);
+ if(ret) goto close_fd_ffd_return1;
i = strlen(pass);
if(hashFunc == unhashed1_key_setup) {
/* this is for compatibility with historic loop-AES version */
@@ -966,6 +992,7 @@ set_loop(const char *device, const char
break;
default:
fprintf (stderr, _("Error: don't know how to get key for encryption system %d\n"), loopinfo.lo_encrypt_type);
+ ret = 1;
goto close_fd_ffd_return1;
}
@@ -985,7 +1012,7 @@ close_fd_ffd_return1:
close (fd);
close_ffd_return1:
close (ffd);
- return 1;
+ return ret;
}
/* type 18 == LO_CRYPT_CRYPTOAPI */
Index: util-linux-2.12r/mount/losetup.8
===================================================================
--- util-linux-2.12r.orig/mount/losetup.8
+++ util-linux-2.12r/mount/losetup.8
@@ -143,6 +143,10 @@ displays the status of a loop device, it
is not configured and 2 if an error occurred which prevented
.B losetup
from determining the status of the device.
+When using encryption
+.B losetup
+returns 5 if the passphrase is empty or a timeout occurred and 6 if
+the passphrase is too short.
.SH FILES
.nf

View File

@ -0,0 +1,15 @@
Index: util-linux-2.12r/disk-utils/mkswap.c
===================================================================
--- util-linux-2.12r.orig/disk-utils/mkswap.c 2004-12-21 09:21:24.000000000 -0800
+++ util-linux-2.12r/disk-utils/mkswap.c 2006-10-23 17:51:24.636063632 -0700
@@ -602,9 +602,7 @@
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;

View File

@ -0,0 +1,53 @@
diff -pur util-linux-2.12r/mount.orig/fstab.c util-linux-2.12r/mount/fstab.c
--- util-linux-2.12r/mount.orig/fstab.c 2004-12-21 20:09:24.000000000 +0100
+++ util-linux-2.12r/mount/fstab.c 2005-11-10 08:53:42.000000000 +0100
@@ -296,7 +296,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;
Only in util-linux-2.12r/mount: fstab.c~
diff -pur util-linux-2.12r/mount.orig/mount_blkid.c util-linux-2.12r/mount/mount_blkid.c
--- util-linux-2.12r/mount.orig/mount_blkid.c 2004-12-22 10:54:41.000000000 +0100
+++ util-linux-2.12r/mount/mount_blkid.c 2005-11-10 08:55:00.000000000 +0100
@@ -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));
}
Only in util-linux-2.12r/mount: mount_blkid.c~
diff -pur util-linux-2.12r/mount.orig/mount_blkid.h util-linux-2.12r/mount/mount_blkid.h
--- util-linux-2.12r/mount.orig/mount_blkid.h 2004-04-13 22:00:02.000000000 +0200
+++ util-linux-2.12r/mount/mount_blkid.h 2005-11-10 08:55:21.000000000 +0100
@@ -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);
Only in util-linux-2.12r/mount: mount_blkid.h~

View File

@ -0,0 +1,58 @@
Author: Lars Mueller <lars at samba dot org>
Subject: Use cifs instead of smbfs by default if the source starts with //; minor mount man pages changes (mention cifs and point to mount.cifs man page)
Bugzilla: na
submitted upstream: yes
accepeted upstream: no
Index: util-linux-2.12r/mount/mount.8
===================================================================
--- util-linux-2.12r.orig/mount/mount.8
+++ util-linux-2.12r/mount/mount.8
@@ -367,6 +367,7 @@ currently supported include:
.IR adfs ,
.IR affs ,
.IR autofs ,
+.IR cifs ,
.IR coda ,
.IR coherent ,
.IR cramfs ,
@@ -420,8 +421,8 @@ For most types all the
program has to do is issue a simple
.IR mount (2)
system call, and no detailed knowledge of the filesystem type is required.
-For a few types however (like nfs, smbfs, ncpfs) ad hoc code is
-necessary. The nfs ad hoc code is built in, but smbfs and ncpfs
+For a few types however (like nfs, cifs, smbfs, ncpfs) ad hoc code is
+necessary. The nfs ad hoc code is built in, but cifs, smbfs, and ncpfs
have a separate mount program. In order to make it possible to
treat all types in a uniform way, mount will execute the program
.I /sbin/mount.TYPE
@@ -733,6 +734,11 @@ These options are accepted but ignored.
(However, quota utilities may react to such strings in
.IR /etc/fstab .)
+.SH "Mount options for cifs"
+See the options section of the
+.BR mount.cifs (8)
+man page (cifs-mount package must be installed).
+
.SH "Mount options for coherent"
None.
Index: util-linux-2.12r/mount/mount.c
===================================================================
--- util-linux-2.12r.orig/mount/mount.c
+++ util-linux-2.12r/mount/mount.c
@@ -1178,10 +1178,10 @@ mount_one (const char *spec, const char
"I'll assume nfs because of "
"the colon\n"));
} else if(!strncmp(spec, "//", 2)) {
- types = "smbfs";
+ types = "cifs";
if (verbose)
printf(_("mount: no type was given - "
- "I'll assume smbfs because of "
+ "I'll assume cifs because of "
"the // prefix\n"));
}
}

View File

@ -0,0 +1,29 @@
--- mount/mount.c
+++ mount/mount.c
@@ -805,6 +805,7 @@
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;
@@ -913,13 +914,17 @@
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;

View File

@ -0,0 +1,15 @@
--- mount/mount.8
+++ mount/mount.8
@@ -1781,6 +1781,12 @@
.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.

View File

@ -0,0 +1,18 @@
Index: util-linux-2.12r/mount/nfsmount.c
===================================================================
--- util-linux-2.12r.orig/mount/nfsmount.c
+++ util-linux-2.12r/mount/nfsmount.c
@@ -305,8 +305,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.

View File

@ -0,0 +1,31 @@
--- util-linux-2.12r/mount/mount.c
+++ util-linux-2.12r/mount/mount.c
@@ -927,17 +927,6 @@
block_signals (SIG_UNBLOCK);
-#ifdef HAVE_NFS
- if (mnt_err && types && streq (types, "nfs")) {
- if (nfs_mount_version == 4 && mnt_err != EBUSY && mnt_err != ENOENT) {
- if (verbose)
- printf(_("mount: failed with nfs mount version 4, trying 3..\n"));
- nfs_mount_version = 3;
- goto retry_nfs;
- }
- }
-#endif
-
/* Mount failed, complain, but don't die. */
if (types == 0) {
--- util-linux-2.12r/mount/nfsmount.c
+++ util-linux-2.12r/mount/nfsmount.c
@@ -76,7 +76,7 @@
#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r))
-#define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2)
+#define MAX_NFSPROT 3
static int
linux_version_code(void) {

View File

@ -0,0 +1,12 @@
--- mount/swapon.c
+++ mount/swapon.c
@@ -50,6 +50,9 @@
#define QUIET 1
+#undef PAGE_SIZE
+#define PAGE_SIZE sysconf(_SC_PAGESIZE)
+
int all = 0;
int verbose = 0;
int priority = -1; /* non-prioritized swap by default */

View File

@ -0,0 +1,118 @@
Index: util-linux-2.12r/Makefile
===================================================================
--- util-linux-2.12r.orig/Makefile
+++ util-linux-2.12r/Makefile
@@ -18,7 +18,8 @@ SUBDIRS=po \
fdisk \
hwclock \
sys-utils \
- text-utils
+ text-utils \
+ partx
.PHONEY: all install clean now
all: defines.h
@@ -43,7 +44,7 @@ install:
clean:
-rm -f *.o *~ omake conftest conftest.c core
- @for subdir in $(SUBDIRS) partx; do \
+ @for subdir in $(SUBDIRS); do \
(cd $$subdir && $(MAKE) $@) || exit 1; \
done
Index: util-linux-2.12r/partx/partx.c
===================================================================
--- util-linux-2.12r.orig/partx/partx.c
+++ util-linux-2.12r/partx/partx.c
@@ -38,6 +38,8 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/hdreg.h> /* HDIO_GETGEO */
+/* workaround for __user in header file */
+#define __user
#include <linux/blkpg.h>
#define BLKGETSIZE _IO(0x12,96) /* return device size */
@@ -333,29 +335,13 @@ xmalloc (size_t size) {
/*
* sseek: seek to specified sector
*/
-#if !defined (__alpha__) && !defined (__ia64__) && !defined (__s390x__) && !defined(__x86_64__)
-#define NEED__llseek
-#endif
-
-#ifdef NEED__llseek
-#include <linux/unistd.h> /* _syscall */
-static
-_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo,
- long long *, res, uint, wh);
-#endif
-
static int
sseek(int fd, unsigned int secnr) {
long long in, out;
in = ((long long) secnr << 9);
out = 1;
-#ifdef NEED__llseek
- if (_llseek (fd, in>>32, in & 0xffffffff, &out, SEEK_SET) != 0
- || out != in)
-#else
if ((out = lseek(fd, in, SEEK_SET)) != in)
-#endif
{
fprintf(stderr, "llseek error\n");
return -1;
Index: util-linux-2.12r/partx/addpart.c
===================================================================
--- util-linux-2.12r.orig/partx/addpart.c
+++ util-linux-2.12r/partx/addpart.c
@@ -3,6 +3,8 @@
#include <fcntl.h>
#include <stdlib.h>
#include <sys/ioctl.h>
+/* workaround for __user in header file */
+#define __user
#include <linux/blkpg.h>
int
Index: util-linux-2.12r/partx/delpart.c
===================================================================
--- util-linux-2.12r.orig/partx/delpart.c
+++ util-linux-2.12r/partx/delpart.c
@@ -3,6 +3,8 @@
#include <fcntl.h>
#include <stdlib.h>
#include <sys/ioctl.h>
+/* workaround for __user in header file */
+#define __user
#include <linux/blkpg.h>
int
Index: util-linux-2.12r/partx/Makefile
===================================================================
--- util-linux-2.12r.orig/partx/Makefile
+++ util-linux-2.12r/partx/Makefile
@@ -1,7 +1,12 @@
+include ../MCONFIG
+
OBJ = bsd.o dos.o partx.o solaris.o unixware.o gpt.o crc32.o
CFLAGS += -Wall
+SBIN=
+
+SBIN:=$(SBIN) partx
-all: addpart delpart partx
+all: addpart delpart $(SBIN)
partx: $(OBJ)
@@ -13,3 +18,7 @@ clean:
rm -f $(OBJ) addpart.o delpart.o addpart delpart partx *~
$(OBJ): partx.h
+
+install: all
+ $(INSTALLDIR) $(SBINDIR)
+ $(INSTALLBIN) $(SBIN) $(SBINDIR)

View File

@ -0,0 +1,19 @@
--- util-linux-2.12a/disk-utils/raw.c.=K0000=.orig
+++ util-linux-2.12a/disk-utils/raw.c
@@ -31,6 +31,7 @@
#endif
#define DEVFS_RAWCTLDEV "/dev/raw/rawctl"
+#define RAW_NR_MINORS 4096
char * progname;
int do_query = 0;
@@ -94,7 +95,7 @@ int main(int argc, char *argv[])
if (do_query_all) {
if (optind < argc)
usage(1);
- for (i=1; i<255; i++)
+ for (i = 1; i < RAW_NR_MINORS; i++)
query(i, 1);
exit(0);
}

View File

@ -0,0 +1,45 @@
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 */

View File

@ -0,0 +1,114 @@
--- mount/nfsmount.c.orig 2006-03-17 19:42:33.000000000 +1100
+++ mount/nfsmount.c 2006-03-17 19:56:55.000000000 +1100
@@ -119,8 +119,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;
@@ -320,7 +322,6 @@ int nfsmount(const char *spec, const cha
#if NFS_MOUNT_VERSION >= 2
data.namlen = NAME_MAX;
#endif
-
bg = 0;
soft = 0;
intr = 0;
@@ -402,6 +403,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);
@@ -474,6 +507,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;
@@ -510,6 +548,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;
@@ -717,6 +758,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));

View File

@ -0,0 +1,51 @@
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-2.12r/mount/nfs.5
===================================================================
--- util-linux-2.12r.orig/mount/nfs.5
+++ util-linux-2.12r/mount/nfs.5
@@ -128,7 +128,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
@@ -193,9 +193,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

View File

@ -0,0 +1,11 @@
--- mount/umount.c
+++ mount/umount.c
@@ -724,7 +724,7 @@
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);

86
util-linux-2.12r.diff Normal file
View File

@ -0,0 +1,86 @@
--- util-linux-2.12q/configure
+++ util-linux-2.12q/configure
@@ -59,7 +59,7 @@
CC=${CC-cc}
CFLAGS=${CFLAGS-"-O2"}
-LDFLAGS=${LDFLAGS-"-s"}
+LDFLAGS=${LDFLAGS-""}
echo CC=$CC >> make_include
echo CFLAGS=$CFLAGS >> make_include
echo LDFLAGS=$LDFLAGS >> make_include
--- util-linux-2.12q/MCONFIG
+++ util-linux-2.12q/MCONFIG
@@ -22,7 +22,7 @@
# If HAVE_PAM is set to "yes", then login, chfn, chsh, and newgrp
# will use PAM for authentication. Additionally, passwd will not be
# installed as it is not PAM aware.
-HAVE_PAM=no
+HAVE_PAM=yes
# If HAVE_SELINUX is set to "yes", the login will make sure the user is
# logged into an appropriate security context
@@ -35,7 +35,7 @@
# If HAVE_PASSWD is set to "yes", then passwd will not be built or
# installed from the login-utils subdirectory.
-HAVE_PASSWD=no
+HAVE_PASSWD=yes
# If you use chfn and chsh from this package, REQUIRE_PASSWORD will require
# non-root users to enter the account password before updating /etc/passwd.
@@ -59,7 +59,7 @@
# not be built or installed from the login-utils subdirectory. (The
# shutdown and init from the SysVinit package do not depend on the last,
# mesg, and wall from that package.)
-HAVE_SYSVINIT_UTILS=yes
+HAVE_SYSVINIT_UTILS=no
# If HAVE_WRITE is set to "yes", then write will not be built or
# installed from the misc-utils subdirectory.
@@ -77,7 +77,7 @@
# user's tty to "tty" [The login in util-linux does this correctly, and
# xterm will do it correctly if X is compiled with USE_TTY_GROUP set
# properly.]
-USE_TTY_GROUP=yes
+USE_TTY_GROUP=no
# If HAVE_KILL is set to "yes", then kill will not be built or
# installed from the misc-utils subdirectory.
@@ -141,7 +141,7 @@
OPT= -pipe -O2 $(CPUOPT) -fomit-frame-pointer
else
ifeq "$(ARCH)" "arm"
- OPT= -pipe -O2 -fsigned-char -fomit-frame-pointer
+ OPT= -pipe -O2 -fomit-frame-pointer
else
OPT= -O2 -fomit-frame-pointer
endif
@@ -220,7 +220,7 @@
INSTALLBIN= $(INSTALL) -m $(BINMODE)
INSTALLMAN= $(INSTALL) -m $(MANMODE)
INSTALLDAT= $(INSTALL) -m $(DATMODE)
-INSTALLSUID= $(INSTALL) -m $(SUIDMODE) -o root
+INSTALLSUID= $(INSTALL) -m $(SUIDMODE)
ifeq "$(DISABLE_NLS)" "yes"
NLSFLAGS = -DDISABLE_NLS
--- util-linux-2.12q/mount/filesystems
+++ util-linux-2.12q/mount/filesystems
@@ -0,0 +1,5 @@
+vfat
+hfs
+minix
+reiserfs
+*
--- util-linux-2.12q/mount/linux_fs.h
+++ util-linux-2.12q/mount/linux_fs.h
@@ -19,7 +19,7 @@
#define MINIX2_SUPER_MAGIC2 0x2478 /* minix v2, 30 char names */
struct minix_super_block {
u_char s_dummy[16];
- u_char s_magic[2];
+ short s_magic[2];
};
#define minixmagic(s) assemble2le(s.s_magic)

3
util-linux-2.12r.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b8e499b338ce9fbd1fb315194b26540ec823c0afc46c9e145ac7a3e38ad57e6b
size 1370907

View File

@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAABCAAGBQJZMUBLAAoJEOS3HV7sOcKEr9IP/i90Hc8Tiukh8Hlap02p4uWa
t083KEdi79a7H7vhCKNPjM8bkeod8F5/I+61uhSc9r4QoEpKX0vk8UU69NVK3gn1
RntwmuXjZB4ZR+aDN6vmp3uuZlPEMG6em8dgiO+Gjy61xRGw9Krxo6+jyTvTzouT
bZsPy3JnVRXg0toawyR39ScRjGiLjb5P+3KMoJK8R6MUbkOMCgAN73yx6UHBkzb3
n0zAALs10Y4OfYaIA4R+mcq4AKvPPsb/eCXTia75aThv/uFvdEpXK2wDYeUmjJmH
eVqTU2zYrhWvueu3FW7suAx/6o+ijGWD8ROu9Dd6sHnUK9mGLomxfxTthh2UlBES
23ZJBLLoIDPL+aUKq3EYeIsqLMf4eRaRUb5VIHwEZwcMqWvSvVZJGlk0WR3SzhfQ
UCAGWEE6ifQskVg6QbAZe8qFybbiTcH5onqKUJ2DlDiP53Kk8+0YKxhkNLulFoU1
XrN0hqRP7z2BtlrSzhGt25heExfnMMIelpiqYb2jVtbXV9s5/0jKZT4x2CRFhZ86
EHKvN1W0gtzMD1ZOLVEj1MaopS68TvmLooxf+x4Ns5GPGMReILWqwNWklwqXFGjs
P91JD3l6opcoUMO2xjVpVIcH6oLhXeLfAFEmUggrdmk/Jm4kjYQZAUi1ByWrJg30
3fOzxEEoirUWP5cZoV5B
=8KFU
-----END PGP SIGNATURE-----

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c208a4ff6906cb7f57940aa5bc3a6eed146e50a7cc0a092f52ef2ab65057a08d
size 4478016

View File

@ -0,0 +1,523 @@
--- MCONFIG
+++ MCONFIG
@@ -138,8 +138,8 @@
CPUTAIL=486
endif
ifeq "$(CPU)" "x86_64"
- CPUHEAD=-mcpu=
- CPUTAIL=nocona
+ CPUHEAD=-mtune=
+ CPUTAIL=k8
endif
CPUOPT= $(CPUHEAD)$(CPUTAIL)
OPT= -pipe -O2 $(CPUOPT) -fomit-frame-pointer
@@ -151,7 +151,7 @@
endif
endif
-WARNFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes
+WARNFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -g
LIB=../lib
--- configure
+++ configure
@@ -754,3 +754,23 @@
echo "You don't have blkid"
fi
rm -f conftest conftest.c
+
+#
+# 16. For mount, do we have libvolume_id?
+#
+echo '
+#include <stdlib.h>
+#include <libvolume_id.h>
+int main(){ exit(0); volume_id_close(NULL); }
+' > conftest.c
+LIBS="-lvolume_id"
+eval $compile
+LIBS=
+if test -s conftest; then
+ echo "HAVE_VOLID=yes" >> make_include
+ echo "You have libvolume_id"
+else
+ echo "HAVE_VOLID=no" >> make_include
+ echo "You don't have libvolume_id"
+fi
+rm -f conftest conftest.c
--- mount/Makefile
+++ mount/Makefile
@@ -1,7 +1,7 @@
include ../make_include
include ../MCONFIG
-DEFINES = -DHAVE_NFS $(BLKID_DEFINE)
+DEFINES = -DHAVE_NFS $(BLKID_DEFINE) $(VOLID_DEFINE)
RPCSVCDIR = rpcsvc
RPC_CFLAGS = -Wno-unused
@@ -25,6 +25,11 @@
BLKID_LIB = -lblkid -luuid
endif
+ifeq "$(HAVE_VOLID)" "yes"
+VOLID_DEFINE = -DHAVE_VOLID
+VOLID_LIB = -lvolume_id
+endif
+
PROGS = $(SUID_PROGS) $(NOSUID_PROGS)
MAYBE = pivot_root swapoff
@@ -48,23 +53,25 @@
mount: mount.o fstab.o sundries.o xmalloc.o realpath.o mntent.o version.o \
get_label_uuid.o mount_by_label.o mount_blkid.o mount_guess_fstype.o \
+ mount_udev.o \
getusername.o $(LIB)/setproctitle.o $(LIB)/env.o $(NFS_OBJS) lomount.o \
loumount.o loop.o sha512.o rmd160.o aes.o $(LIB)/xstrncpy.o
- $(LINK) $^ -o $@ $(BLKID_LIB)
+ $(LINK) $^ -o $@ $(BLKID_LIB) $(VOLID_LIB)
umount: umount.o fstab.o sundries.o xmalloc.o realpath.o mntent.o \
getusername.o get_label_uuid.o mount_by_label.o mount_blkid.o \
- version.o $(LIB)/env.o loumount.o
- $(LINK) $^ -o $@ $(BLKID_LIB)
+ mount_udev.o version.o $(LIB)/env.o loumount.o
+ $(LINK) $^ -o $@ $(BLKID_LIB) $(VOLID_LIB)
guessfstype: guessfstype.o mount_guess_fstype.o sundries.o realpath.o \
fstab.o mntent.o get_label_uuid.o mount_blkid.o mount_by_label.o \
- xmalloc.o
- $(LINK) $^ -o $@
+ mount_udev.o xmalloc.o
+ $(LINK) $^ -o $@ $(VOLID_LIB)
swapon: swapon.o version.o xmalloc.o \
- get_label_uuid.o mount_by_label.o mount_blkid.o loop.o sha512.o $(LIB)/xstrncpy.o
- $(LINK) $^ -o $@ $(BLKID_LIB)
+ get_label_uuid.o mount_by_label.o mount_blkid.o mount_udev.o \
+ loop.o sha512.o $(LIB)/xstrncpy.o
+ $(LINK) $^ -o $@ $(BLKID_LIB) $(VOLID_LIB)
main_losetup.o: lomount.c
$(COMPILE) -DMAIN lomount.c -o $@
@@ -142,7 +149,7 @@
clean:
rm -f a.out core *~ *.o swapargs.h $(PROGS) $(MAYBE)
- rm -f nfs_mountversion.h
+ rm -f nfs_mountversion.h nfsmount_clnt.c nfsmount.h nfsmount_xdr.c
clobber distclean realclean: clean
rm -f $(GEN_FILES)
--- mount/fstab.c
+++ mount/fstab.c
@@ -305,6 +305,7 @@
/* Find the entry (SPEC,FILE) in fstab */
struct mntentchn *
getfsspecfile (const char *spec, const char *file) {
+ char *nspec;
struct mntentchn *mc, *mc0;
mc0 = fstab_head();
@@ -316,11 +317,12 @@
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 */
@@ -357,11 +359,21 @@
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;
}
--- mount/mount.c
+++ mount/mount.c
@@ -1667,7 +1667,7 @@
use only for testing purposes -
the guessing is not reliable at all */
{
- char *fstype;
+ const char *fstype;
fstype = do_guess_fstype(optarg);
printf("%s\n", fstype ? fstype : "unknown");
exit(fstype ? 0 : EX_FAIL);
@@ -1738,6 +1738,8 @@
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);
--- mount/mount_blkid.c
+++ mount/mount_blkid.c
@@ -1,6 +1,7 @@
#include <stdio.h>
#include "mount_blkid.h"
+#ifndef HAVE_VOLID
#ifdef HAVE_BLKID
blkid_cache blkid;
@@ -119,3 +120,4 @@
#endif
+#endif
--- mount/mount_blkid.h
+++ mount/mount_blkid.h
@@ -11,3 +11,5 @@
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);
--- mount/mount_by_label.c
+++ mount/mount_by_label.c
@@ -1,4 +1,4 @@
-#ifndef HAVE_BLKID
+#if (!defined HAVE_BLKID) && (!defined HAVE_VOLID)
/*
* mount_by_label.c - aeb
*
--- mount/mount_guess_fstype.c
+++ mount/mount_guess_fstype.c
@@ -54,9 +54,23 @@
#define ETC_FILESYSTEMS "/etc/filesystems"
#define PROC_FILESYSTEMS "/proc/filesystems"
+#ifdef HAVE_VOLID
+
+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_BLKID
-char *
+const char *
do_guess_fstype(const char *device)
{
return blkid_get_tag_value(blkid, "TYPE", device);
@@ -208,7 +222,7 @@
return (sum == p[511]);
}
-char *
+const char *
do_guess_fstype(const char *device) {
int fd;
char *type = NULL;
@@ -536,7 +550,7 @@
}
#endif
-
+#endif
static struct tried {
struct tried *next;
char *type;
@@ -578,9 +592,9 @@
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);
--- /dev/null 2006-06-02 17:12:45.000000000 +0200
+++ mount/mount_udev.c 2006-06-12 11:14:42.285154088 +0200
@@ -0,0 +1,237 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/mount.h>
+#include <sys/ioctl.h>
+#include <nls.h>
+#include <stddef.h>
+#include <libvolume_id.h>
+
+#include "mount_blkid.h"
+
+#ifdef HAVE_VOLID
+
+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
--- mount/mount_guess_fstype.h
+++ 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);

View File

@ -1,156 +0,0 @@
From a60cc5c2eeaad7ea5ea0c4a74cc4af5e2dc3f6c2 Mon Sep 17 00:00:00 2001
From: Ruediger Meier <ruediger.meier@ga-group.nl>
Date: Tue, 4 Apr 2017 16:29:58 +0200
Subject: [PATCH]
util-linux-losetup-Add-support-for-setting-logical-blocksize.patch
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
include/loopdev.h | 5 ++++-
lib/loopdev.c | 20 ++++++++++++++++++++
sys-utils/losetup.c | 19 +++++++++++++++----
3 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/include/loopdev.h b/include/loopdev.h
index 953d2db..7c783bf 100644
--- a/include/loopdev.h
+++ b/include/loopdev.h
@@ -41,6 +41,7 @@ enum {
LO_FLAGS_AUTOCLEAR = 4, /* kernel >= 2.6.25 */
LO_FLAGS_PARTSCAN = 8, /* kernel >= 3.2 */
LO_FLAGS_DIRECT_IO = 16, /* kernel >= 4.2 */
+ LO_FLAGS_BLOCKSIZE = 32, /* Tentative */
};
#define LO_NAME_SIZE 64
@@ -120,7 +121,8 @@ enum {
LOOPDEV_FL_NOIOCTL = (1 << 6),
LOOPDEV_FL_DEVSUBDIR = (1 << 7),
LOOPDEV_FL_CONTROL = (1 << 8), /* system with /dev/loop-control */
- LOOPDEV_FL_SIZELIMIT = (1 << 9)
+ LOOPDEV_FL_SIZELIMIT = (1 << 9),
+ LOOPDEV_FL_BLOCKSIZE = (1 << 10)
};
/*
@@ -173,6 +175,7 @@ int loopcxt_set_offset(struct loopdev_cxt *lc, uint64_t offset);
int loopcxt_set_sizelimit(struct loopdev_cxt *lc, uint64_t sizelimit);
int loopcxt_set_flags(struct loopdev_cxt *lc, uint32_t flags);
int loopcxt_set_backing_file(struct loopdev_cxt *lc, const char *filename);
+int loopcxt_set_blocksize(struct loopdev_cxt *lc, uint64_t blocksize);
extern char *loopcxt_get_backing_file(struct loopdev_cxt *lc);
extern int loopcxt_get_backing_devno(struct loopdev_cxt *lc, dev_t *devno);
diff --git a/lib/loopdev.c b/lib/loopdev.c
index fd4f166..b85e2ce 100644
--- a/lib/loopdev.c
+++ b/lib/loopdev.c
@@ -1115,6 +1115,26 @@ int loopcxt_set_backing_file(struct loopdev_cxt *lc, const char *filename)
}
/*
+ * @lc: context
+ * @blocksize: logical blocksize for the device
+ *
+ * The setting is removed by loopcxt_set_device() loopcxt_next()!
+ *
+ * Returns: 0 on success, <0 on error.
+ */
+int loopcxt_set_blocksize(struct loopdev_cxt *lc, uint64_t blocksize)
+{
+ if (!lc)
+ return -EINVAL;
+
+ lc->info.lo_init[0] = blocksize;
+ lc->info.lo_flags |= LO_FLAGS_BLOCKSIZE;
+
+ DBG(CXT, ul_debugobj(lc, "set blocksize=%llu", (long long unsigned int)lc->info.lo_init[0]));
+ return 0;
+}
+
+/*
* In kernels prior to v3.9, if the offset or sizelimit options
* are used, the block device's size won't be synced automatically.
* blockdev --getsize64 and filesystems will use the backing
diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c
index 2218d3b..d8f1bfa 100644
--- a/sys-utils/losetup.c
+++ b/sys-utils/losetup.c
@@ -399,6 +399,7 @@ static void usage(FILE *out)
fputs(USAGE_SEPARATOR, out);
fputs(_(" -o, --offset <num> start at offset <num> into file\n"), out);
fputs(_(" --sizelimit <num> device is limited to <num> bytes of the file\n"), out);
+ fputs(_(" --logical-blocksize <size> set the logical block size to <size>\n"), out);
fputs(_(" -P, --partscan create a partitioned loop device\n"), out);
fputs(_(" -r, --read-only set up a read-only loop device\n"), out);
fputs(_(" --direct-io[=<on|off>] open backing file with O_DIRECT\n"), out);
@@ -448,7 +449,8 @@ static void warn_size(const char *filename, uint64_t size)
static int create_loop(struct loopdev_cxt *lc,
int nooverlap, int lo_flags, int flags,
- const char *file, uint64_t offset, uint64_t sizelimit)
+ const char *file, uint64_t offset, uint64_t sizelimit,
+ uint64_t blocksize)
{
int hasdev = loopcxt_has_device(lc);
int rc = 0;
@@ -534,6 +536,8 @@ static int create_loop(struct loopdev_cxt *lc,
loopcxt_set_offset(lc, offset);
if (flags & LOOPDEV_FL_SIZELIMIT)
loopcxt_set_sizelimit(lc, sizelimit);
+ if (flags & LOOPDEV_FL_BLOCKSIZE)
+ loopcxt_set_blocksize(lc, blocksize);
if (lo_flags)
loopcxt_set_flags(lc, lo_flags);
if ((rc = loopcxt_set_backing_file(lc, file))) {
@@ -562,7 +566,7 @@ int main(int argc, char **argv)
struct loopdev_cxt lc;
int act = 0, flags = 0, no_overlap = 0, c;
char *file = NULL;
- uint64_t offset = 0, sizelimit = 0;
+ uint64_t offset = 0, sizelimit = 0, blocksize = 0;
int res = 0, showdev = 0, lo_flags = 0;
char *outarg = NULL;
int list = 0;
@@ -572,7 +576,8 @@ int main(int argc, char **argv)
OPT_SIZELIMIT = CHAR_MAX + 1,
OPT_SHOW,
OPT_RAW,
- OPT_DIO
+ OPT_DIO,
+ OPT_BLOCKSIZE,
};
static const struct option longopts[] = {
{ "all", no_argument, NULL, 'a' },
@@ -585,6 +590,7 @@ int main(int argc, char **argv)
{ "associated", required_argument, NULL, 'j' },
{ "json", no_argument, NULL, 'J' },
{ "list", no_argument, NULL, 'l' },
+ { "logical-blocksize", required_argument, NULL, OPT_BLOCKSIZE },
{ "noheadings", no_argument, NULL, 'n' },
{ "offset", required_argument, NULL, 'o' },
{ "output", required_argument, NULL, 'O' },
@@ -658,6 +664,10 @@ int main(int argc, char **argv)
act = A_SHOW;
file = optarg;
break;
+ case OPT_BLOCKSIZE:
+ blocksize = strtosize_or_err(optarg, _("failed to parse logical block size"));
+ flags |= LOOPDEV_FL_BLOCKSIZE;
+ break;
case 'l':
list = 1;
break;
@@ -790,7 +800,8 @@ int main(int argc, char **argv)
switch (act) {
case A_CREATE:
- res = create_loop(&lc, no_overlap, lo_flags, flags, file, offset, sizelimit);
+ res = create_loop(&lc, no_overlap, lo_flags, flags, file, offset,
+ sizelimit, blocksize);
if (res == 0) {
if (showdev)
printf("%s\n", loopcxt_get_device(&lc));
--
1.8.5.6

View File

@ -1,85 +0,0 @@
From c972852b29391c35b1d5c7d3e1e6413e0cc86908 Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Tue, 13 Jun 2017 12:15:11 +0200
Subject: [PATCH] lscpu: cleanup DMI detection return codes
Michal wrote:
There is weird mix of logic in lscpu-dmi.c which sometimes returns 0 and
sometimes -1 on error. Since most checks are if (rc) goto done; this
bails out early on error skipping some detection methods. Further, in
lscpu.c all following detections are guarder by if(hyper) so returning
-1 causes all following methods to be skipped.
Reported-by: Michal Suchanek <msuchanek@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
---
sys-utils/lscpu-dmi.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/sys-utils/lscpu-dmi.c b/sys-utils/lscpu-dmi.c
index 3ba999124a2e..4b845b97ccd9 100644
--- a/sys-utils/lscpu-dmi.c
+++ b/sys-utils/lscpu-dmi.c
@@ -174,7 +174,7 @@ done:
static int hypervisor_decode_legacy(uint8_t *buf, const char *devmem)
{
if (!checksum(buf, 0x0F))
- return HYPER_NONE;
+ return -1;
return hypervisor_from_dmi_table(DWORD(buf + 0x08), WORD(buf + 0x06),
WORD(buf + 0x0C),
@@ -254,11 +254,15 @@ int read_hypervisor_dmi(void)
|| sizeof(uint16_t) != 2
|| sizeof(uint32_t) != 4
|| '\0' != 0)
- return rc;
+ goto done;
+ /* -1 : no DMI in /sys,
+ * 0 : DMI exist, nothing detected (HYPER_NONE)
+ * >0 : hypervisor detected
+ */
rc = hypervisor_decode_sysfw();
- if (rc >= 0)
- return rc;
+ if (rc >= HYPER_NONE)
+ goto done;
/* First try EFI (ia64, Intel-based Mac) */
switch (address_from_efi(&fp)) {
@@ -273,8 +277,9 @@ int read_hypervisor_dmi(void)
goto done;
rc = hypervisor_decode_smbios(buf, _PATH_DEV_MEM);
- if (rc)
+ if (rc >= HYPER_NONE)
goto done;
+
free(buf);
buf = NULL;
memory_scan:
@@ -287,17 +292,17 @@ memory_scan:
for (fp = 0; fp <= 0xFFF0; fp += 16) {
if (memcmp(buf + fp, "_SM_", 4) == 0 && fp <= 0xFFE0) {
rc = hypervisor_decode_smbios(buf + fp, _PATH_DEV_MEM);
- if (rc == -1)
+ if (rc < 0)
fp += 16;
} else if (memcmp(buf + fp, "_DMI_", 5) == 0)
rc = hypervisor_decode_legacy(buf + fp, _PATH_DEV_MEM);
- if (rc >= 0)
+ if (rc >= HYPER_NONE)
break;
}
#endif
done:
free(buf);
- return rc;
+ return rc < 0 ? HYPER_NONE : rc;
}
--
2.12.3

11
util-linux-nfs-timeo.diff Normal file
View File

@ -0,0 +1,11 @@
--- util-linux-2.12q/mount/nfsmount.c
+++ util-linux-2.12q/mount/nfsmount.c
@@ -489,7 +489,7 @@
/* 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",

11
util-linux-nfs.8.diff Normal file
View File

@ -0,0 +1,11 @@
--- 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.

View File

@ -0,0 +1,14 @@
Index: util-linux-2.12/mount/mount.8
===================================================================
--- util-linux-2.12.orig/mount/mount.8
+++ util-linux-2.12/mount/mount.8
@@ -572,6 +572,9 @@ until the network has been enabled on th
Do not update inode access times on this file system (e.g, for faster
access on the news spool to speed up news servers).
.TP
+.B nodiratime
+Do not update directory inode access times on this filesystem.
+.TP
.B noauto
Can only be mounted explicitly (i.e., the
.B \-a

View File

@ -0,0 +1,88 @@
mount/mount.8 | 7 +++++++
mount/mount.c | 15 +++++++++++++--
mount/mount_constants.h | 3 +++
3 files changed, 23 insertions(+), 2 deletions(-)
Index: util-linux-2.12r/mount/mount.8
===================================================================
--- util-linux-2.12r.orig/mount/mount.8
+++ util-linux-2.12r/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).
@@ -599,6 +603,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-2.12r/mount/mount.c
===================================================================
--- util-linux-2.12r.orig/mount/mount.c
+++ util-linux-2.12r/mount/mount.c
@@ -162,9 +162,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_speed, *opt_comment;
@@ -265,6 +270,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
@@ -958,9 +967,11 @@ nosigblock:
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-2.12r/mount/mount_constants.h
===================================================================
--- util-linux-2.12r.orig/mount/mount_constants.h
+++ util-linux-2.12r/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.
*/

View File

@ -1,14 +0,0 @@
addFilter("init-script-without-%stop_on_removal-preun /etc/init.d/raw")
addFilter("init-script-without-%restart_on_update-postun /etc/init.d/raw")
addFilter("incoherent-init-script-name raw")
addFilter("no-reload-entry /etc/init.d/raw")
# There is no egrep(1) used -> False positive
addFilter("deprecated-grep")
# Both pam configs for su and su-l are marked as noreplace
addFilter(".*W:.*files-duplicate.*/pam/su.*/pam.d/su-l.*")
# Useless warning as the /usr/bin variants are known
addFilter(".*W:.*permissions-symlink.*/bin/su.*")
addFilter(".*W:.*permissions-symlink.*/bin/umount.*")
addFilter(".*W:.*permissions-symlink.*/bin/mount.*")
# UGLY HACK: rpmlint falsely declares problems with files-attr-not-set
addFilter("W: files-attr-not-set")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More