summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--boot/tcattr.c592
-rw-r--r--libdiskfs/opts-runtime-parse.c30
-rw-r--r--libnetfs/parse-runtime-options.c30
-rw-r--r--libnetfs/unparse-runtime-options.c33
-rw-r--r--libtrivfs/handle-port.c48
-rw-r--r--nfs/pager.c456
6 files changed, 0 insertions, 1189 deletions
diff --git a/boot/tcattr.c b/boot/tcattr.c
deleted file mode 100644
index fcd3293e..00000000
--- a/boot/tcattr.c
+++ /dev/null
@@ -1,592 +0,0 @@
-/* Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
-
-The GNU C Library is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
-
-The GNU C Library 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
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA. */
-
-#include <errno.h>
-#include <stddef.h>
-#include <termios.h>
-
-#undef B0
-#undef B50
-#undef B75
-#undef B110
-#undef B134
-#undef B150
-#undef B200
-#undef B300
-#undef B600
-#undef B1200
-#undef B1800
-#undef B2400
-#undef B4800
-#undef B9600
-#undef B19200
-#undef B38400
-#undef EXTA
-#undef EXTB
-#undef ECHO
-#undef TOSTOP
-#undef NOFLSH
-#undef MDMBUF
-#undef FLUSHO
-#undef PENDIN
-#undef CERASE
-#undef CKILL
-#undef CINTR
-#undef CQUIT
-#undef CSTART
-#undef CSTOP
-#undef CEOF
-#undef CEOT
-#undef CBRK
-#undef CSUSP
-#undef CDSUSP
-#undef CRPRNT
-#undef CFLUSH
-#undef CWERASE
-#undef CLNEXT
-#undef CSTATUS
-#undef CERASE
-#undef CKILL
-#undef CINTR
-#undef CQUIT
-#undef CSTART
-#undef CSTOP
-#undef CEOF
-#undef CEOT
-#undef CBRK
-#undef CSUSP
-#undef CDSUSP
-#undef CRPRNT
-#undef CFLUSH
-#undef CWERASE
-#undef CLNEXT
-#undef CSTATUS
-#undef CERASE
-#undef CKILL
-#undef CINTR
-#undef CQUIT
-#undef CSTART
-#undef CSTOP
-#undef CEOF
-#undef CEOT
-#undef CBRK
-#undef CSUSP
-#undef CDSUSP
-#undef CRPRNT
-#undef CFLUSH
-#undef CWERASE
-#undef CLNEXT
-#undef CSTATUS
-#undef CERASE
-#undef CKILL
-#undef CINTR
-#undef CQUIT
-#undef CSTART
-#undef CSTOP
-#undef CEOF
-#undef CEOT
-#undef CBRK
-#undef CSUSP
-#undef CDSUSP
-#undef CRPRNT
-#undef CFLUSH
-#undef CWERASE
-#undef CLNEXT
-#undef CSTATUS
-#undef CERASE
-#undef CKILL
-#undef CINTR
-#undef CQUIT
-#undef CSTART
-#undef CSTOP
-#undef CEOF
-#undef CEOT
-#undef CBRK
-#undef CSUSP
-#undef CDSUSP
-#undef CRPRNT
-#undef CFLUSH
-#undef CWERASE
-#undef CLNEXT
-#undef CSTATUS
-#undef CERASE
-#undef CKILL
-#undef CINTR
-#undef CQUIT
-#undef CSTART
-#undef CSTOP
-#undef CEOF
-#undef CEOT
-#undef CBRK
-#undef CSUSP
-#undef CDSUSP
-#undef CRPRNT
-#undef CFLUSH
-#undef CWERASE
-#undef CLNEXT
-#undef CSTATUS
-#undef CERASE
-#undef CKILL
-#undef CINTR
-#undef CQUIT
-#undef CSTART
-#undef CSTOP
-#undef CEOF
-#undef CEOT
-#undef CBRK
-#undef CSUSP
-#undef CDSUSP
-#undef CRPRNT
-#undef CFLUSH
-#undef CWERASE
-#undef CLNEXT
-#undef CSTATUS
-#undef CERASE
-#undef CKILL
-#undef CINTR
-#undef CQUIT
-#undef CSTART
-#undef CSTOP
-#undef CEOF
-#undef CEOT
-#undef CBRK
-#undef CSUSP
-#undef CDSUSP
-#undef CRPRNT
-#undef CFLUSH
-#undef CWERASE
-#undef CLNEXT
-#undef CSTATUS
-#undef CERASE
-#undef CKILL
-#undef CINTR
-#undef CQUIT
-#undef CSTART
-#undef CSTOP
-#undef CEOF
-#undef CEOT
-#undef CBRK
-#undef CSUSP
-#undef CDSUSP
-#undef CRPRNT
-#undef CFLUSH
-#undef CWERASE
-#undef CLNEXT
-#undef CSTATUS
-#undef CERASE
-#undef CKILL
-#undef CINTR
-#undef CQUIT
-#undef CSTART
-#undef CSTOP
-#undef CEOF
-#undef CEOT
-#undef CBRK
-#undef CSUSP
-#undef CDSUSP
-#undef CRPRNT
-#undef CFLUSH
-#undef CWERASE
-#undef CLNEXT
-#undef CSTATUS
-#undef CERASE
-#undef CKILL
-#undef CINTR
-#undef CQUIT
-#undef CSTART
-#undef CSTOP
-#undef CEOF
-#undef CEOT
-#undef CBRK
-#undef CSUSP
-#undef CDSUSP
-#undef CRPRNT
-#undef CFLUSH
-#undef CWERASE
-#undef CLNEXT
-#undef CSTATUS
-#undef CERASE
-#undef CKILL
-#undef CINTR
-#undef CQUIT
-#undef CSTART
-#undef CSTOP
-#undef CEOF
-#undef CEOT
-#undef CBRK
-#undef CSUSP
-#undef CDSUSP
-#undef CRPRNT
-#undef CFLUSH
-#undef CWERASE
-#undef CLNEXT
-#undef CSTATUS
-
-#define IOCPARM_MASK 0x7f
-#define IOC_OUT 0x40000000
-#define IOC_IN 0x80000000
-#define _IOR(x,y,t) (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
-#define _IOW(x,y,t) (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
-#define FIONREAD _IOR('f', 127, int)
-#define FIOASYNC _IOW('f', 125, int)
-#define TIOCGETP _IOR('t', 8, struct sgttyb)
-#define TIOCLGET _IOR('t', 124, int)
-#define TIOCLSET _IOW('t', 125, int)
-#define TIOCSETN _IOW('t', 10, struct sgttyb)
-#define TIOCSETP _IOW('t', 9,struct sgttyb)/* set parameters -- stty */
-#define TIOCFLUSH _IOW('t', 16, int) /* flush buffers */
-#define TIOCSETC _IOW('t',17,struct tchars)/* set special characters */
-#define TIOCGETC _IOR('t',18,struct tchars)/* get special characters */
-#define TANDEM 0x00000001 /* send stopc on out q full */
-#define CBREAK 0x00000002 /* half-cooked mode */
-#define LCASE 0x00000004 /* simulate lower case */
-#define ECHO 0x00000008 /* echo input */
-#define CRMOD 0x00000010 /* map \r to \r\n on output */
-#define RAW 0x00000020 /* no i/o processing */
-#define ODDP 0x00000040 /* get/send odd parity */
-#define EVENP 0x00000080 /* get/send even parity */
-#define ANYP 0x000000c0 /* get any parity/send none */
-#define PRTERA 0x00020000 /* \ ... / erase */
-#define CRTERA 0x00040000 /* " \b " to wipe out char */
-#define TILDE 0x00080000 /* hazeltine tilde kludge */
-#define MDMBUF 0x00100000 /* start/stop output on carrier intr */
-#define LITOUT 0x00200000 /* literal output */
-#define TOSTOP 0x00400000 /* SIGSTOP on background output */
-#define FLUSHO 0x00800000 /* flush output to terminal */
-#define NOHANG 0x01000000 /* no SIGHUP on carrier drop */
-#define L001000 0x02000000
-#define CRTKIL 0x04000000 /* kill line with " \b " */
-#define PASS8 0x08000000
-#define CTLECH 0x10000000 /* echo control chars as ^X */
-#define PENDIN 0x20000000 /* tp->t_rawq needs reread */
-#define DECCTQ 0x40000000 /* only ^Q starts after ^S */
-#define NOFLSH 0x80000000 /* no output flush on signal */
-#define TIOCLSET _IOW('t', 125, int) /* set entire local mode word */
-#define TIOCLGET _IOR('t', 124, int) /* get local modes */
-#define LCRTBS (CRTBS>>16)
-#define LPRTERA (PRTERA>>16)
-#define LCRTERA (CRTERA>>16)
-#define LTILDE (TILDE>>16)
-#define LMDMBUF (MDMBUF>>16)
-#define LLITOUT (LITOUT>>16)
-#define LTOSTOP (TOSTOP>>16)
-#define LFLUSHO (FLUSHO>>16)
-#define LNOHANG (NOHANG>>16)
-#define LCRTKIL (CRTKIL>>16)
-#define LPASS8 (PASS8>>16)
-#define LCTLECH (CTLECH>>16)
-#define LPENDIN (PENDIN>>16)
-#define LDECCTQ (DECCTQ>>16)
-#define LNOFLSH (NOFLSH>>16)
-#define TIOCSLTC _IOW('t',117,struct ltchars)/* set local special chars */
-#define TIOCGLTC _IOR('t',116,struct ltchars)/* get local special chars */
-
-
-#if defined(TIOCGETC) || defined(TIOCSETC)
-/* Type of ARG for TIOCGETC and TIOCSETC requests. */
-struct tchars
-{
- char t_intrc; /* Interrupt character. */
- char t_quitc; /* Quit character. */
- char t_startc; /* Start-output character. */
- char t_stopc; /* Stop-output character. */
- char t_eofc; /* End-of-file character. */
- char t_brkc; /* Input delimiter character. */
-};
-
-#define _IOT_tchars /* Hurd ioctl type field. */ \
- _IOT (_IOTS (char), 6, 0, 0, 0, 0)
-#endif
-
-#if defined(TIOCGLTC) || defined(TIOCSLTC)
-/* Type of ARG for TIOCGLTC and TIOCSLTC requests. */
-struct ltchars
-{
- char t_suspc; /* Suspend character. */
- char t_dsuspc; /* Delayed suspend character. */
- char t_rprntc; /* Reprint-line character. */
- char t_flushc; /* Flush-output character. */
- char t_werasc; /* Word-erase character. */
- char t_lnextc; /* Literal-next character. */
-};
-
-#define _IOT_ltchars /* Hurd ioctl type field. */ \
- _IOT (_IOTS (char), 6, 0, 0, 0, 0)
-#endif
-
-/* Type of ARG for TIOCGETP and TIOCSETP requests (and gtty and stty). */
-struct sgttyb
-{
- char sg_ispeed; /* Input speed. */
- char sg_ospeed; /* Output speed. */
- char sg_erase; /* Erase character. */
- char sg_kill; /* Kill character. */
- short int sg_flags; /* Mode flags. */
-};
-
-
-
-
-const speed_t __bsd_speeds[] =
- {
- 0,
- 50,
- 75,
- 110,
- 134,
- 150,
- 200,
- 300,
- 600,
- 1200,
- 1800,
- 2400,
- 4800,
- 9600,
- 19200,
- 38400,
- };
-
-extern int ioctl ();
-
-/* Set the state of FD to *TERMIOS_P. */
-int
-tcsetattr (int fd, int optional_actions, const struct termios *termios_p)
-{
- struct sgttyb buf;
- struct tchars tchars;
- struct ltchars ltchars;
- int local;
-#ifdef TIOCGETX
- int extra;
-#endif
- size_t i;
-
- if (ioctl(fd, TIOCGETP, &buf) < 0 ||
- ioctl(fd, TIOCGETC, &tchars) < 0 ||
- ioctl(fd, TIOCGLTC, &ltchars) < 0 ||
-#ifdef TIOCGETX
- ioctl(fd, TIOCGETX, &extra) < 0 ||
-#endif
- ioctl(fd, TIOCLGET, &local) < 0)
- return -1;
-
- if (termios_p == NULL)
- {
- errno = EINVAL;
- return -1;
- }
-
- buf.sg_ispeed = buf.sg_ospeed = -1;
- for (i = 0; i <= sizeof (__bsd_speeds) / sizeof (__bsd_speeds[0]); ++i)
- {
- if (__bsd_speeds[i] == termios_p->__ispeed)
- buf.sg_ispeed = i;
- if (__bsd_speeds[i] == termios_p->__ospeed)
- buf.sg_ospeed = i;
- }
- if (buf.sg_ispeed == -1 || buf.sg_ospeed == -1)
- {
- errno = EINVAL;
- return -1;
- }
-
- buf.sg_flags &= ~(CBREAK|RAW);
- if (!(termios_p->c_lflag & ICANON))
- buf.sg_flags |= (termios_p->c_cflag & ISIG) ? CBREAK : RAW;
-#ifdef LPASS8
- if (termios_p->c_oflag & CS8)
- local |= LPASS8;
- else
- local &= ~LPASS8;
-#endif
- if (termios_p->c_lflag & _NOFLSH)
- local |= LNOFLSH;
- else
- local &= ~LNOFLSH;
- if (termios_p->c_oflag & OPOST)
- local &= ~LLITOUT;
- else
- local |= LLITOUT;
-#ifdef TIOCGETX
- if (termios_p->c_lflag & ISIG)
- extra &= ~NOISIG;
- else
- extra |= NOISIG;
- if (termios_p->c_cflag & CSTOPB)
- extra |= STOPB;
- else
- extra &= ~STOPB;
-#endif
- if (termios_p->c_iflag & ICRNL)
- buf.sg_flags |= CRMOD;
- else
- buf.sg_flags &= ~CRMOD;
- if (termios_p->c_iflag & IXOFF)
- buf.sg_flags |= TANDEM;
- else
- buf.sg_flags &= ~TANDEM;
-
- buf.sg_flags &= ~(ODDP|EVENP);
- if (!(termios_p->c_cflag & PARENB))
- buf.sg_flags |= ODDP | EVENP;
- else if (termios_p->c_cflag & PARODD)
- buf.sg_flags |= ODDP;
- else
- buf.sg_flags |= EVENP;
-
- if (termios_p->c_lflag & _ECHO)
- buf.sg_flags |= ECHO;
- else
- buf.sg_flags &= ~ECHO;
- if (termios_p->c_lflag & ECHOE)
- local |= LCRTERA;
- else
- local &= ~LCRTERA;
- if (termios_p->c_lflag & ECHOK)
- local |= LCRTKIL;
- else
- local &= ~LCRTKIL;
- if (termios_p->c_lflag & _TOSTOP)
- local |= LTOSTOP;
- else
- local &= ~LTOSTOP;
-
- buf.sg_erase = termios_p->c_cc[VERASE];
- buf.sg_kill = termios_p->c_cc[VKILL];
- tchars.t_eofc = termios_p->c_cc[VEOF];
- tchars.t_intrc = termios_p->c_cc[VINTR];
- tchars.t_quitc = termios_p->c_cc[VQUIT];
- ltchars.t_suspc = termios_p->c_cc[VSUSP];
- tchars.t_startc = termios_p->c_cc[VSTART];
- tchars.t_stopc = termios_p->c_cc[VSTOP];
-
- if (ioctl(fd, TIOCSETP, &buf) < 0 ||
- ioctl(fd, TIOCSETC, &tchars) < 0 ||
- ioctl(fd, TIOCSLTC, &ltchars) < 0 ||
-#ifdef TIOCGETX
- ioctl(fd, TIOCSETX, &extra) < 0 ||
-#endif
- ioctl(fd, TIOCLSET, &local) < 0)
- return -1;
- return 0;
-}
-
-
-#undef tcgetattr
-
-/* Put the state of FD into *TERMIOS_P. */
-int
-tcgetattr (int fd, struct termios *termios_p)
-{
- struct sgttyb buf;
- struct tchars tchars;
- struct ltchars ltchars;
- int local;
-#ifdef TIOCGETX
- int extra;
-#endif
-
- if (termios_p == NULL)
- {
- errno = EINVAL;
- return -1;
- }
-
- if (ioctl(fd, TIOCGETP, &buf) < 0 ||
- ioctl(fd, TIOCGETC, &tchars) < 0 ||
- ioctl(fd, TIOCGLTC, &ltchars) < 0 ||
-#ifdef TIOCGETX
- ioctl(fd, TIOCGETX, &extra) < 0 ||
-#endif
- ioctl(fd, TIOCLGET, &local) < 0)
- return -1;
-
- termios_p->__ispeed = __bsd_speeds[(unsigned char) buf.sg_ispeed];
- termios_p->__ospeed = __bsd_speeds[(unsigned char) buf.sg_ospeed];
-
- termios_p->c_iflag = 0;
- termios_p->c_oflag = 0;
- termios_p->c_cflag = 0;
- termios_p->c_lflag = 0;
- termios_p->c_oflag |= CREAD | HUPCL;
-#ifdef LPASS8
- if (local & LPASS8)
- termios_p->c_oflag |= CS8;
- else
-#endif
- termios_p->c_oflag |= CS7;
- if (!(buf.sg_flags & RAW))
- {
- termios_p->c_iflag |= IXON;
- termios_p->c_cflag |= OPOST;
-#ifndef NOISIG
- termios_p->c_lflag |= ISIG;
-#endif
- }
- if ((buf.sg_flags & (CBREAK|RAW)) == 0)
- termios_p->c_lflag |= ICANON;
- if (!(buf.sg_flags & RAW) && !(local & LLITOUT))
- termios_p->c_oflag |= OPOST;
- if (buf.sg_flags & CRMOD)
- termios_p->c_iflag |= ICRNL;
- if (buf.sg_flags & TANDEM)
- termios_p->c_iflag |= IXOFF;
-#ifdef TIOCGETX
- if (!(extra & NOISIG))
- termios_p->c_lflag |= ISIG;
- if (extra & STOPB)
- termios_p->c_cflag |= CSTOPB;
-#endif
-
- switch (buf.sg_flags & (EVENP|ODDP))
- {
- case EVENP|ODDP:
- break;
- case ODDP:
- termios_p->c_cflag |= PARODD;
- default:
- termios_p->c_cflag |= PARENB;
- termios_p->c_iflag |= IGNPAR | INPCK;
- break;
- }
- if (buf.sg_flags & ECHO)
- termios_p->c_lflag |= _ECHO;
- if (local & LCRTERA)
- termios_p->c_lflag |= ECHOE;
- if (local & LCRTKIL)
- termios_p->c_lflag |= ECHOK;
- if (local & LTOSTOP)
- termios_p->c_lflag |= _TOSTOP;
- if (local & LNOFLSH)
- termios_p->c_lflag |= _NOFLSH;
-
- termios_p->c_cc[VEOF] = tchars.t_eofc;
- termios_p->c_cc[VEOL] = '\n';
- termios_p->c_cc[VERASE] = buf.sg_erase;
- termios_p->c_cc[VKILL] = buf.sg_kill;
- termios_p->c_cc[VINTR] = tchars.t_intrc;
- termios_p->c_cc[VQUIT] = tchars.t_quitc;
- termios_p->c_cc[VSTART] = tchars.t_startc;
- termios_p->c_cc[VSTOP] = tchars.t_stopc;
- termios_p->c_cc[VSUSP] = ltchars.t_suspc;
- termios_p->c_cc[VMIN] = -1;
- termios_p->c_cc[VTIME] = -1;
-
- return 0;
-}
diff --git a/libdiskfs/opts-runtime-parse.c b/libdiskfs/opts-runtime-parse.c
deleted file mode 100644
index 00ec2fc0..00000000
--- a/libdiskfs/opts-runtime-parse.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* A default diskfs_parse_runtime_options routine
-
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-
- This file is part of the GNU Hurd.
-
- The GNU Hurd 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.
-
- The GNU Hurd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "priv.h"
-
-error_t
-diskfs_parse_runtime_options (int argc, char **argv,
- const struct argp *standard_argp)
-{
- return argp_parse (standard_argp, argc, argv,
- ARGP_NO_ERRS | ARGP_NO_HELP | ARGP_PARSE_ARGV0,
- 0, 0);
-}
diff --git a/libnetfs/parse-runtime-options.c b/libnetfs/parse-runtime-options.c
deleted file mode 100644
index 1a179736..00000000
--- a/libnetfs/parse-runtime-options.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* A default netfs_parse_runtime_options routine
-
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-
- This file is part of the GNU Hurd.
-
- The GNU Hurd 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.
-
- The GNU Hurd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "netfs.h"
-
-error_t
-netfs_parse_runtime_options (int argc, char **argv,
- const struct argp *standard_argp)
-{
- return argp_parse (standard_argp, argc, argv,
- ARGP_NO_ERRS | ARGP_NO_HELP | ARGP_PARSE_ARGV0,
- 0, 0);
-}
diff --git a/libnetfs/unparse-runtime-options.c b/libnetfs/unparse-runtime-options.c
deleted file mode 100644
index 4596600c..00000000
--- a/libnetfs/unparse-runtime-options.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* A default netfs_unparse_runtime_options routine
-
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-
- This file is part of the GNU Hurd.
-
- The GNU Hurd 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.
-
- The GNU Hurd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "netfs.h"
-
-/* The user may define this function, in which case it is called when the the
- filesystem receives a get-options request. ARGZ & ARGZ_LEN will contain
- information on `standard' netfs options; the user may extend them
- (probably by using argz_add), or ignore them, in which case case ARGZ
- should be freed, as it is malloced. The default implementation simply
- leaves ARGZ & ARGZ_LEN unmodified and returns sucess (0). */
-error_t
-netfs_unparse_runtime_options (char **argz, size_t *argz_len)
-{
- return 0;
-}
diff --git a/libtrivfs/handle-port.c b/libtrivfs/handle-port.c
deleted file mode 100644
index 9568b88a..00000000
--- a/libtrivfs/handle-port.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- Copyright (C) 1994, 1995, 1996 Free Software Foundation
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2, or (at
- your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#include "priv.h"
-
-/* Backwards compatibility. Use trivfs_create_control. */
-mach_port_t
-trivfs_handle_port (mach_port_t realnode,
- struct port_class *control_class,
- struct port_bucket *control_bucket,
- struct port_class *protid_class,
- struct port_bucket *protid_bucket)
-{
- mach_port_t right;
- struct trivfs_control *control;
- error_t err =
- trivfs_create_control (realnode,
- control_class, control_bucket,
- protid_class, protid_bucket,
- &control);
-
- if (err)
- return MACH_PORT_NULL;
-
- right = ports_get_right (control);
- ports_port_deref (control);
-
- return right;
-}
-
-#if 0
-#include "linkwarn.h"
-obslete (trivfs_handle_port, trivfs_create_control)
-#endif
diff --git a/nfs/pager.c b/nfs/pager.c
deleted file mode 100644
index 92df7955..00000000
--- a/nfs/pager.c
+++ /dev/null
@@ -1,456 +0,0 @@
-/*
- Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
- Written by Michael I. Bushnell, p/BSG.
-
- This file is part of the GNU Hurd.
-
- The GNU Hurd 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.
-
- The GNU Hurd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
-
-
-#include "nfs.h"
-#include <unistd.h>
-#include <hurd/pager.h>
-#include <netinet/in.h>
-#include <string.h>
-
-struct user_pager_info
-{
- struct node *np;
- struct pager *p;
- int max_prot;
-};
-
-struct pager_cache_rec
-{
- struct pager_cache_rec *next;
- vm_offset_t offset;
- struct pager *p;
- time_t fetched;
-};
-
-static struct pager_cache_rec *pager_cache_recs;
-static spin_lock_t pager_cache_rec_lock = SPIN_LOCK_INITIALIZER;
-static spin_lock_t node2pagelock = SPIN_LOCK_INITIALIZER;
-static struct port_bucket *pager_bucket;
-
-void
-register_new_page (struct pager *p, vm_offset_t offset)
-{
- struct pager_cache_rec *pc;
-
- pc = malloc (sizeof (struct pager_cache_rec));
- pc->offset = offset;
- pc->p = p;
- ports_port_ref (p);
- pc->fetched = mapped_time->seconds;
-
- spin_lock (&pager_cache_rec_lock);
- pc->next = pager_cache_recs;
- pager_cache_recs = pc;
- spin_unlock (&pager_cache_rec_lock);
-}
-
-any_t
-flush_pager_cache_thread (any_t foo2)
-{
- struct pager_cache_rec *pc, *next, **ppc, *list;
-
- for (;;)
- {
- sleep (1);
-
- /* Dequeue from the main list and queue locally the recs
- for expired pages. */
- list = 0;
- spin_lock (&pager_cache_rec_lock);
- for (pc = pager_cache_recs, ppc = &pager_cache_recs;
- pc;
- ppc = &pc->next, pc = next)
- {
- next = pc->next;
- if (mapped_time->seconds - pc->fetched > cache_timeout)
- {
- *ppc = pc->next;
- pc->next = list;
- list = pc;
- }
- }
- spin_unlock (&pager_cache_rec_lock);
-
- /* And now, one at a time, expire them */
- for (pc = list; pc; pc = next)
- {
- pager_return_some (pc->p, pc->offset, vm_page_size, 0);
- next = pc->next;
- ports_port_deref (pc->p);
- free (pc);
- }
- }
-}
-
-error_t
-pager_read_page (struct user_pager_info *pager,
- vm_offset_t page,
- vm_address_t *buf,
- int *writelock)
-{
- error_t err;
- int *p;
- void *rpcbuf;
- struct node *np;
- size_t amt, thisamt, trans_len;
- void *data;
- off_t offset;
-
- np = pager->np;
-
- mutex_lock (&np->lock);
-
- *buf = (vm_address_t) mmap (0, vm_page_size, PROT_READ|PROT_WRITE,
- MAP_ANON, 0, 0);
- data = (char *) *buf;
- amt = vm_page_size;
- offset = page;
-
- while (amt)
- {
- thisamt = amt;
- if (thisamt > read_size)
- thisamt = read_size;
-
- p = nfs_initialize_rpc (NFSPROC_READ, (struct iouser *)-1, 0,
- &rpcbuf, np, -1);
- p = xdr_encode_fhandle (p, &np->nn->handle);
- *p++ = htonl (offset);
- *p++ = htonl (vm_page_size);
- *p++ = 0;
-
- err = conduct_rpc (&rpcbuf, &p);
- if (!err)
- err = nfs_error_trans (ntohl (*p++));
- if (err)
- {
- mutex_unlock (&np->lock);
- free (rpcbuf);
- munmap ((caddr_t) *buf, vm_page_size);
- return err;
- }
-
- p = register_fresh_stat (np, p);
- trans_len = ntohl (*p++);
- if (trans_len > thisamt)
- trans_len = thisamt; /* ??? */
-
- bcopy (p, data, trans_len);
-
- free (rpcbuf);
-
- data += trans_len;
- offset += trans_len;
- amt -= trans_len;
-
- /* If we got a short count, we're all done. */
- if (trans_len < thisamt)
- break;
- }
-
- register_new_page (pager->p, page);
- mutex_unlock (&np->lock);
- return 0;
-}
-
-
-error_t
-pager_write_page (struct user_pager_info *pager,
- vm_offset_t page,
- vm_address_t buf)
-{
- int *p;
- void *rpcbuf;
- error_t err;
- size_t amt, thisamt;
- off_t offset;
- struct node *np;
- void *data;
-
- np = pager->np;
- mutex_lock (&np->lock);
-
- amt = vm_page_size;
- offset = page;
- data = (void *) buf;
-
- while (amt)
- {
- thisamt = amt;
- if (amt > write_size)
- amt = write_size;
-
- p = nfs_initialize_rpc (NFSPROC_WRITE, (struct iouser *) -1,
- amt, &rpcbuf, np, -1);
- p = xdr_encode_fhandle (p, &np->nn->handle);
- *p++ = 0;
- *p++ = htonl (offset);
- *p++ = 0;
- p = xdr_encode_data (p, data, thisamt);
-
- err = conduct_rpc (&rpcbuf, &p);
- if (!err)
- err = nfs_error_trans (ntohl (*p++));
- if (err)
- {
- free (rpcbuf);
- vm_deallocate (mach_task_self (), buf, vm_page_size);
- return err;
- }
- register_fresh_stat (np, p);
- free (rpcbuf);
- amt -= thisamt;
- data += thisamt;
- offset += thisamt;
- }
-
- vm_deallocate (mach_task_self (), buf, vm_page_size);
- mutex_unlock (&np->lock);
- return 0;
-}
-
-error_t
-pager_unlock_page (struct user_pager_info *pager,
- vm_offset_t address)
-{
- abort ();
-}
-
-error_t
-pager_report_extent (struct user_pager_info *pager,
- vm_address_t *offset,
- vm_size_t *size)
-{
- struct node *np;
- error_t err;
-
- np = pager->np;
- mutex_lock (&np->lock);
-
- err = netfs_validate_stat (np, 0);
- if (!err)
- *size = round_page (np->nn_stat.st_size);
- mutex_unlock (&np->lock);
- return err;
-}
-
-void
-pager_clear_user_data (struct user_pager_info *upi)
-{
- spin_lock (&node2pagelock);
- if (upi->np->nn->fileinfo == upi)
- upi->np->nn->fileinfo = 0;
- spin_unlock (&node2pagelock);
- netfs_nrele (upi->np);
- free (upi);
-}
-
-void
-pager_dropweak (struct user_pager_info *upi)
-{
- abort ();
-}
-
-mach_port_t
-netfs_get_filemap (struct node *np, vm_prot_t prot)
-{
- struct user_pager_info *upi;
- mach_port_t right;
-
- spin_lock (&node2pagelock);
- do
- if (!np->nn->fileinfo)
- {
- upi = malloc (sizeof (struct user_pager_info));
- upi->np = np;
- netfs_nref (np);
- upi->max_prot = prot;
- upi->p = pager_create (upi, pager_bucket, 1, MEMORY_OBJECT_COPY_NONE);
- if (upi->p == 0)
- {
- netfs_nrele (np);
- free (upi);
- spin_unlock (&node2pagelock);
- return MACH_PORT_NULL;
- }
- np->nn->fileinfo = upi;
- right = pager_get_port (np->nn->fileinfo->p);
- ports_port_deref (np->nn->fileinfo->p);
- }
- else
- {
- np->nn->fileinfo->max_prot |= prot;
- /* Because NP->dn->fileinfo->p is not a real reference,
- this might be nearly deallocated. If that's so, then
- the port right will be null. In that case, clear here
- and loop. The deallocation will complete separately. */
- right = pager_get_port (np->nn->fileinfo->p);
- if (right == MACH_PORT_NULL)
- np->nn->fileinfo = 0;
- }
- while (right == MACH_PORT_NULL);
-
- spin_unlock (&node2pagelock);
-
- mach_port_insert_right (mach_task_self (), right, right,
- MACH_MSG_TYPE_MAKE_SEND);
- return right;
-}
-
-void
-drop_pager_softrefs (struct node *np)
-{
- struct user_pager_info *upi;
-
- spin_lock (&node2pagelock);
- upi = np->nn->fileinfo;
- if (upi)
- ports_port_ref (upi->p);
- spin_unlock (&node2pagelock);
-
- if (upi)
- {
- pager_change_attributes (upi->p, 0, MEMORY_OBJECT_COPY_NONE, 0);
- ports_port_deref (upi->p);
- }
-}
-
-void
-allow_pager_softrefs (struct node *np)
-{
- struct user_pager_info *upi;
-
- spin_lock (&node2pagelock);
- upi = np->nn->fileinfo;
- if (upi)
- ports_port_ref (upi->p);
- spin_unlock (&node2pagelock);
-
- if (upi)
- {
- pager_change_attributes (upi->p, 1, MEMORY_OBJECT_COPY_NONE, 0);
- ports_port_deref (upi->p);
- }
-}
-
-void
-block_caching ()
-{
- error_t block_cache (void *arg)
- {
- struct pager *p = arg;
- pager_change_attributes (p, 0, MEMORY_OBJECT_COPY_NONE, 1);
- return 0;
- }
- ports_bucket_iterate (pager_bucket, block_cache);
-}
-
-void
-enable_caching ()
-{
- error_t enable_cache (void *arg)
- {
- struct pager *p = arg;
- struct user_pager_info *upi = pager_get_upi (p);
-
- pager_change_attributes (p, 1, MEMORY_OBJECT_COPY_NONE, 0);
- return 0;
- }
-
- ports_bucket_iterate (pager_bucket, enable_cache);
-}
-
-int
-netfs_pager_users ()
-{
- int npagers = ports_count_bucket (pager_bucket);
-
- if (!npagers)
- return 0;
-
- block_caching ();
- /* Give it a sec; the kernel doesn't issue the shutdown right away */
- sleep (1);
- npagers = ports_count_bucket (pager_bucket);
- if (!npagers)
- return 0;
-
- enable_caching ();
-
- ports_enable_bucket (pager_bucket);
-}
-
-vm_prot_t
-netfs_max_user_pager_prot ()
-{
- vm_prot_t max_prot;
- int npagers = ports_count_bucket (pager_bucket);
-
- if (npagers)
- {
- error_t add_pager_max_prot (void *v_p)
- {
- struct pager *p = v_p;
- struct user_pager_info *upi = pager_get_upi (p);
- max_prot |= upi->max_prot;
- return max_prot == (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
- }
-
- block_caching ();
- sleep (1);
-
- ports_bucket_iterate (pager_bucket, add_pager_max_prot);
- enable_caching ();
- }
-
- ports_enable_bucket (pager_bucket);
- return max_prot;
-}
-
-void
-netfs_shutdown_pager ()
-{
- error_t shutdown_one (void *arg)
- {
- pager_shutdown ((struct pager *) arg);
- return 0;
- }
-
- ports_bucket_iterate (pager_bucket, shutdown_one);
-}
-
-void
-netfs_sync_everything (int wait)
-{
- error_t sync_one (void *arg)
- {
- pager_sync ((struct pager *) arg, wait);
- return 0;
- }
- ports_bucket_iterate (pager_bucket, sync_one);
-}
-
-void
-pager_initialize (void)
-{
- pager_bucket = ports_create_bucket ();
- cthread_detach (cthread_fork (flush_pager_cache_thread, 0));
-