virtio: avoid leading underscores for helpers
[qemu.git] / include / hw / virtio / virtio-rng.h
blob3f07de70c783e7c7de3aa7c4f1d9e4d53464e56a
1 /*
2 * Virtio RNG Support
4 * Copyright Red Hat, Inc. 2012
5 * Copyright Amit Shah <amit.shah@redhat.com>
7 * This work is licensed under the terms of the GNU GPL, version 2 or
8 * (at your option) any later version. See the COPYING file in the
9 * top-level directory.
12 #ifndef _QEMU_VIRTIO_RNG_H
13 #define _QEMU_VIRTIO_RNG_H
15 #include "sysemu/rng.h"
16 #include "sysemu/rng-random.h"
17 #include "standard-headers/linux/virtio_rng.h"
19 #define TYPE_VIRTIO_RNG "virtio-rng-device"
20 #define VIRTIO_RNG(obj) \
21 OBJECT_CHECK(VirtIORNG, (obj), TYPE_VIRTIO_RNG)
22 #define VIRTIO_RNG_GET_PARENT_CLASS(obj) \
23 OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_RNG)
25 struct VirtIORNGConf {
26 RngBackend *rng;
27 uint64_t max_bytes;
28 uint32_t period_ms;
29 RndRandom *default_backend;
32 typedef struct VirtIORNG {
33 VirtIODevice parent_obj;
35 /* Only one vq - guest puts buffer(s) on it when it needs entropy */
36 VirtQueue *vq;
38 VirtIORNGConf conf;
40 RngBackend *rng;
42 /* We purposefully don't migrate this state. The quota will reset on the
43 * destination as a result. Rate limiting is host state, not guest state.
45 QEMUTimer *rate_limit_timer;
46 int64_t quota_remaining;
47 bool activate_timer;
48 } VirtIORNG;
50 #endif