PATCH: mount-2.5g (was Re: striped swapping?)

Andreas Koppenhoefer (koppenas@koppenas.dialup.informatik.uni-stuttgart.de)
1 May 1996 19:35:21 +0200


-----BEGIN PGP SIGNED MESSAGE-----

In article <Pine.LNX.3.91.960425140955.7415C-100000@igor.girton.cam.ac.uk>
Steve Payne <srp20@cam.ac.uk> writes:

If I have two swap partitions on two separate hard drives (on separate
busses) under linux is the swapper clever enough to strip (even corsely
(sp?)) bewteen them? (I'm guessing you _can_ have more than one swap
partition active at once).

As someone else already answered, you need a newer mount-package.
Some days ago I've got mount-2.5g.tar.gz (possibly from
ftp.win.tue.nl:/pub/linux/util/). Unfortunately it's not ready for
using priority option on mount commands.

After applying the following patch to mount-2.5g it should work. At
least it works for me (linux-1.3.91, libc-5.2.16). My /etc/fstab
contains following swap entries...
/dev/sdb2 none swap pri=20 0 0
/dev/sda2 none swap pri=20 0 0
/dev/hda2 none swap pri=10 0 0

Read my patched man page for more details. Do 'make realclean' before
compiling.

BTW: Who is the maintainer of mount-2.X ?

- - Andreas

PS: I apologize posting non-kernel-patches to kernel mailing list, but
I think the patch valuable enough.

diff -u -r mount-2.5g/sundries.h mount-2.5g-patched/sundries.h
- --- mount-2.5g/sundries.h Sat Oct 7 02:32:06 1995
+++ mount-2.5g-patched/sundries.h Wed Apr 24 10:53:17 1996
@@ -16,13 +16,10 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
- -#include <unistd.h>

- -#if 0
#include <linux/version.h>
#if LINUX_VERSION_CODE >= 0x010302
#define SUPPORT_PRIORITIES
- -#endif
#endif

#ifdef SUPPORT_PRIORITIES
diff -u -r mount-2.5g/swapon.c mount-2.5g-patched/swapon.c
- --- mount-2.5g/swapon.c Sat Oct 7 02:32:07 1995
+++ mount-2.5g-patched/swapon.c Wed Apr 24 10:53:24 1996
@@ -5,6 +5,16 @@

#include "sundries.h"

+/* we cannot include unistd.h since it may contain old swapon
+ prototypes with wrong number of arguments. Therefore we declare
+ swapon and swapoff here. */
+#ifdef SUPPORT_PRIORITIES
+extern int swapon __P ((__const char *__path, __const int priority));
+#else
+extern int swapon __P ((__const char *__path));
+#endif
+extern int swapoff __P ((__const char *__specialfile));
+
/* Nonzero for chatty (-v). This is a nonstandard flag (not in BSD). */
int verbose = 0;
#ifdef SUPPORT_PRIORITIES
@@ -35,7 +45,7 @@
const char *usage_string = "\
usage: %s [-hV]\n\
%s -a [-v]\n\
- - %s [-v] [-p priority] special ...\n\
+ %s [-v] special ...\n\
";
#endif

@@ -65,6 +75,8 @@
#ifdef SUPPORT_PRIORITIES
flags = 0;
if (prio >= 0) {
+ if (prio > SWAP_FLAG_PRIO_MASK)
+ prio = SWAP_FLAG_PRIO_MASK;
flags = SWAP_FLAG_PREFER
| ((prio & SWAP_FLAG_PRIO_MASK) << SWAP_FLAG_PRIO_SHIFT);
}
diff -u -r mount-2.5g/swapon.8 mount-2.5g-patched/swapon.8
- --- mount-2.5g/swapon.8 Sat Oct 7 02:32:07 1995
+++ mount-2.5g-patched/swapon.8 Wed Apr 24 11:12:35 1996
@@ -75,12 +75,21 @@
.I /etc/fstab
are made available.
.TP
- -.BI \-p " priority"
+.B \-p " priority"
Specify priority for
.BR swapon .
This option is only available if
- -.B swapon
+.BR swapon
was compiled under and is used under a 1.3.2 or later kernel.
+.I priority
+is a value between 0 and 32767. See
+.BR swapon "(2)
+for a full description of swap priorities. Add
+.BR pri=value
+to the option field of
+.I /etc/fstab
+for use with
+.BR "swapon -a"
.PP
.B Swapoff
disables swapping on the specified devices and files, or on all swap
diff -r -u mount-2.5g/Makefile mount-2.5g-patched/Makefile
- --- mount-2.5g/Makefile Mon Feb 26 04:20:14 1996
+++ mount-2.5g-patched/Makefile Wed Apr 24 13:22:27 1996
@@ -7,25 +7,33 @@
include ../MCONFIG
endif

- -#CC = gcc
- -#OPTFLAGS= -O2 -m486 -fomit-frame-pointer
+CC = gcc
+OPTFLAGS= -O2 -m486 -fomit-frame-pointer
##OPTFLAGS= -O2 -fomit-frame-pointer # or change on make's command line
- -#CFLAGS = -pipe $(OPTFLAGS)
+CFLAGS = -pipe $(OPTFLAGS)
WARNFLAGS = -Wall -Wstrict-prototypes -Wmissing-prototypes
- -#LDFLAGS = -s -N
+LDFLAGS = -s -N
LDLIBS =
+ifeq (/usr/include/rpcsvc/mount.x,$(wildcard /usr/include/rpcsvc/mount.x))
+RPCSVCDIR = /usr/include/rpcsvc
+else
RPCSVCDIR = rpcsvc
- -RPC_CFLAGS = -Wno-unused
+endif
+RPC_CFLAGS = -Wno-unused
RPCGEN = rpcgen
- -#INSTALL = install
- -#INSTALL_SUID = $(INSTALL) -m 4755 -o root
- -#INSTALL_PROG = $(INSTALL) -m 755
- -#INSTALL_DATA = $(INSTALL) -m 644
+INSTALL = install
+INSTALLSUID = $(INSTALL) -m 4755 -o root
+INSTALLPROG = $(INSTALL) -m 755
+INSTALLDATA = $(INSTALL) -m 644
+INSTALLDIR = mkdir -p
+INSTALLMAN = $(INSTALLDATA)
+
+MANDIR = /usr/man

## for suid progs (mount, umount)
- -#BINDIR = /bin
+BINDIR = /bin
## for nosuid progs (swapon)
- -#SBINDIR = /etc
+SBINDIR = /sbin

# End of configuration section.

@@ -51,11 +59,11 @@
install: $(PROGS)
$(INSTALLDIR) $(BINDIR) $(SBINDIR)
$(INSTALLSUID) -s $(SUID_PROGS) $(BINDIR)
- - $(INSTALLBIN) -s $(NOSUID_PROGS) $(SBINDIR)
+ $(INSTALLPROG) -s $(NOSUID_PROGS) $(SBINDIR)
(cd $(SBINDIR); ln -sf swapon swapoff)
- - $(INSTALLDIR) $(MAN5DIR) $(MAN8DIR)
- - $(INSTALLMAN) $(MAN5) $(MAN5DIR)
- - $(INSTALLMAN) $(MAN8) $(MAN8DIR)
+ $(INSTALLDIR) $(MANDIR)/man5 $(MANDIR)/man8
+ $(INSTALLMAN) $(MAN5) $(MANDIR)/man5
+ $(INSTALLMAN) $(MAN8) $(MANDIR)/man8

%.o: %.c
$(COMPILE) $<
@@ -80,17 +88,29 @@
mount_xdr.o: mount_xdr.c
$(COMPILE) $(RPC_CFLAGS) mount_xdr.c

- -mount.h mount_xdr.c mount_clnt.c: mount.x
- - rm -f mount.h mount_xdr.c mount_clnt.c
+mount.h: mount.x
+ rm -f mount.h
$(RPCGEN) -h -o mount.h mount.x
+
+mount_xdr.c: mount.x
+ rm -f mount_xdr.c
$(RPCGEN) -c -o mount_xdr.c mount.x
- - $(RPCGEN) -l -o mount_clnt.c mount.x
+
+mount_clnt.c: mount.x
+ rm -f mount_clnt.tmp.c
+ $(RPCGEN) -l -o mount_clnt.tmp.c mount.x
+ # patch mount_clnt.c to keep gcc from complaining about
+ # passing args with incompatible pointer types
+ patch -s < mount_clnt.c.patch
+ mv mount_clnt.tmp.c mount_clnt.c

mount.x:
cp $(RPCSVCDIR)/mount.x .

clean:
- - rm -f a.out core *~ *.o $(PROGS)
+ rm -f a.out core *~ *.o *.orig *.tmp $(PROGS)

clobber: clean
- - rm -f $(PROGS) $(GEN_FILES)
+ rm -f $(GEN_FILES)
+
+realclean: clobber
- --- /dev/null Mon Jul 18 01:46:18 1994
+++ mount-2.5g-patched/mount_clnt.c.patch Wed Apr 24 12:31:42 1996
@@ -0,0 +1,86 @@
+--- mount_clnt.tmp.c.orig Wed Apr 24 12:30:49 1996
++++ mount_clnt.tmp.c Wed Apr 24 12:31:12 1996
+@@ -15,7 +15,10 @@
+ static char clnt_res;
+
+ memset((char *)&clnt_res, 0, sizeof(clnt_res));
+- if (clnt_call(clnt, MOUNTPROC_NULL, xdr_void, argp, xdr_void, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
++ if (clnt_call(clnt, MOUNTPROC_NULL,
++ (xdrproc_t) xdr_void, argp,
++ (xdrproc_t) xdr_void, &clnt_res,
++ TIMEOUT) != RPC_SUCCESS) {
+ return (NULL);
+ }
+ return ((void *)&clnt_res);
+@@ -27,7 +30,10 @@
+ static fhstatus clnt_res;
+
+ memset((char *)&clnt_res, 0, sizeof(clnt_res));
+- if (clnt_call(clnt, MOUNTPROC_MNT, xdr_dirpath, argp, xdr_fhstatus, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
++ if (clnt_call(clnt, MOUNTPROC_MNT,
++ (xdrproc_t) xdr_dirpath, argp,
++ (xdrproc_t) xdr_fhstatus, &clnt_res,
++ TIMEOUT) != RPC_SUCCESS) {
+ return (NULL);
+ }
+ return (&clnt_res);
+@@ -39,7 +45,10 @@
+ static mountlist clnt_res;
+
+ memset((char *)&clnt_res, 0, sizeof(clnt_res));
+- if (clnt_call(clnt, MOUNTPROC_DUMP, xdr_void, argp, xdr_mountlist, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
++ if (clnt_call(clnt, MOUNTPROC_DUMP,
++ (xdrproc_t) xdr_void, argp,
++ (xdrproc_t) xdr_mountlist, &clnt_res,
++ TIMEOUT) != RPC_SUCCESS) {
+ return (NULL);
+ }
+ return (&clnt_res);
+@@ -51,7 +60,10 @@
+ static char clnt_res;
+
+ memset((char *)&clnt_res, 0, sizeof(clnt_res));
+- if (clnt_call(clnt, MOUNTPROC_UMNT, xdr_dirpath, argp, xdr_void, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
++ if (clnt_call(clnt, MOUNTPROC_UMNT,
++ (xdrproc_t) xdr_dirpath, argp,
++ (xdrproc_t) xdr_void, &clnt_res,
++ TIMEOUT) != RPC_SUCCESS) {
+ return (NULL);
+ }
+ return ((void *)&clnt_res);
+@@ -63,7 +75,10 @@
+ static char clnt_res;
+
+ memset((char *)&clnt_res, 0, sizeof(clnt_res));
+- if (clnt_call(clnt, MOUNTPROC_UMNTALL, xdr_void, argp, xdr_void, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
++ if (clnt_call(clnt, MOUNTPROC_UMNTALL,
++ (xdrproc_t) xdr_void, argp,
++ (xdrproc_t) xdr_void, &clnt_res,
++ TIMEOUT) != RPC_SUCCESS) {
+ return (NULL);
+ }
+ return ((void *)&clnt_res);
+@@ -75,7 +90,10 @@
+ static exports clnt_res;
+
+ memset((char *)&clnt_res, 0, sizeof(clnt_res));
+- if (clnt_call(clnt, MOUNTPROC_EXPORT, xdr_void, argp, xdr_exports, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
++ if (clnt_call(clnt, MOUNTPROC_EXPORT,
++ (xdrproc_t) xdr_void, argp,
++ (xdrproc_t) xdr_exports, &clnt_res,
++ TIMEOUT) != RPC_SUCCESS) {
+ return (NULL);
+ }
+ return (&clnt_res);
+@@ -87,7 +105,10 @@
+ static exports clnt_res;
+
+ memset((char *)&clnt_res, 0, sizeof(clnt_res));
+- if (clnt_call(clnt, MOUNTPROC_EXPORTALL, xdr_void, argp, xdr_exports, &clnt_res, TIMEOUT) != RPC_SUCCESS) {
++ if (clnt_call(clnt, MOUNTPROC_EXPORTALL,
++ (xdrproc_t) xdr_void, argp,
++ (xdrproc_t) xdr_exports, &clnt_res,
++ TIMEOUT) != RPC_SUCCESS) {
+ return (NULL);
+ }
+ return (&clnt_res);

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2i
Comment: Processed by Mailcrypt 3.3, an Emacs/PGP interface

iQBVAwUBMYSCRkVdjNvyndGpAQHuqAIA1UDNifpxji0X6RvikrBFCsmRzIDE2bv2
TSAJQoP27aumGuj3RnwhmjBSxRJPQ126VqY89HpvJvtvUWk7Av2lsQ==
=Q1jm
-----END PGP SIGNATURE-----

-- 
Andreas Koppenhoefer, Student der Universitaet Stuttgart, BR Deutschland 
prefered languages: German, English, C, Perl ("Just another Perl hacker,")
EMail:  koppenas@informatik.uni-stuttgart.de            (university address)
        Andreas.Koppenhoefer@studbox.uni-stuttgart.de   (alternate address)
	akoppenhoefer@schweinfurt.netsurf.de            (private address)
privat: Franz-Schubert-Str. 2, 97616 Bad Neustadt, Germany
        Belaustr. 5, 70195 Stuttgart, Germany
phone:  +49 9771 7943 (9-21h MEZ=GMT+1), +49 711 694111 (19-22h MEZ=GMT+1)