]> git.proxmox.com Git - mirror_spl.git/blame - include/sys/random.h
Update rwlocks to track owner to ensure correct semantics
[mirror_spl.git] / include / sys / random.h
CommitLineData
715f6251 1/*
2 * This file is part of the SPL: Solaris Porting Layer.
3 *
4 * Copyright (c) 2008 Lawrence Livermore National Security, LLC.
5 * Produced at Lawrence Livermore National Laboratory
6 * Written by:
7 * Brian Behlendorf <behlendorf1@llnl.gov>,
8 * Herb Wartens <wartens2@llnl.gov>,
9 * Jim Garlick <garlick@llnl.gov>
10 * UCRL-CODE-235197
11 *
12 * This is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 */
26
09b414e8 27#ifndef _SPL_RANDOM_H
28#define _SPL_RANDOM_H
f1ca4da6 29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
f1b59d26 34#include <linux/module.h>
f1ca4da6 35#include <linux/random.h>
36
37/* FIXME:
38 * Should add support for blocking in the future to
39 * ensure that proper entopy is collected. ZFS doesn't
40 * use it at the moment so this is good enough for now.
41 * Always will succeed by returning 0.
42 */
43static __inline__ int
44random_get_bytes(uint8_t *ptr, size_t len)
45{
f1ca4da6 46 get_random_bytes((void *)ptr,(int)len);
47 return 0;
48}
49
50 /* Always will succeed by returning 0. */
51static __inline__ int
52random_get_pseudo_bytes(uint8_t *ptr, size_t len)
53{
f1ca4da6 54 get_random_bytes((void *)ptr,(int)len);
55 return 0;
56}
57
58#ifdef __cplusplus
59}
60#endif
61
09b414e8 62#endif /* _SPL_RANDOM_H */