Call inittodr() from main(). Let file system code set the recorded `last

update' time (if any) through the new function setrootfstime().
This commit is contained in:
pk 2004-07-05 07:28:45 +00:00
parent 2aef6e6521
commit a7c40722d8
13 changed files with 44 additions and 61 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: todclock.c,v 1.5 2003/03/23 14:12:25 chris Exp $ */ /* $NetBSD: todclock.c,v 1.6 2004/07/05 07:28:45 pk Exp $ */
/* /*
* Copyright (c) 1994-1997 Mark Brinicombe. * Copyright (c) 1994-1997 Mark Brinicombe.
@ -44,7 +44,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: todclock.c,v 1.5 2003/03/23 14:12:25 chris Exp $"); __KERNEL_RCSID(0, "$NetBSD: todclock.c,v 1.6 2004/07/05 07:28:45 pk Exp $");
/* Include header files */ /* Include header files */
@ -146,14 +146,6 @@ todclockattach(parent, self, aux)
todclock_sc->sc_rtc_read = ta->ta_rtc_read; todclock_sc->sc_rtc_read = ta->ta_rtc_read;
printf("\n"); printf("\n");
/*
* Initialise the time of day register.
* This is normally left to the filing system to do but not all
* filing systems call it e.g. cd9660
*/
inittodr(0);
} }
static __inline int static __inline int

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.6 2003/07/15 01:29:22 lukem Exp $ */ /* $NetBSD: clock.c,v 1.7 2004/07/05 07:28:45 pk Exp $ */
/* /*
* Copyright (c) 2000 Soren S. Jorvang. All rights reserved. * Copyright (c) 2000 Soren S. Jorvang. All rights reserved.
@ -26,7 +26,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.6 2003/07/15 01:29:22 lukem Exp $"); __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.7 2004/07/05 07:28:45 pk Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/proc.h> #include <sys/proc.h>
@ -46,7 +46,6 @@ void setstatclockrate(int);
void void
cpu_initclocks() cpu_initclocks()
{ {
inittodr(0);
return; return;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: todclock.c,v 1.2 2003/07/15 01:37:38 lukem Exp $ */ /* $NetBSD: todclock.c,v 1.3 2004/07/05 07:28:45 pk Exp $ */
/* /*
* Copyright (c) 1994-1997 Mark Brinicombe. * Copyright (c) 1994-1997 Mark Brinicombe.
@ -46,7 +46,7 @@
/* Include header files */ /* Include header files */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: todclock.c,v 1.2 2003/07/15 01:37:38 lukem Exp $"); __KERNEL_RCSID(0, "$NetBSD: todclock.c,v 1.3 2004/07/05 07:28:45 pk Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -136,14 +136,6 @@ todclockattach(struct device *parent, struct device *self, void *aux)
todclock_sc->sc_rtc_read = ta->ta_rtc_read; todclock_sc->sc_rtc_read = ta->ta_rtc_read;
printf("\n"); printf("\n");
/*
* Initialise the time of day register.
* This is normally left to the filing system to do but not all
* filing systems call it e.g. cd9660
*/
inittodr(0);
} }
static inline int static inline int

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.4 2003/08/07 16:28:36 agc Exp $ */ /* $NetBSD: clock.c,v 1.5 2004/07/05 07:28:45 pk Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -79,7 +79,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.4 2003/08/07 16:28:36 agc Exp $"); __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.5 2004/07/05 07:28:45 pk Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/kernel.h> #include <sys/kernel.h>
@ -92,11 +92,6 @@ __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.4 2003/08/07 16:28:36 agc Exp $");
#include <machine/mainboard.h> #include <machine/mainboard.h>
#include <machine/sysconf.h> #include <machine/sysconf.h>
void setstatclockrate __P((int));
void cpu_initclocks __P((void));
void inittodr __P((time_t));
void resettodr __P((void));
#define MINYEAR 1998 /* "today" */ #define MINYEAR 1998 /* "today" */
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: todclock.c,v 1.1 2003/09/23 15:01:50 shige Exp $ */ /* $NetBSD: todclock.c,v 1.2 2004/07/05 07:28:45 pk Exp $ */
/* /*
* Copyright (c) 1994-1997 Mark Brinicombe. * Copyright (c) 1994-1997 Mark Brinicombe.
@ -46,7 +46,7 @@
/* Include header files */ /* Include header files */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: todclock.c,v 1.1 2003/09/23 15:01:50 shige Exp $"); __KERNEL_RCSID(0, "$NetBSD: todclock.c,v 1.2 2004/07/05 07:28:45 pk Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -136,14 +136,6 @@ todclockattach(struct device *parent, struct device *self, void *aux)
todclock_sc->sc_rtc_read = ta->ta_rtc_read; todclock_sc->sc_rtc_read = ta->ta_rtc_read;
printf("\n"); printf("\n");
/*
* Initialise the time of day register.
* This is normally left to the filing system to do but not all
* filing systems call it e.g. cd9660
*/
inittodr(0);
} }
static inline int static inline int

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd9660_vfsops.c,v 1.15 2004/05/25 14:54:56 hannken Exp $ */ /* $NetBSD: cd9660_vfsops.c,v 1.16 2004/07/05 07:28:45 pk Exp $ */
/*- /*-
* Copyright (c) 1994 * Copyright (c) 1994
@ -37,7 +37,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.15 2004/05/25 14:54:56 hannken Exp $"); __KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.16 2004/07/05 07:28:45 pk Exp $");
#if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h" #include "opt_compat_netbsd.h"
@ -156,7 +156,6 @@ cd9660_mountroot()
simple_unlock(&mountlist_slock); simple_unlock(&mountlist_slock);
(void)cd9660_statvfs(mp, &mp->mnt_stat, p); (void)cd9660_statvfs(mp, &mp->mnt_stat, p);
vfs_unbusy(mp); vfs_unbusy(mp);
inittodr(0);
return (0); return (0);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: init_main.c,v 1.238 2004/06/03 20:35:30 nathanw Exp $ */ /* $NetBSD: init_main.c,v 1.239 2004/07/05 07:28:45 pk Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1989, 1991, 1992, 1993 * Copyright (c) 1982, 1986, 1989, 1991, 1992, 1993
@ -71,7 +71,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.238 2004/06/03 20:35:30 nathanw Exp $"); __KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.239 2004/07/05 07:28:45 pk Exp $");
#include "fs_nfs.h" #include "fs_nfs.h"
#include "opt_nfsserver.h" #include "opt_nfsserver.h"
@ -194,6 +194,7 @@ struct vnode *rootvp, *swapdev_vp;
int boothowto; int boothowto;
int cold = 1; /* still working on startup */ int cold = 1; /* still working on startup */
struct timeval boottime; struct timeval boottime;
time_t rootfstime; /* recorded root fs time, if known */
__volatile int start_init_exec; /* semaphore for start_init() */ __volatile int start_init_exec; /* semaphore for start_init() */
@ -522,6 +523,13 @@ main(void)
} while (error != 0); } while (error != 0);
mountroothook_destroy(); mountroothook_destroy();
/*
* Initialise the time-of-day clock, passing the time recorded
* in the root filesystem (if any) for use by systems that
* don't have a non-volatile time-of-day device.
*/
inittodr(rootfstime);
CIRCLEQ_FIRST(&mountlist)->mnt_flag |= MNT_ROOTFS; CIRCLEQ_FIRST(&mountlist)->mnt_flag |= MNT_ROOTFS;
CIRCLEQ_FIRST(&mountlist)->mnt_op->vfs_refcount++; CIRCLEQ_FIRST(&mountlist)->mnt_op->vfs_refcount++;
@ -596,6 +604,12 @@ main(void)
/* NOTREACHED */ /* NOTREACHED */
} }
void
setrootfstime(time_t t)
{
rootfstime = t;
}
static void static void
check_console(struct proc *p) check_console(struct proc *p)
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_vfsops.c,v 1.140 2004/05/25 14:54:58 hannken Exp $ */ /* $NetBSD: nfs_vfsops.c,v 1.141 2004/07/05 07:28:45 pk Exp $ */
/* /*
* Copyright (c) 1989, 1993, 1995 * Copyright (c) 1989, 1993, 1995
@ -35,7 +35,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.140 2004/05/25 14:54:58 hannken Exp $"); __KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.141 2004/07/05 07:28:45 pk Exp $");
#if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h" #include "opt_compat_netbsd.h"
@ -357,7 +357,7 @@ nfs_mountroot()
#ifdef DEBUG #ifdef DEBUG
printf("root time: 0x%lx\n", n); printf("root time: 0x%lx\n", n);
#endif #endif
inittodr(n); setrootfstime(n);
out: out:
if (error) if (error)

View File

@ -1,4 +1,4 @@
/* $NetBSD: systm.h,v 1.172 2004/05/18 11:59:11 yamt Exp $ */ /* $NetBSD: systm.h,v 1.173 2004/07/05 07:28:45 pk Exp $ */
/*- /*-
* Copyright (c) 1982, 1988, 1991, 1993 * Copyright (c) 1982, 1988, 1991, 1993
@ -274,6 +274,7 @@ void initclocks __P((void));
void inittodr __P((time_t)); void inittodr __P((time_t));
void resettodr __P((void)); void resettodr __P((void));
void cpu_initclocks __P((void)); void cpu_initclocks __P((void));
void setrootfstime __P((time_t));
void startprofclock __P((struct proc *)); void startprofclock __P((struct proc *));
void stopprofclock __P((struct proc *)); void stopprofclock __P((struct proc *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_vfsops.c,v 1.72 2004/05/25 14:54:58 hannken Exp $ */ /* $NetBSD: ext2fs_vfsops.c,v 1.73 2004/07/05 07:28:45 pk Exp $ */
/* /*
* Copyright (c) 1989, 1991, 1993, 1994 * Copyright (c) 1989, 1991, 1993, 1994
@ -65,7 +65,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.72 2004/05/25 14:54:58 hannken Exp $"); __KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.73 2004/07/05 07:28:45 pk Exp $");
#if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h" #include "opt_compat_netbsd.h"
@ -238,7 +238,7 @@ ext2fs_mountroot()
} }
(void)ext2fs_statvfs(mp, &mp->mnt_stat, p); (void)ext2fs_statvfs(mp, &mp->mnt_stat, p);
vfs_unbusy(mp); vfs_unbusy(mp);
inittodr(fs->e2fs.e2fs_wtime); setrootfstime((time_t)fs->e2fs.e2fs_wtime);
return (0); return (0);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_vfsops.c,v 1.150 2004/05/27 17:04:52 hannken Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.151 2004/07/05 07:28:46 pk Exp $ */
/* /*
* Copyright (c) 1989, 1991, 1993, 1994 * Copyright (c) 1989, 1991, 1993, 1994
@ -32,7 +32,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.150 2004/05/27 17:04:52 hannken Exp $"); __KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.151 2004/07/05 07:28:46 pk Exp $");
#if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT)
#include "opt_ffs.h" #include "opt_ffs.h"
@ -170,7 +170,7 @@ ffs_mountroot()
(void)copystr(mp->mnt_stat.f_mntonname, fs->fs_fsmnt, MNAMELEN - 1, 0); (void)copystr(mp->mnt_stat.f_mntonname, fs->fs_fsmnt, MNAMELEN - 1, 0);
(void)ffs_statvfs(mp, &mp->mnt_stat, p); (void)ffs_statvfs(mp, &mp->mnt_stat, p);
vfs_unbusy(mp); vfs_unbusy(mp);
inittodr(fs->fs_time); setrootfstime((time_t)fs->fs_time);
return (0); return (0);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vfsops.c,v 1.153 2004/05/30 20:45:44 yamt Exp $ */ /* $NetBSD: lfs_vfsops.c,v 1.154 2004/07/05 07:28:46 pk Exp $ */
/*- /*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.153 2004/05/30 20:45:44 yamt Exp $"); __KERNEL_RCSID(0, "$NetBSD: lfs_vfsops.c,v 1.154 2004/07/05 07:28:46 pk Exp $");
#if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT)
#include "opt_quota.h" #include "opt_quota.h"
@ -330,7 +330,7 @@ lfs_mountroot()
simple_unlock(&mountlist_slock); simple_unlock(&mountlist_slock);
(void)lfs_statvfs(mp, &mp->mnt_stat, p); (void)lfs_statvfs(mp, &mp->mnt_stat, p);
vfs_unbusy(mp); vfs_unbusy(mp);
inittodr(VFSTOUFS(mp)->um_lfs->lfs_tstamp); setrootfstime((time_t)(VFSTOUFS(mp)->um_lfs->lfs_tstamp));
return (0); return (0);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: mfs_vfsops.c,v 1.60 2004/05/25 14:55:46 hannken Exp $ */ /* $NetBSD: mfs_vfsops.c,v 1.61 2004/07/05 07:28:46 pk Exp $ */
/* /*
* Copyright (c) 1989, 1990, 1993, 1994 * Copyright (c) 1989, 1990, 1993, 1994
@ -32,7 +32,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.60 2004/05/25 14:55:46 hannken Exp $"); __KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.61 2004/07/05 07:28:46 pk Exp $");
#if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h" #include "opt_compat_netbsd.h"
@ -217,7 +217,6 @@ mfs_mountroot()
(void) copystr(mp->mnt_stat.f_mntonname, fs->fs_fsmnt, MNAMELEN - 1, 0); (void) copystr(mp->mnt_stat.f_mntonname, fs->fs_fsmnt, MNAMELEN - 1, 0);
(void)ffs_statvfs(mp, &mp->mnt_stat, p); (void)ffs_statvfs(mp, &mp->mnt_stat, p);
vfs_unbusy(mp); vfs_unbusy(mp);
inittodr((time_t)0);
return (0); return (0);
} }