Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs/tmpfs tmpfs_alloc_node: use cprng_fast64(), the old r...



details:   https://anonhg.NetBSD.org/src/rev/4cab2812f27e
branches:  trunk
changeset: 791283:4cab2812f27e
user:      rmind <rmind%NetBSD.org@localhost>
date:      Mon Nov 11 17:04:06 2013 +0000

description:
tmpfs_alloc_node: use cprng_fast64(), the old random(9) shall be removed.

diffstat:

 sys/fs/tmpfs/tmpfs_subr.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 9cb9fffc0e0a -r 4cab2812f27e sys/fs/tmpfs/tmpfs_subr.c
--- a/sys/fs/tmpfs/tmpfs_subr.c Mon Nov 11 17:02:53 2013 +0000
+++ b/sys/fs/tmpfs/tmpfs_subr.c Mon Nov 11 17:04:06 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tmpfs_subr.c,v 1.85 2013/11/10 12:46:19 rmind Exp $    */
+/*     $NetBSD: tmpfs_subr.c,v 1.86 2013/11/11 17:04:06 rmind Exp $    */
 
 /*
  * Copyright (c) 2005-2013 The NetBSD Foundation, Inc.
@@ -74,9 +74,10 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.85 2013/11/10 12:46:19 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.86 2013/11/11 17:04:06 rmind Exp $");
 
 #include <sys/param.h>
+#include <sys/cprng.h>
 #include <sys/dirent.h>
 #include <sys/event.h>
 #include <sys/kmem.h>
@@ -126,7 +127,7 @@
         * for applications that do not understand 64-bit ino_t.
         */
        nnode->tn_id = (ino_t)((uintptr_t)nnode / sizeof(*nnode));
-       nnode->tn_gen = TMPFS_NODE_GEN_MASK & random();
+       nnode->tn_gen = TMPFS_NODE_GEN_MASK & (unsigned long)cprng_fast64();
 
        /* Generic initialization. */
        nnode->tn_type = type;



Home | Main Index | Thread Index | Old Index