summaryrefslogtreecommitdiff
path: root/sys/ufs/ffs/ffs_alloc.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-02-11 06:59:29 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-02-11 06:59:29 +0000
commit64a0a3ed07a7a71f54bb19d88202fef9497b97ea (patch)
tree11dab50b1383c00774395ef432e6e57d63eca61d /sys/ufs/ffs/ffs_alloc.c
parent6e5f89c7ffde3de1b7bb1391be86dda93af6bd35 (diff)
Add fs_id support and random inode generation numbers for ffs.
Diffstat (limited to 'sys/ufs/ffs/ffs_alloc.c')
-rw-r--r--sys/ufs/ffs/ffs_alloc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
index 666560caf32..cd81395a3e3 100644
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_alloc.c,v 1.4 1996/05/22 11:47:17 deraadt Exp $ */
+/* $OpenBSD: ffs_alloc.c,v 1.5 1997/02/11 06:59:27 millert Exp $ */
/* $NetBSD: ffs_alloc.c,v 1.11 1996/05/11 18:27:09 mycroft Exp $ */
/*
@@ -47,6 +47,8 @@
#include <vm/vm.h>
+#include <dev/rndvar.h>
+
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>
#include <ufs/ufs/ufs_extern.h>
@@ -563,10 +565,13 @@ ffs_valloc(v)
ip->i_flags = 0;
/*
* Set up a new generation number for this inode.
+ * XXX - just increment for now, this is wrong! (millert)
+ * Need a way to preserve randomization.
*/
- if (++nextgennumber < (u_long)time.tv_sec)
- nextgennumber = time.tv_sec;
- ip->i_gen = nextgennumber;
+ if (ip->i_gen == 0 || ++(ip->i_gen) == 0)
+ ip->i_gen = arc4random();
+ if (ip->i_gen == 0 || ip->i_gen == -1)
+ ip->i_gen = 1; /* shouldn't happen */
return (0);
noinodes:
ffs_fserr(fs, ap->a_cred->cr_uid, "out of inodes");