summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1995-08-28 09:19:25 +0000
committerjulian <julian@FreeBSD.org>1995-08-28 09:19:25 +0000
commitebb726ec45c12268b6b931aa636809cc9cb99a90 (patch)
tree53b6da073fd58ab81ebf18bb0642954c76b642bd /sys/kern
parent6f51a7615899188fd49e4446341be92684c778de (diff)
downloadFreeBSD-src-ebb726ec45c12268b6b931aa636809cc9cb99a90.zip
FreeBSD-src-ebb726ec45c12268b6b931aa636809cc9cb99a90.tar.gz
Reviewed by: julian with quick glances by bruce and others
Submitted by: terry (terry lambert) This is a composite of 3 patch sets submitted by terry. they are: New low-level init code that supports loadbal modules better some cleanups in the namei code to help terry in 16-bit character support some changes to the mount-root code to make it a little more modular.. NOTE: mounting root off cdrom or NFS MIGHT be broken as I haven't been able to test those cases.. certainly mounting root of disk still works just fine.. mfs should work but is untested. (tomorrows task) The low level init stuff includes a total rewrite of init_main.c to make it possible for new modules to have an init phase by simply adding an entry to a TEXT_SET (or is it DATA_SET) list. thus a new module can be added to the kernel without editing any other files other than the 'files' file.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/init_main.c404
-rw-r--r--sys/kern/kern_clock.c16
-rw-r--r--sys/kern/kern_malloc.c16
-rw-r--r--sys/kern/kern_synch.c18
-rw-r--r--sys/kern/kern_tc.c16
-rw-r--r--sys/kern/kern_timeout.c16
-rw-r--r--sys/kern/subr_clist.c16
-rw-r--r--sys/kern/subr_prof.c10
-rw-r--r--sys/kern/sysv_msg.c9
-rw-r--r--sys/kern/sysv_sem.c9
-rw-r--r--sys/kern/sysv_shm.c9
-rw-r--r--sys/kern/tty_subr.c16
-rw-r--r--sys/kern/uipc_domain.c60
-rw-r--r--sys/kern/uipc_mbuf.c16
-rw-r--r--sys/kern/vfs_bio.c21
-rw-r--r--sys/kern/vfs_conf.c142
-rw-r--r--sys/kern/vfs_extattr.c8
-rw-r--r--sys/kern/vfs_init.c15
-rw-r--r--sys/kern/vfs_mount.c142
-rw-r--r--sys/kern/vfs_syscalls.c8
20 files changed, 775 insertions, 192 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 854b6ca..b38b25a 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -1,4 +1,7 @@
/*
+ * Copyright (c) 1995 Terrence R. Lambert
+ * All rights reserved.
+ *
* Copyright (c) 1982, 1986, 1989, 1991, 1992, 1993
* The Regents of the University of California. All rights reserved.
* (c) UNIX System Laboratories, Inc.
@@ -72,13 +75,6 @@
#include <vm/vm.h>
#include <vm/vm_pageout.h>
-#ifdef HPFPLIB
-char copyright[] =
-"Copyright (c) 1982, 1986, 1989, 1991, 1993\n\tThe Regents of the University of California.\nCopyright (c) 1992 Hewlett-Packard Company\nCopyright (c) 1992 Motorola Inc.\nAll rights reserved.\n\n";
-#else
-char copyright[] =
-"Copyright (c) 1982, 1986, 1989, 1991, 1993\n\tThe Regents of the University of California. All rights reserved.\n\n";
-#endif
/* Components of the first process -- never freed. */
struct session session0;
@@ -89,7 +85,7 @@ struct filedesc0 filedesc0;
struct plimit limit0;
struct vmspace vmspace0;
struct proc *curproc = &proc0;
-struct proc *initproc, *pageproc, *updateproc, *vmproc;
+struct proc *initproc;
int cmask = CMASK;
extern struct user *proc0paddr;
@@ -99,51 +95,212 @@ int boothowto;
struct timeval boottime;
struct timeval runtime;
-static void start_init __P((struct proc *p, void *framep));
+/*
+ * Promiscuous argument pass for start_init()
+ *
+ * This is a kludge because we use a return from main() rather than a call
+ * to a new reoutine in locore.s to kick the kernel alive from locore.s.
+ */
+static void *init_framep;
+
#if __GNUC__ >= 2
void __main() {}
#endif
+
/*
- * This table is filled in by the linker with functions that need to be
- * called to initialize various pseudo-devices and whatnot.
+ * This ensures that there is at least one entry so that the sysinit_set
+ * symbol is not undefined. A sybsystem ID of SI_SUB_DUMMY is never
+ * executed.
*/
+SYSINIT(placeholder, SI_SUB_DUMMY,SI_ORDER_ANY, NULL, NULL)
-static void dummyinit() {}
-TEXT_SET(pseudo_set, dummyinit);
-
-typedef void (*pseudo_func_t)(void);
-extern const struct linker_set pseudo_set;
-static const pseudo_func_t *pseudos =
- (const pseudo_func_t *)&pseudo_set.ls_items[0];
/*
* System startup; initialize the world, create process 0, mount root
* filesystem, and fork to create init and pagedaemon. Most of the
* hard work is done in the lower-level initialization routines including
* startup(), which does memory initialization and autoconfiguration.
+ *
+ * This allows simple addition of new kernel subsystems that require
+ * boot time initialization. It also allows substitution of subsystem
+ * (for instance, a scheduler, kernel profiler, or VM system) by object
+ * module. Finally, it allows for optional "kernel threads", like an LFS
+ * cleaner.
*/
void
main(framep)
void *framep;
{
- register struct proc *p;
- register struct filedesc0 *fdp;
+
+ register struct sysinit **sipp; /* system initialization*/
+ register struct sysinit **xipp; /* interior loop of sort*/
+ register struct sysinit *save; /* bubble*/
+ int rval[2]; /* SI_TYPE_KTHREAD support*/
+
+ extern struct linker_set sysinit_set;
+
+ /*
+ * Save the locore.s frame pointer for start_init().
+ */
+ init_framep = framep;
+
+ /*
+ * Perform a bubble sort of the system initialization objects by
+ * their subsystem (primary key) and order (secondary key).
+ *
+ * Since some things care about execution order, this is the
+ * operation which ensures continued function.
+ */
+ for( sipp = (struct sysinit **)sysinit_set.ls_items; *sipp; sipp++) {
+ for( xipp = sipp + 1; *xipp; xipp++) {
+ if( (*sipp)->subsystem < (*xipp)->subsystem ||
+ ( (*sipp)->subsystem == (*xipp)->subsystem &&
+ (*sipp)->order < (*xipp)->order))
+ continue; /* skip*/
+ save = *sipp;
+ *sipp = *xipp;
+ *xipp = save;
+ }
+ }
+
+ /*
+ * Traverse the (now) ordered list of system initialization tasks.
+ * Perform each task, and continue on to the next task.
+ *
+ * The last item on the list is expected to be the scheduler,
+ * which will not return.
+ */
+ for( sipp = (struct sysinit **)sysinit_set.ls_items; *sipp; sipp++) {
+ if( (*sipp)->subsystem == SI_SUB_DUMMY)
+ continue; /* skip dummy task(s)*/
+
+ switch( (*sipp)->type) {
+ case SI_TYPE_DEFAULT:
+ /* no special processing*/
+ (*((*sipp)->func))( (*sipp)->udata);
+ break;
+
+ case SI_TYPE_KTHREAD:
+ /* kernel thread*/
+ if (fork(&proc0, NULL, rval))
+ panic("fork kernel process");
+ if (rval[1]) {
+ (*((*sipp)->func))( (*sipp)->udata);
+ /*
+ * The call to start "init" returns
+ * here after the scheduler has been
+ * started, and returns to the caller
+ * in i386/i386/locore.s. This is a
+ * necessary part of initialization
+ * and is rather non-obvious.
+ *
+ * No other "kernel threads" should
+ * return here. Call panic() instead.
+ */
+ return;
+ }
+ break;
+
+ default:
+ panic( "init_main: unrecognized init type");
+ }
+ }
+
+ /* NOTREACHED*/
+}
+
+
+/*
+ * Start a kernel process. This is called after a fork() call in
+ * main() in the file kern/init_main.c.
+ *
+ * This function is used to start "internal" daemons.
+ */
+/* ARGSUSED*/
+void
+kproc_start( udata)
+caddr_t udata; /* not used*/
+{
+ struct kproc_desc *kp = (struct kproc_desc *)udata;
+ struct proc *p = curproc;
+
+ /* save a global descriptor, if desired*/
+ if( kp->global_procpp != NULL)
+ *kp->global_procpp = p;
+
+ /* this is a non-swapped system process*/
+ p->p_flag |= P_INMEM | P_SYSTEM;
+
+ /* set up arg0 for 'ps', et al*/
+ strcpy( p->p_comm, kp->arg0);
+
+ /* call the processes' main()...*/
+ (*kp->func)();
+
+ /* NOTREACHED */
+ panic( "kproc_start: %s", kp->arg0);
+}
+
+
+/*
+ ***************************************************************************
+ ****
+ **** The following SYSINIT's belong elsewhere, but have not yet
+ **** been moved.
+ ****
+ ***************************************************************************
+ */
+#ifdef OMIT
+/*
+ * Handled by vfs_mountroot (bad idea) at this time... should be
+ * done the same as 4.4Lite2.
+ */
+SYSINIT(swapinit, SI_SUB_SWAP, SI_ORDER_FIRST, swapinit, NULL)
+#endif /* OMIT*/
+
+/*
+ * Should get its own file...
+ */
+#ifdef HPFPLIB
+char copyright[] =
+"Copyright (c) 1982, 1986, 1989, 1991, 1993\n\tThe Regents of the University of California.\nCopyright (c) 1992 Hewlett-Packard Company\nCopyright (c) 1992 Motorola Inc.\nAll rights reserved.\n\n";
+#else
+char copyright[] =
+"Copyright (c) 1982, 1986, 1989, 1991, 1993\n\tThe Regents of the University of California. All rights reserved.\n\n";
+#endif
+SYSINIT(announce, SI_SUB_COPYRIGHT, SI_ORDER_FIRST, printf, (caddr_t)copyright)
+
+
+/*
+ ***************************************************************************
+ ****
+ **** The two following SYSINT's are proc0 specific glue code. I am not
+ **** convinced that they can not be safely combined, but their order of
+ **** operation has been maintained as the same as the original init_main.c
+ **** for right now.
+ ****
+ **** These probably belong in init_proc.c or kern_proc.c, since they
+ **** deal with proc0 (the fork template process).
+ ****
+ ***************************************************************************
+ */
+/* ARGSUSED*/
+void
+proc0_init( udata)
+caddr_t udata; /* not used*/
+{
+ register struct proc *p;
+ register struct filedesc0 *fdp;
register int i;
- int s, rval[2];
/*
* Initialize the current process pointer (curproc) before
* any possible traps/probes to simplify trap processing.
*/
p = &proc0;
- curproc = p;
- printf(copyright);
-
- vm_mem_init();
- kmeminit();
- cpu_startup();
+ curproc = p; /* XXX redundant*/
/*
* Create process 0 (the swapper).
@@ -204,13 +361,16 @@ main(framep)
vmspace0.vm_map.pmap = &vmspace0.vm_pmap;
p->p_addr = proc0paddr; /* XXX */
+#define INCOMPAT_LITES2
+#ifdef INCOMPAT_LITES2
/*
* proc0 needs to have a coherent frame base, too.
* This probably makes the identical call for the init proc
* that happens later unnecessary since it should inherit
* it during the fork.
*/
- cpu_set_init_frame(p, framep); /* XXX! */
+ cpu_set_init_frame(p, init_framep); /* XXX! */
+#endif /* INCOMPAT_LITES2*/
/*
* We continue to place resource usage info and signal
@@ -225,67 +385,66 @@ main(framep)
*/
usrinfoinit();
(void)chgproccnt(0, 1);
+}
+SYSINIT(p0init, SI_SUB_INTRINSIC, SI_ORDER_FIRST, proc0_init, NULL)
- rqinit();
-
- /* Configure virtual memory system, set vm rlimits. */
- vm_init_limits(p);
-
- /* Initialize the file systems. */
- vfsinit();
-
- /* Start real time and statistics clocks. */
- initclocks();
-
- /* Initialize mbuf's. */
- mbinit();
-
- /* Initialize clists. */
- clist_init();
-
-#ifdef SYSVSHM
- /* Initialize System V style shared memory. */
- shminit();
-#endif
-
-#ifdef SYSVSEM
- /* Initialize System V style semaphores. */
- seminit();
-#endif
-
-#ifdef SYSVMSG
- /* Initialize System V style message queues. */
- msginit();
-#endif
-
+/* ARGSUSED*/
+void
+proc0_post( udata)
+caddr_t udata; /* not used*/
+{
/*
- * Attach pseudo-devices.
+ * Now can look at time, having had a chance to verify the time
+ * from the file system. Reset p->p_rtime as it may have been
+ * munched in mi_switch() after the time got set.
*/
- while(*pseudos) {
- (**pseudos++)();
- }
+ proc0.p_stats->p_start = runtime = mono_time = boottime = time;
+ proc0.p_rtime.tv_sec = proc0.p_rtime.tv_usec = 0;
+
+ /* Initialize signal state for process 0. */
+ siginit(&proc0);
+}
+SYSINIT(p0post, SI_SUB_INTRINSIC_POST, SI_ORDER_FIRST, proc0_post, NULL)
- /*
- * Initialize protocols. Block reception of incoming packets
- * until everything is ready.
- */
- s = splimp();
- ifinit();
- domaininit();
- splx(s);
-#ifdef GPROF
- /* Initialize kernel profiling. */
- kmstartup();
-#endif
+
+/*
+ ***************************************************************************
+ ****
+ **** The following SYSINIT's and glue code should be moved to the
+ **** respective files on a per subsystem basis.
+ ****
+ ***************************************************************************
+ */
+/* ARGSUSED*/
+void
+sched_setup( udata)
+caddr_t udata; /* not used*/
+{
/* Kick off timeout driven events by calling first time. */
roundrobin(NULL);
schedcpu(NULL);
+}
+SYSINIT(sched_setup, SI_SUB_KICK_SCHEDULER, SI_ORDER_FIRST, sched_setup, NULL)
+/* ARGSUSED*/
+void
+xxx_vfs_mountroot( udata)
+caddr_t udata; /* not used*/
+{
/* Mount the root file system. */
- if ((*mountroot)())
+ if ((*mountroot)( (caddr_t)mountrootvfsops))
panic("cannot mount root");
+}
+SYSINIT(mountroot, SI_SUB_ROOT, SI_ORDER_FIRST, xxx_vfs_mountroot, NULL)
+
+/* ARGSUSED*/
+void
+xxx_vfs_root_fdtab( udata)
+caddr_t udata; /* not used*/
+{
+ register struct filedesc0 *fdp = &filedesc0;
/* Get the vnode for '/'. Set fdp->fd_fd.fd_cdir to reference it. */
if (VFS_ROOT(mountlist.cqh_first, &rootvnode))
@@ -294,74 +453,46 @@ main(framep)
VREF(fdp->fd_fd.fd_cdir);
VOP_UNLOCK(rootvnode);
fdp->fd_fd.fd_rdir = NULL;
+}
+SYSINIT(retrofit, SI_SUB_ROOT_FDTAB, SI_ORDER_FIRST, xxx_vfs_root_fdtab, NULL)
- /*
- * Now can look at time, having had a chance to verify the time
- * from the file system. Reset p->p_rtime as it may have been
- * munched in mi_switch() after the time got set.
- */
- p->p_stats->p_start = runtime = mono_time = boottime = time;
- p->p_rtime.tv_sec = p->p_rtime.tv_usec = 0;
- /* Initialize signal state for process 0. */
- siginit(p);
+/*
+ ***************************************************************************
+ ****
+ **** The following code probably belongs in another file, like
+ **** kern/init_init.c. It is here for two reasons only:
+ ****
+ **** 1) This code returns to startup the system; this is
+ **** abnormal for a kernel thread.
+ **** 2) This code promiscuously uses init_frame
+ ****
+ ***************************************************************************
+ */
- /* Create process 1 (init(8)). */
- if (fork(p, NULL, rval))
- panic("fork init");
- if (rval[1]) {
- start_init(curproc, framep);
- return;
- }
+static void kthread_init __P(( caddr_t udata));
+SYSINIT_KT(init,SI_SUB_KTHREAD_INIT, SI_ORDER_FIRST, kthread_init, NULL)
- /* Create process 2 (the pageout daemon). */
- if (fork(p, NULL, rval))
- panic("fork pager");
- if (rval[1]) {
- /*
- * Now in process 2.
- */
- p = curproc;
- pageproc = p;
- p->p_flag |= P_INMEM | P_SYSTEM; /* XXX */
- bcopy("pagedaemon", curproc->p_comm, sizeof ("pagedaemon"));
- vm_pageout();
- /* NOTREACHED */
- }
- /*
- * Start high level vm daemon (process 3).
- */
- if (fork(p, (void *) NULL, rval))
- panic("failed fork vm daemon");
- if (rval[1]) {
- p = curproc;
- vmproc = p;
- p->p_flag |= P_INMEM | P_SYSTEM;
- bcopy("vmdaemon", p->p_comm, sizeof("vmdaemon"));
- vm_daemon();
- /*NOTREACHED*/
- }
+static void start_init __P((struct proc *p, void *framep));
+
+/* ARGSUSED*/
+static void
+kthread_init( udata)
+caddr_t udata; /* not used*/
+{
+
+ /* Create process 1 (init(8)). */
+ start_init(curproc, init_framep);
/*
- * Start update daemon (process 4).
+ * This is the only kernel thread allowed to return yo the
+ * caller!!!
*/
- if (fork(p, (void *) NULL, rval))
- panic("failed fork update daemon");
- if (rval[1]) {
- p = curproc;
- updateproc = p;
- p->p_flag |= P_INMEM | P_SYSTEM;
- bcopy("update", p->p_comm, sizeof("update"));
- vfs_update();
- /*NOTREACHED*/
- }
-
- /* The scheduler is an infinite loop. */
- scheduler();
- /* NOTREACHED */
+ return;
}
+
/*
* List of paths to try when searching for "init".
*/
@@ -459,6 +590,9 @@ start_init(p, framep)
/*
* Now try to exec the program. If can't for any reason
* other than it doesn't exist, complain.
+ *
+ * Otherwise return to main() which returns to btext
+ * which completes the system startup.
*/
if ((error = execve(p, &args, &retval[0])) == 0)
return;
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index fb686b1..04af42b 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
- * $Id: kern_clock.c,v 1.13 1995/05/30 08:05:20 rgrimes Exp $
+ * $Id: kern_clock.c,v 1.14 1995/07/29 11:40:12 bde Exp $
*/
/* Portions of this software are covered by the following: */
@@ -75,6 +75,14 @@
#include <sys/gmon.h>
#endif
+/*
+ * System initialization
+ */
+
+static void initclocks __P(( caddr_t udata));
+SYSINIT(clocks, SI_SUB_CLOCKS, SI_ORDER_FIRST, initclocks, NULL)
+
+
/* Does anybody else really care about these? */
struct callout *callfree, *callout, calltodo;
@@ -383,8 +391,10 @@ hardupdate(offset)
/*
* Initialize clock frequencies and start both clocks running.
*/
-void
-initclocks()
+/* ARGSUSED*/
+static void
+initclocks( udata)
+caddr_t udata; /* not used*/
{
register int i;
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index 600e54f..52c95c5 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94
- * $Id: kern_malloc.c,v 1.11 1995/04/16 11:25:15 davidg Exp $
+ * $Id: kern_malloc.c,v 1.12 1995/05/30 08:05:33 rgrimes Exp $
*/
#include <sys/param.h>
@@ -43,6 +43,14 @@
#include <vm/vm.h>
#include <vm/vm_kern.h>
+/*
+ * System initialization
+ */
+
+static void kmeminit __P((caddr_t));
+SYSINIT(kmem, SI_SUB_KMEM, SI_ORDER_FIRST, kmeminit, NULL)
+
+
struct kmembuckets bucket[MINBUCKET + 16];
struct kmemstats kmemstats[M_LAST];
struct kmemusage *kmemusage;
@@ -356,8 +364,10 @@ free(addr, type)
/*
* Initialize the kernel memory allocator
*/
-void
-kmeminit()
+/* ARGSUSED*/
+static void
+kmeminit( udata)
+caddr_t udata; /* not used*/
{
register long indx;
int npg;
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 534e477..6f97a63 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_synch.c 8.6 (Berkeley) 1/21/94
- * $Id: kern_synch.c,v 1.10 1995/03/16 18:12:36 bde Exp $
+ * $Id: kern_synch.c,v 1.11 1995/05/30 08:05:44 rgrimes Exp $
*/
#include <sys/param.h>
@@ -54,6 +54,16 @@
#include <machine/cpu.h>
+
+/*
+ * System initialization
+ */
+
+static void rqinit __P((caddr_t));
+SYSINIT(runqueue, SI_SUB_RUN_QUEUE, SI_ORDER_FIRST, rqinit, NULL)
+
+
+
u_char curpriority; /* usrpri of curproc */
int lbolt; /* once a second sleep address */
@@ -602,8 +612,10 @@ mi_switch()
* Initialize the (doubly-linked) run queues
* to be empty.
*/
-void
-rqinit()
+/* ARGSUSED*/
+static void
+rqinit( udata)
+caddr_t udata; /* not used*/
{
register int i;
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index fb686b1..04af42b 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
- * $Id: kern_clock.c,v 1.13 1995/05/30 08:05:20 rgrimes Exp $
+ * $Id: kern_clock.c,v 1.14 1995/07/29 11:40:12 bde Exp $
*/
/* Portions of this software are covered by the following: */
@@ -75,6 +75,14 @@
#include <sys/gmon.h>
#endif
+/*
+ * System initialization
+ */
+
+static void initclocks __P(( caddr_t udata));
+SYSINIT(clocks, SI_SUB_CLOCKS, SI_ORDER_FIRST, initclocks, NULL)
+
+
/* Does anybody else really care about these? */
struct callout *callfree, *callout, calltodo;
@@ -383,8 +391,10 @@ hardupdate(offset)
/*
* Initialize clock frequencies and start both clocks running.
*/
-void
-initclocks()
+/* ARGSUSED*/
+static void
+initclocks( udata)
+caddr_t udata; /* not used*/
{
register int i;
diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c
index fb686b1..04af42b 100644
--- a/sys/kern/kern_timeout.c
+++ b/sys/kern/kern_timeout.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
- * $Id: kern_clock.c,v 1.13 1995/05/30 08:05:20 rgrimes Exp $
+ * $Id: kern_clock.c,v 1.14 1995/07/29 11:40:12 bde Exp $
*/
/* Portions of this software are covered by the following: */
@@ -75,6 +75,14 @@
#include <sys/gmon.h>
#endif
+/*
+ * System initialization
+ */
+
+static void initclocks __P(( caddr_t udata));
+SYSINIT(clocks, SI_SUB_CLOCKS, SI_ORDER_FIRST, initclocks, NULL)
+
+
/* Does anybody else really care about these? */
struct callout *callfree, *callout, calltodo;
@@ -383,8 +391,10 @@ hardupdate(offset)
/*
* Initialize clock frequencies and start both clocks running.
*/
-void
-initclocks()
+/* ARGSUSED*/
+static void
+initclocks( udata)
+caddr_t udata; /* not used*/
{
register int i;
diff --git a/sys/kern/subr_clist.c b/sys/kern/subr_clist.c
index d80d127..9694bcb 100644
--- a/sys/kern/subr_clist.c
+++ b/sys/kern/subr_clist.c
@@ -6,7 +6,7 @@
* of this software, nor does the author assume any responsibility
* for damages incurred with its use.
*
- * $Id: tty_subr.c,v 1.10 1995/05/30 08:06:18 rgrimes Exp $
+ * $Id: tty_subr.c,v 1.11 1995/07/11 19:39:54 bde Exp $
*/
/*
@@ -14,12 +14,20 @@
*/
#include <sys/param.h>
+#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/tty.h>
#include <sys/clist.h>
#include <sys/malloc.h>
+/*
+ * System initialization
+ */
+
+static void clist_init __P((caddr_t));
+SYSINIT(clist, SI_SUB_CLIST, SI_ORDER_FIRST, clist_init, NULL)
+
struct cblock *cfreelist = 0;
int cfreecount = 0;
static int cslushcount;
@@ -47,8 +55,10 @@ cbstat()
/*
* Called from init_main.c
*/
-void
-clist_init()
+/* ARGSUSED*/
+static void
+clist_init( udata)
+caddr_t udata; /* not used*/
{
/*
* Allocate an initial base set of cblocks as a 'slush'.
diff --git a/sys/kern/subr_prof.c b/sys/kern/subr_prof.c
index 3c8ef38..56c2a6e 100644
--- a/sys/kern/subr_prof.c
+++ b/sys/kern/subr_prof.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)subr_prof.c 8.3 (Berkeley) 9/23/93
- * $Id: subr_prof.c,v 1.5 1995/01/29 03:03:23 bde Exp $
+ * $Id: subr_prof.c,v 1.6 1995/03/16 18:12:41 bde Exp $
*/
#include <sys/param.h>
@@ -48,6 +48,14 @@
#include <sys/malloc.h>
#include <sys/gmon.h>
+/*
+ * System initialization
+ */
+
+extern void kmstartup(); /* should be static*/
+SYSINIT(kmem, SI_SUB_KPROF, SI_ORDER_FIRST, kmstartup, NULL)
+
+
struct gmonparam _gmonparam = { GMON_PROF_OFF };
extern char btext[];
diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c
index 09ed9ab..3eaa6b5 100644
--- a/sys/kern/sysv_msg.c
+++ b/sys/kern/sysv_msg.c
@@ -1,4 +1,4 @@
-/* $Id: sysv_msg.c,v 1.4 1995/05/30 08:06:01 rgrimes Exp $ */
+/* $Id: sysv_msg.c,v 1.5 1995/07/29 11:40:13 bde Exp $ */
/*
* Implementation of SVID messages
@@ -26,6 +26,13 @@
#include <sys/msg.h>
#include <sys/malloc.h>
+/*
+ * System initialization
+ */
+
+extern void msginit(); /* should be static*/
+SYSINIT(sysv_msg, SI_SUB_SYSV_MSG, SI_ORDER_FIRST, msginit, NULL)
+
#define MSG_DEBUG
#undef MSG_DEBUG_OK
diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c
index 9141c6f..6cadbd5 100644
--- a/sys/kern/sysv_sem.c
+++ b/sys/kern/sysv_sem.c
@@ -1,4 +1,4 @@
-/* $Id: sysv_sem.c,v 1.5 1995/05/30 08:06:02 rgrimes Exp $ */
+/* $Id: sysv_sem.c,v 1.6 1995/07/29 11:40:14 bde Exp $ */
/*
* Implementation of SVID semaphores
@@ -15,6 +15,13 @@
#include <sys/sem.h>
#include <sys/malloc.h>
+/*
+ * System initialization
+ */
+
+extern void seminit(); /* should be static*/
+SYSINIT(sysv_sem, SI_SUB_SYSV_SEM, SI_ORDER_FIRST, seminit, NULL)
+
static int semctl(), semget(), semop(), semconfig();
int (*semcalls[])() = { semctl, semget, semop, semconfig };
int semtot = 0;
diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c
index 8610d90..3c0fc35 100644
--- a/sys/kern/sysv_shm.c
+++ b/sys/kern/sysv_shm.c
@@ -1,4 +1,4 @@
-/* $Id: sysv_shm.c,v 1.5 1995/05/30 08:06:04 rgrimes Exp $ */
+/* $Id: sysv_shm.c,v 1.6 1995/07/29 11:40:15 bde Exp $ */
/* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */
/*
@@ -61,6 +61,13 @@
* per proc array of 'struct shmmap_state'
*/
+/*
+ * System initialization
+ */
+
+extern void shminit(); /* should be static*/
+SYSINIT(sysv_shm, SI_SUB_SYSV_SHM, SI_ORDER_FIRST, shminit, NULL)
+
int oshmctl();
int shmat(), shmctl(), shmdt(), shmget();
int (*shmcalls[])() = { shmat, oshmctl, shmdt, shmget, shmctl };
diff --git a/sys/kern/tty_subr.c b/sys/kern/tty_subr.c
index d80d127..9694bcb 100644
--- a/sys/kern/tty_subr.c
+++ b/sys/kern/tty_subr.c
@@ -6,7 +6,7 @@
* of this software, nor does the author assume any responsibility
* for damages incurred with its use.
*
- * $Id: tty_subr.c,v 1.10 1995/05/30 08:06:18 rgrimes Exp $
+ * $Id: tty_subr.c,v 1.11 1995/07/11 19:39:54 bde Exp $
*/
/*
@@ -14,12 +14,20 @@
*/
#include <sys/param.h>
+#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/ioctl.h>
#include <sys/tty.h>
#include <sys/clist.h>
#include <sys/malloc.h>
+/*
+ * System initialization
+ */
+
+static void clist_init __P((caddr_t));
+SYSINIT(clist, SI_SUB_CLIST, SI_ORDER_FIRST, clist_init, NULL)
+
struct cblock *cfreelist = 0;
int cfreecount = 0;
static int cslushcount;
@@ -47,8 +55,10 @@ cbstat()
/*
* Called from init_main.c
*/
-void
-clist_init()
+/* ARGSUSED*/
+static void
+clist_init( udata)
+caddr_t udata; /* not used*/
{
/*
* Allocate an initial base set of cblocks as a 'slush'.
diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c
index 6332c07..7eea042 100644
--- a/sys/kern/uipc_domain.c
+++ b/sys/kern/uipc_domain.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_domain.c 8.2 (Berkeley) 10/18/93
- * $Id: uipc_domain.c,v 1.6 1995/05/11 00:16:44 wollman Exp $
+ * $Id: uipc_domain.c,v 1.7 1995/08/16 16:13:21 bde Exp $
*/
#include <sys/param.h>
@@ -46,6 +46,29 @@
#include <vm/vm.h>
#include <sys/sysctl.h>
+/*
+ * System initialization
+ *
+ * Note: domain initialization wants to take place on a per domain basis
+ * as a result of traversing a linker set. Most likely, each domain
+ * want to call a registration function rather than being handled here
+ * in domaininit(). Probably this will look like:
+ *
+ * SYSINIT(unique, SI_SUB_PROTO_DOMAI, SI_ORDER_ANY, domain_add, (caddr_t)xxx)
+ *
+ * Where 'xxx' is replaced by the address of a parameter struct to be
+ * passed to the doamin_add() function.
+ */
+
+static int x_save_spl; /* used by kludge*/
+static void kludge_splimp __P((caddr_t));
+static void kludge_splx __P((caddr_t));
+static void domaininit __P((caddr_t));
+SYSINIT(splimp, SI_SUB_PROTO_BEGIN, SI_ORDER_FIRST, kludge_splimp, (caddr_t)&x_save_spl)
+SYSINIT(domain, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, domaininit, NULL)
+SYSINIT(splx, SI_SUB_PROTO_END, SI_ORDER_FIRST, kludge_splx, (caddr_t)&x_save_spl)
+
+
void pffasttimo __P((void *));
void pfslowtimo __P((void *));
@@ -58,8 +81,10 @@ struct domain *domains;
extern struct linker_set domain_set;
-void
-domaininit()
+/* ARGSUSED*/
+static void
+domaininit( udata)
+caddr_t udata; /* not used*/
{
register struct domain *dp, **dpp;
register struct protosw *pr;
@@ -96,6 +121,35 @@ domaininit()
timeout(pfslowtimo, (void *)0, 1);
}
+
+/*
+ * The following two operations are kludge code. Most likely, they should
+ * be done as a "domainpreinit()" for the first function and then rolled
+ * in as the last act of "domaininit()" for the second.
+ *
+ * In point of fact, it is questionable why other initialization prior
+ * to this does not also take place at splimp by default.
+ */
+static void
+kludge_splimp( udata)
+caddr_t udata;
+{
+ int *savesplp = (int *)udata;
+
+ *savesplp = splimp();
+}
+
+static void
+kludge_splx( udata)
+caddr_t udata;
+{
+ int *savesplp = (int *)udata;
+
+ splx( *savesplp);
+}
+
+
+
struct protosw *
pffindtype(family, type)
int family, type;
diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c
index 652fe66..77a0af1 100644
--- a/sys/kern/uipc_mbuf.c
+++ b/sys/kern/uipc_mbuf.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94
- * $Id: uipc_mbuf.c,v 1.9 1995/03/15 07:51:53 davidg Exp $
+ * $Id: uipc_mbuf.c,v 1.10 1995/07/29 11:40:16 bde Exp $
*/
#include <sys/param.h>
@@ -48,6 +48,14 @@
#include <vm/vm.h>
#include <vm/vm_kern.h>
+/*
+ * System initialization
+ */
+
+static void mbinit __P((caddr_t));
+SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRST, mbinit, NULL)
+
+
struct mbuf *mbutl;
char *mclrefcnt;
struct mbstat mbstat;
@@ -57,8 +65,10 @@ int max_protohdr;
int max_hdr;
int max_datalen;
-void
-mbinit()
+/* ARGSUSED*/
+static void
+mbinit( udata)
+caddr_t udata; /* not used*/
{
int s;
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index d2b5ba0..6e8d201 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -18,7 +18,7 @@
* 5. Modifications may be freely made to this file if the above conditions
* are met.
*
- * $Id: vfs_bio.c,v 1.58 1995/08/24 13:28:16 davidg Exp $
+ * $Id: vfs_bio.c,v 1.59 1995/08/24 13:59:14 davidg Exp $
*/
/*
@@ -51,6 +51,21 @@
#include <miscfs/specfs/specdev.h>
+/*
+ * System initialization
+ */
+
+static void vfs_update __P((void));
+struct proc *updateproc;
+
+static struct kproc_desc up_kp = {
+ "update",
+ vfs_update,
+ &updateproc
+};
+SYSINIT_KT(update, SI_SUB_KTHREAD_UPDATE, SI_ORDER_FIRST, kproc_start, (caddr_t)&up_kp)
+
+
struct buf *buf; /* buffer header pool */
struct swqueue bswlist;
@@ -1270,10 +1285,10 @@ count_lock_queue()
int vfs_update_interval = 30;
-void
+static void
vfs_update()
{
- (void) spl0();
+ (void) spl0(); /* XXX redundant? wrong place?*/
while (1) {
tsleep(&vfs_update_wakeup, PRIBIO, "update",
hz * vfs_update_interval);
diff --git a/sys/kern/vfs_conf.c b/sys/kern/vfs_conf.c
index 251d704..e8497f2 100644
--- a/sys/kern/vfs_conf.c
+++ b/sys/kern/vfs_conf.c
@@ -1,6 +1,7 @@
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1995 Artisoft, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -31,13 +32,144 @@
* SUCH DAMAGE.
*
* @(#)vfs_conf.c 8.8 (Berkeley) 3/31/94
- * $Id: vfs_conf.c,v 1.5 1994/09/21 03:46:47 wollman Exp $
+ * $Id: vfs_conf.c,v 1.6 1994/11/12 01:47:43 phk Exp $
*/
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/vnode.h>
+/*
+ * PURPOSE: This file abstracts the root mounting interface from
+ * the per file system semantics for handling mounts,
+ * the overall intent of which is to move the BSD
+ * internals dependence out of the FS code, both to
+ * make the FS code more portable and to free up some
+ * of the BSD internals so that they may more easily
+ * be changed.
+ *
+ * NOTE1: Code is single entry/single exit to aid debugging
+ * and conversion for kernel multithreading.
+ *
+ * NOTE2: Code notes lock state in headers on entry and exit
+ * as an aid to conversion for kernel multithreading
+ * on SMP reentrancy
+ */
+#include <sys/param.h> /* dev_t (types.h)*/
+#include <sys/systm.h> /* rootvp*/
+#include <sys/proc.h> /* curproc*/
+#include <sys/vnode.h> /* NULLVP*/
+#include <sys/mount.h> /* struct mount*/
+#include <sys/malloc.h> /* M_MOUNT*/
-int (*mountroot) __P((void));
+/*
+ * GLOBALS
+ */
+int (*mountroot) __P((caddr_t));
struct vnode *rootvnode;
+struct vfsops *mountrootvfsops;
+
+
+/*
+ * Common root mount code shared by all filesystems
+ */
+#define ROOTDIR "/"
+#define ROOTNAME "root_device"
+
+
+
+/*
+ * vfs_mountroot
+ *
+ * Common entry point for root mounts
+ *
+ * PARAMETERS:
+ * data pointer to the vfs_ops for the FS type mounting
+ *
+ * RETURNS: 0 Success
+ * !0 error number (errno.h)
+ *
+ * LOCK STATE:
+ * ENTRY
+ * <no locks held>
+ * EXIT
+ * <no locks held>
+ *
+ * NOTES:
+ * This code is currently supported only for use for
+ * the FFS file system type. This is a matter of
+ * fixing the other file systems, not this code!
+ */
+int
+vfs_mountroot( data)
+caddr_t *data; /* file system function table*/
+{
+ struct mount *mp;
+ u_int size;
+ int err = 0;
+ struct proc *p = curproc; /* XXX */
+ register struct fs *fs;
+ struct vfsops *mnt_op = (struct vfsops *)data;
+
+ /*
+ * New root mount structure
+ */
+ mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK);
+ bzero((char *)mp, (u_long)sizeof(struct mount));
+ mp->mnt_op = mnt_op;
+ mp->mnt_flag = MNT_ROOTFS;
+ mp->mnt_vnodecovered = NULLVP;
+
+ /*
+ * Lock mount point
+ */
+ if( ( err = vfs_lock(mp)) != 0)
+ goto error_1;
+
+ /* Save "last mounted on" info for mount point (NULL pad)*/
+ copystr( ROOTDIR, /* mount point*/
+ mp->mnt_stat.f_mntonname, /* save area*/
+ MNAMELEN - 1, /* max size*/
+ &size); /* real size*/
+ bzero( mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
+
+ /* Save "mounted from" info for mount point (NULL pad)*/
+ copystr( ROOTNAME, /* device name*/
+ mp->mnt_stat.f_mntfromname, /* save area*/
+ MNAMELEN - 1, /* max size*/
+ &size); /* real size*/
+ bzero( mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
+
+ /*
+ * Attempt the mount
+ */
+ err = VFS_MOUNT( mp, NULL, NULL, NULL, p);
+ if( err)
+ goto error_2;
+
+ /* Add fs to list of mounted file systems*/
+ CIRCLEQ_INSERT_TAIL( &mountlist, mp, mnt_list);
+
+ /* Unlock mount point*/
+ vfs_unlock(mp);
+
+ /* root mount, update system time from FS specific data*/
+ inittodr( mp->mnt_time);
+
+ goto success;
+
+error_2: /* mount error*/
+
+ /* unlock before failing*/
+ vfs_unlock( mp);
+
+error_1: /* lock error*/
+
+ /* free mount struct before failing*/
+ free( mp, M_MOUNT);
+
+success:
+ return( err);
+}
+
+
+/*
+ * EOF -- This file has not been truncated.
+ */
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index 33f9ce5..1f7135a 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
- * $Id: vfs_syscalls.c,v 1.31 1995/08/11 11:31:08 davidg Exp $
+ * $Id: vfs_syscalls.c,v 1.32 1995/08/17 11:53:40 bde Exp $
*/
#include <sys/param.h>
@@ -835,11 +835,9 @@ link(p, uap, retval)
vp = nd.ni_vp;
if (vp->v_type != VDIR ||
(error = suser(p->p_ucred, &p->p_acflag)) == 0) {
- nd.ni_cnd.cn_nameiop = CREATE;
- nd.ni_cnd.cn_flags = LOCKPARENT;
+ NDINIT(&nd, CREATE, LOCKPARENT, UIO_USERSPACE, uap->link, p);
if (vp->v_type == VDIR)
- nd.ni_cnd.cn_flags |= WILLBEDIR;
- nd.ni_dirp = uap->link;
+ nd.ni_cnd.cn_flags |= WILLBEDIR;
error = namei(&nd);
if (!error) {
if (nd.ni_vp != NULL) {
diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c
index ad12721..d772c8d 100644
--- a/sys/kern/vfs_init.c
+++ b/sys/kern/vfs_init.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_init.c 8.3 (Berkeley) 1/4/94
- * $Id: vfs_init.c,v 1.9 1994/10/20 00:48:28 wollman Exp $
+ * $Id: vfs_init.c,v 1.10 1995/05/30 08:06:32 rgrimes Exp $
*/
@@ -57,6 +57,13 @@
#include <sys/sysctl.h>
/*
+ * System initialization
+ */
+
+static void vfsinit __P((caddr_t));
+SYSINIT(vfs, SI_SUB_VFS, SI_ORDER_FIRST, vfsinit, NULL)
+
+/*
* Sigh, such primitive tools are these...
*/
#if 0
@@ -230,8 +237,10 @@ struct vattr va_null;
/*
* Initialize the vnode structures and initialize each file system type.
*/
-void
-vfsinit()
+/* ARGSUSED*/
+static void
+vfsinit( udata)
+caddr_t udata; /* not used*/
{
struct vfsops **vfsp;
struct vfsconf **vfc;
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 251d704..e8497f2 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -1,6 +1,7 @@
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1995 Artisoft, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -31,13 +32,144 @@
* SUCH DAMAGE.
*
* @(#)vfs_conf.c 8.8 (Berkeley) 3/31/94
- * $Id: vfs_conf.c,v 1.5 1994/09/21 03:46:47 wollman Exp $
+ * $Id: vfs_conf.c,v 1.6 1994/11/12 01:47:43 phk Exp $
*/
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/vnode.h>
+/*
+ * PURPOSE: This file abstracts the root mounting interface from
+ * the per file system semantics for handling mounts,
+ * the overall intent of which is to move the BSD
+ * internals dependence out of the FS code, both to
+ * make the FS code more portable and to free up some
+ * of the BSD internals so that they may more easily
+ * be changed.
+ *
+ * NOTE1: Code is single entry/single exit to aid debugging
+ * and conversion for kernel multithreading.
+ *
+ * NOTE2: Code notes lock state in headers on entry and exit
+ * as an aid to conversion for kernel multithreading
+ * on SMP reentrancy
+ */
+#include <sys/param.h> /* dev_t (types.h)*/
+#include <sys/systm.h> /* rootvp*/
+#include <sys/proc.h> /* curproc*/
+#include <sys/vnode.h> /* NULLVP*/
+#include <sys/mount.h> /* struct mount*/
+#include <sys/malloc.h> /* M_MOUNT*/
-int (*mountroot) __P((void));
+/*
+ * GLOBALS
+ */
+int (*mountroot) __P((caddr_t));
struct vnode *rootvnode;
+struct vfsops *mountrootvfsops;
+
+
+/*
+ * Common root mount code shared by all filesystems
+ */
+#define ROOTDIR "/"
+#define ROOTNAME "root_device"
+
+
+
+/*
+ * vfs_mountroot
+ *
+ * Common entry point for root mounts
+ *
+ * PARAMETERS:
+ * data pointer to the vfs_ops for the FS type mounting
+ *
+ * RETURNS: 0 Success
+ * !0 error number (errno.h)
+ *
+ * LOCK STATE:
+ * ENTRY
+ * <no locks held>
+ * EXIT
+ * <no locks held>
+ *
+ * NOTES:
+ * This code is currently supported only for use for
+ * the FFS file system type. This is a matter of
+ * fixing the other file systems, not this code!
+ */
+int
+vfs_mountroot( data)
+caddr_t *data; /* file system function table*/
+{
+ struct mount *mp;
+ u_int size;
+ int err = 0;
+ struct proc *p = curproc; /* XXX */
+ register struct fs *fs;
+ struct vfsops *mnt_op = (struct vfsops *)data;
+
+ /*
+ * New root mount structure
+ */
+ mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK);
+ bzero((char *)mp, (u_long)sizeof(struct mount));
+ mp->mnt_op = mnt_op;
+ mp->mnt_flag = MNT_ROOTFS;
+ mp->mnt_vnodecovered = NULLVP;
+
+ /*
+ * Lock mount point
+ */
+ if( ( err = vfs_lock(mp)) != 0)
+ goto error_1;
+
+ /* Save "last mounted on" info for mount point (NULL pad)*/
+ copystr( ROOTDIR, /* mount point*/
+ mp->mnt_stat.f_mntonname, /* save area*/
+ MNAMELEN - 1, /* max size*/
+ &size); /* real size*/
+ bzero( mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
+
+ /* Save "mounted from" info for mount point (NULL pad)*/
+ copystr( ROOTNAME, /* device name*/
+ mp->mnt_stat.f_mntfromname, /* save area*/
+ MNAMELEN - 1, /* max size*/
+ &size); /* real size*/
+ bzero( mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
+
+ /*
+ * Attempt the mount
+ */
+ err = VFS_MOUNT( mp, NULL, NULL, NULL, p);
+ if( err)
+ goto error_2;
+
+ /* Add fs to list of mounted file systems*/
+ CIRCLEQ_INSERT_TAIL( &mountlist, mp, mnt_list);
+
+ /* Unlock mount point*/
+ vfs_unlock(mp);
+
+ /* root mount, update system time from FS specific data*/
+ inittodr( mp->mnt_time);
+
+ goto success;
+
+error_2: /* mount error*/
+
+ /* unlock before failing*/
+ vfs_unlock( mp);
+
+error_1: /* lock error*/
+
+ /* free mount struct before failing*/
+ free( mp, M_MOUNT);
+
+success:
+ return( err);
+}
+
+
+/*
+ * EOF -- This file has not been truncated.
+ */
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 33f9ce5..1f7135a 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
- * $Id: vfs_syscalls.c,v 1.31 1995/08/11 11:31:08 davidg Exp $
+ * $Id: vfs_syscalls.c,v 1.32 1995/08/17 11:53:40 bde Exp $
*/
#include <sys/param.h>
@@ -835,11 +835,9 @@ link(p, uap, retval)
vp = nd.ni_vp;
if (vp->v_type != VDIR ||
(error = suser(p->p_ucred, &p->p_acflag)) == 0) {
- nd.ni_cnd.cn_nameiop = CREATE;
- nd.ni_cnd.cn_flags = LOCKPARENT;
+ NDINIT(&nd, CREATE, LOCKPARENT, UIO_USERSPACE, uap->link, p);
if (vp->v_type == VDIR)
- nd.ni_cnd.cn_flags |= WILLBEDIR;
- nd.ni_dirp = uap->link;
+ nd.ni_cnd.cn_flags |= WILLBEDIR;
error = namei(&nd);
if (!error) {
if (nd.ni_vp != NULL) {
OpenPOWER on IntegriCloud