rng.c (2d3b7c0164e1b9287304bc70dd6ed071ba3e8dfc) | rng.c (443590c2044968a97f5e7cddd35100c6075856a4) |
---|---|
1/* 2 * QEMU Random Number Generator Backend 3 * 4 * Copyright IBM, Corp. 2012 5 * 6 * Authors: 7 * Anthony Liguori <aliguori@us.ibm.com> 8 * --- 19 unchanged lines hidden (view full) --- 28 req->offset = 0; 29 req->size = size; 30 req->receive_entropy = receive_entropy; 31 req->opaque = opaque; 32 req->data = g_malloc(req->size); 33 34 k->request_entropy(s, req); 35 | 1/* 2 * QEMU Random Number Generator Backend 3 * 4 * Copyright IBM, Corp. 2012 5 * 6 * Authors: 7 * Anthony Liguori <aliguori@us.ibm.com> 8 * --- 19 unchanged lines hidden (view full) --- 28 req->offset = 0; 29 req->size = size; 30 req->receive_entropy = receive_entropy; 31 req->opaque = opaque; 32 req->data = g_malloc(req->size); 33 34 k->request_entropy(s, req); 35 |
36 s->requests = g_slist_append(s->requests, req); | 36 QSIMPLEQ_INSERT_TAIL(&s->requests, req, next); |
37 } 38} 39 40static bool rng_backend_prop_get_opened(Object *obj, Error **errp) 41{ 42 RngBackend *s = RNG_BACKEND(obj); 43 44 return s->opened; --- 33 unchanged lines hidden (view full) --- 78static void rng_backend_free_request(RngRequest *req) 79{ 80 g_free(req->data); 81 g_free(req); 82} 83 84static void rng_backend_free_requests(RngBackend *s) 85{ | 37 } 38} 39 40static bool rng_backend_prop_get_opened(Object *obj, Error **errp) 41{ 42 RngBackend *s = RNG_BACKEND(obj); 43 44 return s->opened; --- 33 unchanged lines hidden (view full) --- 78static void rng_backend_free_request(RngRequest *req) 79{ 80 g_free(req->data); 81 g_free(req); 82} 83 84static void rng_backend_free_requests(RngBackend *s) 85{ |
86 GSList *i; | 86 RngRequest *req, *next; |
87 | 87 |
88 for (i = s->requests; i; i = i->next) { 89 rng_backend_free_request(i->data); | 88 QSIMPLEQ_FOREACH_SAFE(req, &s->requests, next, next) { 89 rng_backend_free_request(req); |
90 } 91 | 90 } 91 |
92 g_slist_free(s->requests); 93 s->requests = NULL; | 92 QSIMPLEQ_INIT(&s->requests); |
94} 95 96void rng_backend_finalize_request(RngBackend *s, RngRequest *req) 97{ | 93} 94 95void rng_backend_finalize_request(RngBackend *s, RngRequest *req) 96{ |
98 s->requests = g_slist_remove(s->requests, req); | 97 QSIMPLEQ_REMOVE(&s->requests, req, RngRequest, next); |
99 rng_backend_free_request(req); 100} 101 102static void rng_backend_init(Object *obj) 103{ | 98 rng_backend_free_request(req); 99} 100 101static void rng_backend_init(Object *obj) 102{ |
103 RngBackend *s = RNG_BACKEND(obj); 104 105 QSIMPLEQ_INIT(&s->requests); 106 |
|
104 object_property_add_bool(obj, "opened", 105 rng_backend_prop_get_opened, 106 rng_backend_prop_set_opened, 107 NULL); 108} 109 110static void rng_backend_finalize(Object *obj) 111{ --- 33 unchanged lines hidden --- | 107 object_property_add_bool(obj, "opened", 108 rng_backend_prop_get_opened, 109 rng_backend_prop_set_opened, 110 NULL); 111} 112 113static void rng_backend_finalize(Object *obj) 114{ --- 33 unchanged lines hidden --- |