Revision 1de7afc9
b/acl.c | ||
---|---|---|
24 | 24 |
|
25 | 25 |
|
26 | 26 |
#include "qemu-common.h" |
27 |
#include "acl.h" |
|
27 |
#include "qemu/acl.h"
|
|
28 | 28 |
|
29 | 29 |
#ifdef CONFIG_FNMATCH |
30 | 30 |
#include <fnmatch.h> |
/dev/null | ||
---|---|---|
1 |
/* |
|
2 |
* QEMU access control list management |
|
3 |
* |
|
4 |
* Copyright (C) 2009 Red Hat, Inc |
|
5 |
* |
|
6 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|
7 |
* of this software and associated documentation files (the "Software"), to deal |
|
8 |
* in the Software without restriction, including without limitation the rights |
|
9 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
* copies of the Software, and to permit persons to whom the Software is |
|
11 |
* furnished to do so, subject to the following conditions: |
|
12 |
* |
|
13 |
* The above copyright notice and this permission notice shall be included in |
|
14 |
* all copies or substantial portions of the Software. |
|
15 |
* |
|
16 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
17 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
18 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
19 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
20 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
21 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
22 |
* THE SOFTWARE. |
|
23 |
*/ |
|
24 |
|
|
25 |
#ifndef __QEMU_ACL_H__ |
|
26 |
#define __QEMU_ACL_H__ |
|
27 |
|
|
28 |
#include "qemu-queue.h" |
|
29 |
|
|
30 |
typedef struct qemu_acl_entry qemu_acl_entry; |
|
31 |
typedef struct qemu_acl qemu_acl; |
|
32 |
|
|
33 |
struct qemu_acl_entry { |
|
34 |
char *match; |
|
35 |
int deny; |
|
36 |
|
|
37 |
QTAILQ_ENTRY(qemu_acl_entry) next; |
|
38 |
}; |
|
39 |
|
|
40 |
struct qemu_acl { |
|
41 |
char *aclname; |
|
42 |
unsigned int nentries; |
|
43 |
QTAILQ_HEAD(,qemu_acl_entry) entries; |
|
44 |
int defaultDeny; |
|
45 |
}; |
|
46 |
|
|
47 |
qemu_acl *qemu_acl_init(const char *aclname); |
|
48 |
|
|
49 |
qemu_acl *qemu_acl_find(const char *aclname); |
|
50 |
|
|
51 |
int qemu_acl_party_is_allowed(qemu_acl *acl, |
|
52 |
const char *party); |
|
53 |
|
|
54 |
void qemu_acl_reset(qemu_acl *acl); |
|
55 |
|
|
56 |
int qemu_acl_append(qemu_acl *acl, |
|
57 |
int deny, |
|
58 |
const char *match); |
|
59 |
int qemu_acl_insert(qemu_acl *acl, |
|
60 |
int deny, |
|
61 |
const char *match, |
|
62 |
int index); |
|
63 |
int qemu_acl_remove(qemu_acl *acl, |
|
64 |
const char *match); |
|
65 |
|
|
66 |
#endif /* __QEMU_ACL_H__ */ |
|
67 |
|
|
68 |
/* |
|
69 |
* Local variables: |
|
70 |
* c-indent-level: 4 |
|
71 |
* c-basic-offset: 4 |
|
72 |
* tab-width: 8 |
|
73 |
* End: |
|
74 |
*/ |
b/aio-posix.c | ||
---|---|---|
15 | 15 |
|
16 | 16 |
#include "qemu-common.h" |
17 | 17 |
#include "block/block.h" |
18 |
#include "qemu-queue.h"
|
|
19 |
#include "qemu_socket.h"
|
|
18 |
#include "qemu/queue.h"
|
|
19 |
#include "qemu/sockets.h"
|
|
20 | 20 |
|
21 | 21 |
struct AioHandler |
22 | 22 |
{ |
b/aio-win32.c | ||
---|---|---|
17 | 17 |
|
18 | 18 |
#include "qemu-common.h" |
19 | 19 |
#include "block/block.h" |
20 |
#include "qemu-queue.h"
|
|
21 |
#include "qemu_socket.h"
|
|
20 |
#include "qemu/queue.h"
|
|
21 |
#include "qemu/sockets.h"
|
|
22 | 22 |
|
23 | 23 |
struct AioHandler { |
24 | 24 |
EventNotifier *e; |
b/arch_init.c | ||
---|---|---|
31 | 31 |
#include "config.h" |
32 | 32 |
#include "monitor/monitor.h" |
33 | 33 |
#include "sysemu.h" |
34 |
#include "bitops.h" |
|
35 |
#include "bitmap.h" |
|
34 |
#include "qemu/bitops.h"
|
|
35 |
#include "qemu/bitmap.h"
|
|
36 | 36 |
#include "arch_init.h" |
37 | 37 |
#include "audio/audio.h" |
38 | 38 |
#include "hw/pc.h" |
... | ... | |
45 | 45 |
#include "exec/address-spaces.h" |
46 | 46 |
#include "hw/pcspk.h" |
47 | 47 |
#include "migration/page_cache.h" |
48 |
#include "qemu-config.h"
|
|
48 |
#include "qemu/config-file.h"
|
|
49 | 49 |
#include "qmp-commands.h" |
50 | 50 |
#include "trace.h" |
51 | 51 |
|
b/async.c | ||
---|---|---|
24 | 24 |
|
25 | 25 |
#include "qemu-common.h" |
26 | 26 |
#include "block/aio.h" |
27 |
#include "main-loop.h" |
|
27 |
#include "qemu/main-loop.h"
|
|
28 | 28 |
|
29 | 29 |
/***********************************************************/ |
30 | 30 |
/* bottom halves (can be seen as timers which expire ASAP) */ |
b/audio/alsaaudio.c | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
#include <alsa/asoundlib.h> |
25 | 25 |
#include "qemu-common.h" |
26 |
#include "main-loop.h" |
|
26 |
#include "qemu/main-loop.h"
|
|
27 | 27 |
#include "audio.h" |
28 | 28 |
|
29 | 29 |
#if QEMU_GNUC_PREREQ(4, 3) |
b/audio/audio.c | ||
---|---|---|
24 | 24 |
#include "hw/hw.h" |
25 | 25 |
#include "audio.h" |
26 | 26 |
#include "monitor/monitor.h" |
27 |
#include "qemu-timer.h"
|
|
27 |
#include "qemu/timer.h"
|
|
28 | 28 |
#include "sysemu.h" |
29 | 29 |
|
30 | 30 |
#define AUDIO_CAP "audio" |
b/audio/audio.h | ||
---|---|---|
25 | 25 |
#define QEMU_AUDIO_H |
26 | 26 |
|
27 | 27 |
#include "config-host.h" |
28 |
#include "qemu-queue.h"
|
|
28 |
#include "qemu/queue.h"
|
|
29 | 29 |
|
30 | 30 |
typedef void (*audio_callback_fn) (void *opaque, int avail); |
31 | 31 |
|
b/audio/noaudio.c | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
#include "qemu-common.h" |
25 | 25 |
#include "audio.h" |
26 |
#include "qemu-timer.h"
|
|
26 |
#include "qemu/timer.h"
|
|
27 | 27 |
|
28 | 28 |
#define AUDIO_CAP "noaudio" |
29 | 29 |
#include "audio_int.h" |
b/audio/ossaudio.c | ||
---|---|---|
31 | 31 |
#include <sys/soundcard.h> |
32 | 32 |
#endif |
33 | 33 |
#include "qemu-common.h" |
34 |
#include "main-loop.h" |
|
35 |
#include "host-utils.h" |
|
34 |
#include "qemu/main-loop.h"
|
|
35 |
#include "qemu/host-utils.h"
|
|
36 | 36 |
#include "audio.h" |
37 | 37 |
|
38 | 38 |
#define AUDIO_CAP "oss" |
b/audio/spiceaudio.c | ||
---|---|---|
18 | 18 |
*/ |
19 | 19 |
|
20 | 20 |
#include "hw/hw.h" |
21 |
#include "qemu-timer.h"
|
|
21 |
#include "qemu/timer.h"
|
|
22 | 22 |
#include "ui/qemu-spice.h" |
23 | 23 |
|
24 | 24 |
#define AUDIO_CAP "spice" |
b/audio/wavaudio.c | ||
---|---|---|
22 | 22 |
* THE SOFTWARE. |
23 | 23 |
*/ |
24 | 24 |
#include "hw/hw.h" |
25 |
#include "qemu-timer.h"
|
|
25 |
#include "qemu/timer.h"
|
|
26 | 26 |
#include "audio.h" |
27 | 27 |
|
28 | 28 |
#define AUDIO_CAP "wav" |
b/backends/rng-random.c | ||
---|---|---|
13 | 13 |
#include "qemu/rng-random.h" |
14 | 14 |
#include "qemu/rng.h" |
15 | 15 |
#include "qapi/qmp/qerror.h" |
16 |
#include "main-loop.h" |
|
16 |
#include "qemu/main-loop.h"
|
|
17 | 17 |
|
18 | 18 |
struct RndRandom |
19 | 19 |
{ |
b/bitmap.c | ||
---|---|---|
9 | 9 |
* Version 2. |
10 | 10 |
*/ |
11 | 11 |
|
12 |
#include "bitops.h" |
|
13 |
#include "bitmap.h" |
|
12 |
#include "qemu/bitops.h"
|
|
13 |
#include "qemu/bitmap.h"
|
|
14 | 14 |
|
15 | 15 |
/* |
16 | 16 |
* bitmaps provide an array of bits, implemented using an an |
/dev/null | ||
---|---|---|
1 |
/* |
|
2 |
* Bitmap Module |
|
3 |
* |
|
4 |
* Copyright (C) 2010 Corentin Chary <corentin.chary@gmail.com> |
|
5 |
* |
|
6 |
* Mostly inspired by (stolen from) linux/bitmap.h and linux/bitops.h |
|
7 |
* |
|
8 |
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later. |
|
9 |
* See the COPYING.LIB file in the top-level directory. |
|
10 |
*/ |
|
11 |
|
|
12 |
#ifndef BITMAP_H |
|
13 |
#define BITMAP_H |
|
14 |
|
|
15 |
#include "qemu-common.h" |
|
16 |
#include "bitops.h" |
|
17 |
|
|
18 |
/* |
|
19 |
* The available bitmap operations and their rough meaning in the |
|
20 |
* case that the bitmap is a single unsigned long are thus: |
|
21 |
* |
|
22 |
* Note that nbits should be always a compile time evaluable constant. |
|
23 |
* Otherwise many inlines will generate horrible code. |
|
24 |
* |
|
25 |
* bitmap_zero(dst, nbits) *dst = 0UL |
|
26 |
* bitmap_fill(dst, nbits) *dst = ~0UL |
|
27 |
* bitmap_copy(dst, src, nbits) *dst = *src |
|
28 |
* bitmap_and(dst, src1, src2, nbits) *dst = *src1 & *src2 |
|
29 |
* bitmap_or(dst, src1, src2, nbits) *dst = *src1 | *src2 |
|
30 |
* bitmap_xor(dst, src1, src2, nbits) *dst = *src1 ^ *src2 |
|
31 |
* bitmap_andnot(dst, src1, src2, nbits) *dst = *src1 & ~(*src2) |
|
32 |
* bitmap_complement(dst, src, nbits) *dst = ~(*src) |
|
33 |
* bitmap_equal(src1, src2, nbits) Are *src1 and *src2 equal? |
|
34 |
* bitmap_intersects(src1, src2, nbits) Do *src1 and *src2 overlap? |
|
35 |
* bitmap_empty(src, nbits) Are all bits zero in *src? |
|
36 |
* bitmap_full(src, nbits) Are all bits set in *src? |
|
37 |
* bitmap_set(dst, pos, nbits) Set specified bit area |
|
38 |
* bitmap_clear(dst, pos, nbits) Clear specified bit area |
|
39 |
* bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area |
|
40 |
*/ |
|
41 |
|
|
42 |
/* |
|
43 |
* Also the following operations apply to bitmaps. |
|
44 |
* |
|
45 |
* set_bit(bit, addr) *addr |= bit |
|
46 |
* clear_bit(bit, addr) *addr &= ~bit |
|
47 |
* change_bit(bit, addr) *addr ^= bit |
|
48 |
* test_bit(bit, addr) Is bit set in *addr? |
|
49 |
* test_and_set_bit(bit, addr) Set bit and return old value |
|
50 |
* test_and_clear_bit(bit, addr) Clear bit and return old value |
|
51 |
* test_and_change_bit(bit, addr) Change bit and return old value |
|
52 |
* find_first_zero_bit(addr, nbits) Position first zero bit in *addr |
|
53 |
* find_first_bit(addr, nbits) Position first set bit in *addr |
|
54 |
* find_next_zero_bit(addr, nbits, bit) Position next zero bit in *addr >= bit |
|
55 |
* find_next_bit(addr, nbits, bit) Position next set bit in *addr >= bit |
|
56 |
*/ |
|
57 |
|
|
58 |
#define BITMAP_LAST_WORD_MASK(nbits) \ |
|
59 |
( \ |
|
60 |
((nbits) % BITS_PER_LONG) ? \ |
|
61 |
(1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL \ |
|
62 |
) |
|
63 |
|
|
64 |
#define DECLARE_BITMAP(name,bits) \ |
|
65 |
unsigned long name[BITS_TO_LONGS(bits)] |
|
66 |
|
|
67 |
#define small_nbits(nbits) \ |
|
68 |
((nbits) <= BITS_PER_LONG) |
|
69 |
|
|
70 |
int slow_bitmap_empty(const unsigned long *bitmap, int bits); |
|
71 |
int slow_bitmap_full(const unsigned long *bitmap, int bits); |
|
72 |
int slow_bitmap_equal(const unsigned long *bitmap1, |
|
73 |
const unsigned long *bitmap2, int bits); |
|
74 |
void slow_bitmap_complement(unsigned long *dst, const unsigned long *src, |
|
75 |
int bits); |
|
76 |
void slow_bitmap_shift_right(unsigned long *dst, |
|
77 |
const unsigned long *src, int shift, int bits); |
|
78 |
void slow_bitmap_shift_left(unsigned long *dst, |
|
79 |
const unsigned long *src, int shift, int bits); |
|
80 |
int slow_bitmap_and(unsigned long *dst, const unsigned long *bitmap1, |
|
81 |
const unsigned long *bitmap2, int bits); |
|
82 |
void slow_bitmap_or(unsigned long *dst, const unsigned long *bitmap1, |
|
83 |
const unsigned long *bitmap2, int bits); |
|
84 |
void slow_bitmap_xor(unsigned long *dst, const unsigned long *bitmap1, |
|
85 |
const unsigned long *bitmap2, int bits); |
|
86 |
int slow_bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1, |
|
87 |
const unsigned long *bitmap2, int bits); |
|
88 |
int slow_bitmap_intersects(const unsigned long *bitmap1, |
|
89 |
const unsigned long *bitmap2, int bits); |
|
90 |
|
|
91 |
static inline unsigned long *bitmap_new(int nbits) |
|
92 |
{ |
|
93 |
int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); |
|
94 |
return g_malloc0(len); |
|
95 |
} |
|
96 |
|
|
97 |
static inline void bitmap_zero(unsigned long *dst, int nbits) |
|
98 |
{ |
|
99 |
if (small_nbits(nbits)) { |
|
100 |
*dst = 0UL; |
|
101 |
} else { |
|
102 |
int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); |
|
103 |
memset(dst, 0, len); |
|
104 |
} |
|
105 |
} |
|
106 |
|
|
107 |
static inline void bitmap_fill(unsigned long *dst, int nbits) |
|
108 |
{ |
|
109 |
size_t nlongs = BITS_TO_LONGS(nbits); |
|
110 |
if (!small_nbits(nbits)) { |
|
111 |
int len = (nlongs - 1) * sizeof(unsigned long); |
|
112 |
memset(dst, 0xff, len); |
|
113 |
} |
|
114 |
dst[nlongs - 1] = BITMAP_LAST_WORD_MASK(nbits); |
|
115 |
} |
|
116 |
|
|
117 |
static inline void bitmap_copy(unsigned long *dst, const unsigned long *src, |
|
118 |
int nbits) |
|
119 |
{ |
|
120 |
if (small_nbits(nbits)) { |
|
121 |
*dst = *src; |
|
122 |
} else { |
|
123 |
int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); |
|
124 |
memcpy(dst, src, len); |
|
125 |
} |
|
126 |
} |
|
127 |
|
|
128 |
static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, |
|
129 |
const unsigned long *src2, int nbits) |
|
130 |
{ |
|
131 |
if (small_nbits(nbits)) { |
|
132 |
return (*dst = *src1 & *src2) != 0; |
|
133 |
} |
|
134 |
return slow_bitmap_and(dst, src1, src2, nbits); |
|
135 |
} |
|
136 |
|
|
137 |
static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, |
|
138 |
const unsigned long *src2, int nbits) |
|
139 |
{ |
|
140 |
if (small_nbits(nbits)) { |
|
141 |
*dst = *src1 | *src2; |
|
142 |
} else { |
|
143 |
slow_bitmap_or(dst, src1, src2, nbits); |
|
144 |
} |
|
145 |
} |
|
146 |
|
|
147 |
static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, |
|
148 |
const unsigned long *src2, int nbits) |
|
149 |
{ |
|
150 |
if (small_nbits(nbits)) { |
|
151 |
*dst = *src1 ^ *src2; |
|
152 |
} else { |
|
153 |
slow_bitmap_xor(dst, src1, src2, nbits); |
|
154 |
} |
|
155 |
} |
|
156 |
|
|
157 |
static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1, |
|
158 |
const unsigned long *src2, int nbits) |
|
159 |
{ |
|
160 |
if (small_nbits(nbits)) { |
|
161 |
return (*dst = *src1 & ~(*src2)) != 0; |
|
162 |
} |
|
163 |
return slow_bitmap_andnot(dst, src1, src2, nbits); |
|
164 |
} |
|
165 |
|
|
166 |
static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, |
|
167 |
int nbits) |
|
168 |
{ |
|
169 |
if (small_nbits(nbits)) { |
|
170 |
*dst = ~(*src) & BITMAP_LAST_WORD_MASK(nbits); |
|
171 |
} else { |
|
172 |
slow_bitmap_complement(dst, src, nbits); |
|
173 |
} |
|
174 |
} |
|
175 |
|
|
176 |
static inline int bitmap_equal(const unsigned long *src1, |
|
177 |
const unsigned long *src2, int nbits) |
|
178 |
{ |
|
179 |
if (small_nbits(nbits)) { |
|
180 |
return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits)); |
|
181 |
} else { |
|
182 |
return slow_bitmap_equal(src1, src2, nbits); |
|
183 |
} |
|
184 |
} |
|
185 |
|
|
186 |
static inline int bitmap_empty(const unsigned long *src, int nbits) |
|
187 |
{ |
|
188 |
if (small_nbits(nbits)) { |
|
189 |
return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); |
|
190 |
} else { |
|
191 |
return slow_bitmap_empty(src, nbits); |
|
192 |
} |
|
193 |
} |
|
194 |
|
|
195 |
static inline int bitmap_full(const unsigned long *src, int nbits) |
|
196 |
{ |
|
197 |
if (small_nbits(nbits)) { |
|
198 |
return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); |
|
199 |
} else { |
|
200 |
return slow_bitmap_full(src, nbits); |
|
201 |
} |
|
202 |
} |
|
203 |
|
|
204 |
static inline int bitmap_intersects(const unsigned long *src1, |
|
205 |
const unsigned long *src2, int nbits) |
|
206 |
{ |
|
207 |
if (small_nbits(nbits)) { |
|
208 |
return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0; |
|
209 |
} else { |
|
210 |
return slow_bitmap_intersects(src1, src2, nbits); |
|
211 |
} |
|
212 |
} |
|
213 |
|
|
214 |
void bitmap_set(unsigned long *map, int i, int len); |
|
215 |
void bitmap_clear(unsigned long *map, int start, int nr); |
|
216 |
unsigned long bitmap_find_next_zero_area(unsigned long *map, |
|
217 |
unsigned long size, |
|
218 |
unsigned long start, |
|
219 |
unsigned int nr, |
|
220 |
unsigned long align_mask); |
|
221 |
|
|
222 |
#endif /* BITMAP_H */ |
b/bitops.c | ||
---|---|---|
11 | 11 |
* 2 of the License, or (at your option) any later version. |
12 | 12 |
*/ |
13 | 13 |
|
14 |
#include "bitops.h" |
|
14 |
#include "qemu/bitops.h"
|
|
15 | 15 |
|
16 | 16 |
#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG) |
17 | 17 |
|
/dev/null | ||
---|---|---|
1 |
/* |
|
2 |
* Bitops Module |
|
3 |
* |
|
4 |
* Copyright (C) 2010 Corentin Chary <corentin.chary@gmail.com> |
|
5 |
* |
|
6 |
* Mostly inspired by (stolen from) linux/bitmap.h and linux/bitops.h |
|
7 |
* |
|
8 |
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later. |
|
9 |
* See the COPYING.LIB file in the top-level directory. |
|
10 |
*/ |
|
11 |
|
|
12 |
#ifndef BITOPS_H |
|
13 |
#define BITOPS_H |
|
14 |
|
|
15 |
#include "qemu-common.h" |
|
16 |
|
|
17 |
#define BITS_PER_BYTE CHAR_BIT |
|
18 |
#define BITS_PER_LONG (sizeof (unsigned long) * BITS_PER_BYTE) |
|
19 |
|
|
20 |
#define BIT(nr) (1UL << (nr)) |
|
21 |
#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) |
|
22 |
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) |
|
23 |
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) |
|
24 |
|
|
25 |
/** |
|
26 |
* bitops_ffs - find first bit in word. |
|
27 |
* @word: The word to search |
|
28 |
* |
|
29 |
* Undefined if no bit exists, so code should check against 0 first. |
|
30 |
*/ |
|
31 |
static unsigned long bitops_ffsl(unsigned long word) |
|
32 |
{ |
|
33 |
int num = 0; |
|
34 |
|
|
35 |
#if LONG_MAX > 0x7FFFFFFF |
|
36 |
if ((word & 0xffffffff) == 0) { |
|
37 |
num += 32; |
|
38 |
word >>= 32; |
|
39 |
} |
|
40 |
#endif |
|
41 |
if ((word & 0xffff) == 0) { |
|
42 |
num += 16; |
|
43 |
word >>= 16; |
|
44 |
} |
|
45 |
if ((word & 0xff) == 0) { |
|
46 |
num += 8; |
|
47 |
word >>= 8; |
|
48 |
} |
|
49 |
if ((word & 0xf) == 0) { |
|
50 |
num += 4; |
|
51 |
word >>= 4; |
|
52 |
} |
|
53 |
if ((word & 0x3) == 0) { |
|
54 |
num += 2; |
|
55 |
word >>= 2; |
|
56 |
} |
|
57 |
if ((word & 0x1) == 0) { |
|
58 |
num += 1; |
|
59 |
} |
|
60 |
return num; |
|
61 |
} |
|
62 |
|
|
63 |
/** |
|
64 |
* bitops_fls - find last (most-significant) set bit in a long word |
|
65 |
* @word: the word to search |
|
66 |
* |
|
67 |
* Undefined if no set bit exists, so code should check against 0 first. |
|
68 |
*/ |
|
69 |
static inline unsigned long bitops_flsl(unsigned long word) |
|
70 |
{ |
|
71 |
int num = BITS_PER_LONG - 1; |
|
72 |
|
|
73 |
#if LONG_MAX > 0x7FFFFFFF |
|
74 |
if (!(word & (~0ul << 32))) { |
|
75 |
num -= 32; |
|
76 |
word <<= 32; |
|
77 |
} |
|
78 |
#endif |
|
79 |
if (!(word & (~0ul << (BITS_PER_LONG-16)))) { |
|
80 |
num -= 16; |
|
81 |
word <<= 16; |
|
82 |
} |
|
83 |
if (!(word & (~0ul << (BITS_PER_LONG-8)))) { |
|
84 |
num -= 8; |
|
85 |
word <<= 8; |
|
86 |
} |
|
87 |
if (!(word & (~0ul << (BITS_PER_LONG-4)))) { |
|
88 |
num -= 4; |
|
89 |
word <<= 4; |
|
90 |
} |
|
91 |
if (!(word & (~0ul << (BITS_PER_LONG-2)))) { |
|
92 |
num -= 2; |
|
93 |
|
|
94 |
word <<= 2; |
|
95 |
} |
|
96 |
if (!(word & (~0ul << (BITS_PER_LONG-1)))) |
|
97 |
num -= 1; |
|
98 |
return num; |
|
99 |
} |
|
100 |
|
|
101 |
/** |
|
102 |
* ffz - find first zero in word. |
|
103 |
* @word: The word to search |
|
104 |
* |
|
105 |
* Undefined if no zero exists, so code should check against ~0UL first. |
|
106 |
*/ |
|
107 |
static inline unsigned long ffz(unsigned long word) |
|
108 |
{ |
|
109 |
return bitops_ffsl(~word); |
|
110 |
} |
|
111 |
|
|
112 |
/** |
|
113 |
* set_bit - Set a bit in memory |
|
114 |
* @nr: the bit to set |
|
115 |
* @addr: the address to start counting from |
|
116 |
*/ |
|
117 |
static inline void set_bit(int nr, unsigned long *addr) |
|
118 |
{ |
|
119 |
unsigned long mask = BIT_MASK(nr); |
|
120 |
unsigned long *p = addr + BIT_WORD(nr); |
|
121 |
|
|
122 |
*p |= mask; |
|
123 |
} |
|
124 |
|
|
125 |
/** |
|
126 |
* clear_bit - Clears a bit in memory |
|
127 |
* @nr: Bit to clear |
|
128 |
* @addr: Address to start counting from |
|
129 |
*/ |
|
130 |
static inline void clear_bit(int nr, unsigned long *addr) |
|
131 |
{ |
|
132 |
unsigned long mask = BIT_MASK(nr); |
|
133 |
unsigned long *p = addr + BIT_WORD(nr); |
|
134 |
|
|
135 |
*p &= ~mask; |
|
136 |
} |
|
137 |
|
|
138 |
/** |
|
139 |
* change_bit - Toggle a bit in memory |
|
140 |
* @nr: Bit to change |
|
141 |
* @addr: Address to start counting from |
|
142 |
*/ |
|
143 |
static inline void change_bit(int nr, unsigned long *addr) |
|
144 |
{ |
|
145 |
unsigned long mask = BIT_MASK(nr); |
|
146 |
unsigned long *p = addr + BIT_WORD(nr); |
|
147 |
|
|
148 |
*p ^= mask; |
|
149 |
} |
|
150 |
|
|
151 |
/** |
|
152 |
* test_and_set_bit - Set a bit and return its old value |
|
153 |
* @nr: Bit to set |
|
154 |
* @addr: Address to count from |
|
155 |
*/ |
|
156 |
static inline int test_and_set_bit(int nr, unsigned long *addr) |
|
157 |
{ |
|
158 |
unsigned long mask = BIT_MASK(nr); |
|
159 |
unsigned long *p = addr + BIT_WORD(nr); |
|
160 |
unsigned long old = *p; |
|
161 |
|
|
162 |
*p = old | mask; |
|
163 |
return (old & mask) != 0; |
|
164 |
} |
|
165 |
|
|
166 |
/** |
|
167 |
* test_and_clear_bit - Clear a bit and return its old value |
|
168 |
* @nr: Bit to clear |
|
169 |
* @addr: Address to count from |
|
170 |
*/ |
|
171 |
static inline int test_and_clear_bit(int nr, unsigned long *addr) |
|
172 |
{ |
|
173 |
unsigned long mask = BIT_MASK(nr); |
|
174 |
unsigned long *p = addr + BIT_WORD(nr); |
|
175 |
unsigned long old = *p; |
|
176 |
|
|
177 |
*p = old & ~mask; |
|
178 |
return (old & mask) != 0; |
|
179 |
} |
|
180 |
|
|
181 |
/** |
|
182 |
* test_and_change_bit - Change a bit and return its old value |
|
183 |
* @nr: Bit to change |
|
184 |
* @addr: Address to count from |
|
185 |
*/ |
|
186 |
static inline int test_and_change_bit(int nr, unsigned long *addr) |
|
187 |
{ |
|
188 |
unsigned long mask = BIT_MASK(nr); |
|
189 |
unsigned long *p = addr + BIT_WORD(nr); |
|
190 |
unsigned long old = *p; |
|
191 |
|
|
192 |
*p = old ^ mask; |
|
193 |
return (old & mask) != 0; |
|
194 |
} |
|
195 |
|
|
196 |
/** |
|
197 |
* test_bit - Determine whether a bit is set |
|
198 |
* @nr: bit number to test |
|
199 |
* @addr: Address to start counting from |
|
200 |
*/ |
|
201 |
static inline int test_bit(int nr, const unsigned long *addr) |
|
202 |
{ |
|
203 |
return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1))); |
|
204 |
} |
|
205 |
|
|
206 |
/** |
|
207 |
* find_last_bit - find the last set bit in a memory region |
|
208 |
* @addr: The address to start the search at |
|
209 |
* @size: The maximum size to search |
|
210 |
* |
|
211 |
* Returns the bit number of the first set bit, or size. |
|
212 |
*/ |
|
213 |
unsigned long find_last_bit(const unsigned long *addr, |
|
214 |
unsigned long size); |
|
215 |
|
|
216 |
/** |
|
217 |
* find_next_bit - find the next set bit in a memory region |
|
218 |
* @addr: The address to base the search on |
|
219 |
* @offset: The bitnumber to start searching at |
|
220 |
* @size: The bitmap size in bits |
|
221 |
*/ |
|
222 |
unsigned long find_next_bit(const unsigned long *addr, |
|
223 |
unsigned long size, unsigned long offset); |
|
224 |
|
|
225 |
/** |
|
226 |
* find_next_zero_bit - find the next cleared bit in a memory region |
|
227 |
* @addr: The address to base the search on |
|
228 |
* @offset: The bitnumber to start searching at |
|
229 |
* @size: The bitmap size in bits |
|
230 |
*/ |
|
231 |
|
|
232 |
unsigned long find_next_zero_bit(const unsigned long *addr, |
|
233 |
unsigned long size, |
|
234 |
unsigned long offset); |
|
235 |
|
|
236 |
/** |
|
237 |
* find_first_bit - find the first set bit in a memory region |
|
238 |
* @addr: The address to start the search at |
|
239 |
* @size: The maximum size to search |
|
240 |
* |
|
241 |
* Returns the bit number of the first set bit. |
|
242 |
*/ |
|
243 |
static inline unsigned long find_first_bit(const unsigned long *addr, |
|
244 |
unsigned long size) |
|
245 |
{ |
|
246 |
return find_next_bit(addr, size, 0); |
|
247 |
} |
|
248 |
|
|
249 |
/** |
|
250 |
* find_first_zero_bit - find the first cleared bit in a memory region |
|
251 |
* @addr: The address to start the search at |
|
252 |
* @size: The maximum size to search |
|
253 |
* |
|
254 |
* Returns the bit number of the first cleared bit. |
|
255 |
*/ |
|
256 |
static inline unsigned long find_first_zero_bit(const unsigned long *addr, |
|
257 |
unsigned long size) |
|
258 |
{ |
|
259 |
return find_next_zero_bit(addr, size, 0); |
|
260 |
} |
|
261 |
|
|
262 |
static inline unsigned long hweight_long(unsigned long w) |
|
263 |
{ |
|
264 |
unsigned long count; |
|
265 |
|
|
266 |
for (count = 0; w; w >>= 1) { |
|
267 |
count += w & 1; |
|
268 |
} |
|
269 |
return count; |
|
270 |
} |
|
271 |
|
|
272 |
/** |
|
273 |
* extract32: |
|
274 |
* @value: the value to extract the bit field from |
|
275 |
* @start: the lowest bit in the bit field (numbered from 0) |
|
276 |
* @length: the length of the bit field |
|
277 |
* |
|
278 |
* Extract from the 32 bit input @value the bit field specified by the |
|
279 |
* @start and @length parameters, and return it. The bit field must |
|
280 |
* lie entirely within the 32 bit word. It is valid to request that |
|
281 |
* all 32 bits are returned (ie @length 32 and @start 0). |
|
282 |
* |
|
283 |
* Returns: the value of the bit field extracted from the input value. |
|
284 |
*/ |
|
285 |
static inline uint32_t extract32(uint32_t value, int start, int length) |
|
286 |
{ |
|
287 |
assert(start >= 0 && length > 0 && length <= 32 - start); |
|
288 |
return (value >> start) & (~0U >> (32 - length)); |
|
289 |
} |
|
290 |
|
|
291 |
/** |
|
292 |
* extract64: |
|
293 |
* @value: the value to extract the bit field from |
|
294 |
* @start: the lowest bit in the bit field (numbered from 0) |
|
295 |
* @length: the length of the bit field |
|
296 |
* |
|
297 |
* Extract from the 64 bit input @value the bit field specified by the |
|
298 |
* @start and @length parameters, and return it. The bit field must |
|
299 |
* lie entirely within the 64 bit word. It is valid to request that |
|
300 |
* all 64 bits are returned (ie @length 64 and @start 0). |
|
301 |
* |
|
302 |
* Returns: the value of the bit field extracted from the input value. |
|
303 |
*/ |
|
304 |
static inline uint64_t extract64(uint64_t value, int start, int length) |
|
305 |
{ |
|
306 |
assert(start >= 0 && length > 0 && length <= 64 - start); |
|
307 |
return (value >> start) & (~0ULL >> (64 - length)); |
|
308 |
} |
|
309 |
|
|
310 |
/** |
|
311 |
* deposit32: |
|
312 |
* @value: initial value to insert bit field into |
|
313 |
* @start: the lowest bit in the bit field (numbered from 0) |
|
314 |
* @length: the length of the bit field |
|
315 |
* @fieldval: the value to insert into the bit field |
|
316 |
* |
|
317 |
* Deposit @fieldval into the 32 bit @value at the bit field specified |
|
318 |
* by the @start and @length parameters, and return the modified |
|
319 |
* @value. Bits of @value outside the bit field are not modified. |
|
320 |
* Bits of @fieldval above the least significant @length bits are |
|
321 |
* ignored. The bit field must lie entirely within the 32 bit word. |
|
322 |
* It is valid to request that all 32 bits are modified (ie @length |
|
323 |
* 32 and @start 0). |
|
324 |
* |
|
325 |
* Returns: the modified @value. |
|
326 |
*/ |
|
327 |
static inline uint32_t deposit32(uint32_t value, int start, int length, |
|
328 |
uint32_t fieldval) |
|
329 |
{ |
|
330 |
uint32_t mask; |
|
331 |
assert(start >= 0 && length > 0 && length <= 32 - start); |
|
332 |
mask = (~0U >> (32 - length)) << start; |
|
333 |
return (value & ~mask) | ((fieldval << start) & mask); |
|
334 |
} |
|
335 |
|
|
336 |
/** |
|
337 |
* deposit64: |
|
338 |
* @value: initial value to insert bit field into |
|
339 |
* @start: the lowest bit in the bit field (numbered from 0) |
|
340 |
* @length: the length of the bit field |
|
341 |
* @fieldval: the value to insert into the bit field |
|
342 |
* |
|
343 |
* Deposit @fieldval into the 64 bit @value at the bit field specified |
|
344 |
* by the @start and @length parameters, and return the modified |
|
345 |
* @value. Bits of @value outside the bit field are not modified. |
|
346 |
* Bits of @fieldval above the least significant @length bits are |
|
347 |
* ignored. The bit field must lie entirely within the 64 bit word. |
|
348 |
* It is valid to request that all 64 bits are modified (ie @length |
|
349 |
* 64 and @start 0). |
|
350 |
* |
|
351 |
* Returns: the modified @value. |
|
352 |
*/ |
|
353 |
static inline uint64_t deposit64(uint64_t value, int start, int length, |
|
354 |
uint64_t fieldval) |
|
355 |
{ |
|
356 |
uint64_t mask; |
|
357 |
assert(start >= 0 && length > 0 && length <= 64 - start); |
|
358 |
mask = (~0ULL >> (64 - length)) << start; |
|
359 |
return (value & ~mask) | ((fieldval << start) & mask); |
|
360 |
} |
|
361 |
|
|
362 |
#endif |
b/block-migration.c | ||
---|---|---|
16 | 16 |
#include "qemu-common.h" |
17 | 17 |
#include "block/block_int.h" |
18 | 18 |
#include "hw/hw.h" |
19 |
#include "qemu-queue.h"
|
|
20 |
#include "qemu-timer.h"
|
|
19 |
#include "qemu/queue.h"
|
|
20 |
#include "qemu/timer.h"
|
|
21 | 21 |
#include "migration/block.h" |
22 | 22 |
#include "migration/migration.h" |
23 | 23 |
#include "blockdev.h" |
b/block.c | ||
---|---|---|
27 | 27 |
#include "monitor/monitor.h" |
28 | 28 |
#include "block/block_int.h" |
29 | 29 |
#include "block/blockjob.h" |
30 |
#include "module.h" |
|
30 |
#include "qemu/module.h"
|
|
31 | 31 |
#include "qapi/qmp/qjson.h" |
32 | 32 |
#include "sysemu.h" |
33 |
#include "notify.h" |
|
33 |
#include "qemu/notify.h"
|
|
34 | 34 |
#include "block/coroutine.h" |
35 | 35 |
#include "qmp-commands.h" |
36 |
#include "qemu-timer.h"
|
|
36 |
#include "qemu/timer.h"
|
|
37 | 37 |
|
38 | 38 |
#ifdef CONFIG_BSD |
39 | 39 |
#include <sys/types.h> |
b/block/blkdebug.c | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
|
25 | 25 |
#include "qemu-common.h" |
26 |
#include "qemu-config.h"
|
|
26 |
#include "qemu/config-file.h"
|
|
27 | 27 |
#include "block/block_int.h" |
28 |
#include "module.h" |
|
28 |
#include "qemu/module.h"
|
|
29 | 29 |
|
30 | 30 |
typedef struct BDRVBlkdebugState { |
31 | 31 |
int state; |
b/block/blkverify.c | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
|
10 | 10 |
#include <stdarg.h> |
11 |
#include "qemu_socket.h" /* for EINPROGRESS on Windows */
|
|
11 |
#include "qemu/sockets.h" /* for EINPROGRESS on Windows */
|
|
12 | 12 |
#include "block/block_int.h" |
13 | 13 |
|
14 | 14 |
typedef struct { |
b/block/bochs.c | ||
---|---|---|
24 | 24 |
*/ |
25 | 25 |
#include "qemu-common.h" |
26 | 26 |
#include "block/block_int.h" |
27 |
#include "module.h" |
|
27 |
#include "qemu/module.h"
|
|
28 | 28 |
|
29 | 29 |
/**************************************************************/ |
30 | 30 |
|
b/block/cloop.c | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
#include "qemu-common.h" |
25 | 25 |
#include "block/block_int.h" |
26 |
#include "module.h" |
|
26 |
#include "qemu/module.h"
|
|
27 | 27 |
#include <zlib.h> |
28 | 28 |
|
29 | 29 |
typedef struct BDRVCloopState { |
b/block/cow.c | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
#include "qemu-common.h" |
25 | 25 |
#include "block/block_int.h" |
26 |
#include "module.h" |
|
26 |
#include "qemu/module.h"
|
|
27 | 27 |
|
28 | 28 |
/**************************************************************/ |
29 | 29 |
/* COW block driver using file system holes */ |
b/block/dmg.c | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
#include "qemu-common.h" |
25 | 25 |
#include "block/block_int.h" |
26 |
#include "bswap.h" |
|
27 |
#include "module.h" |
|
26 |
#include "qemu/bswap.h"
|
|
27 |
#include "qemu/module.h"
|
|
28 | 28 |
#include <zlib.h> |
29 | 29 |
|
30 | 30 |
typedef struct BDRVDMGState { |
b/block/gluster.c | ||
---|---|---|
17 | 17 |
*/ |
18 | 18 |
#include <glusterfs/api/glfs.h> |
19 | 19 |
#include "block/block_int.h" |
20 |
#include "qemu_socket.h"
|
|
21 |
#include "uri.h" |
|
20 |
#include "qemu/sockets.h"
|
|
21 |
#include "qemu/uri.h"
|
|
22 | 22 |
|
23 | 23 |
typedef struct GlusterAIOCB { |
24 | 24 |
BlockDriverAIOCB common; |
b/block/iscsi.c | ||
---|---|---|
27 | 27 |
#include <poll.h> |
28 | 28 |
#include <arpa/inet.h> |
29 | 29 |
#include "qemu-common.h" |
30 |
#include "qemu-config.h"
|
|
31 |
#include "qemu-error.h"
|
|
30 |
#include "qemu/config-file.h"
|
|
31 |
#include "qemu/error-report.h"
|
|
32 | 32 |
#include "block/block_int.h" |
33 | 33 |
#include "trace.h" |
34 | 34 |
#include "hw/scsi-defs.h" |
b/block/linux-aio.c | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
#include "qemu-common.h" |
11 | 11 |
#include "block/aio.h" |
12 |
#include "qemu-queue.h"
|
|
12 |
#include "qemu/queue.h"
|
|
13 | 13 |
#include "block/raw-aio.h" |
14 |
#include "event_notifier.h" |
|
14 |
#include "qemu/event_notifier.h"
|
|
15 | 15 |
|
16 | 16 |
#include <libaio.h> |
17 | 17 |
|
b/block/nbd.c | ||
---|---|---|
28 | 28 |
|
29 | 29 |
#include "qemu-common.h" |
30 | 30 |
#include "block/nbd.h" |
31 |
#include "uri.h" |
|
31 |
#include "qemu/uri.h"
|
|
32 | 32 |
#include "block/block_int.h" |
33 |
#include "module.h" |
|
34 |
#include "qemu_socket.h"
|
|
33 |
#include "qemu/module.h"
|
|
34 |
#include "qemu/sockets.h"
|
|
35 | 35 |
|
36 | 36 |
#include <sys/types.h> |
37 | 37 |
#include <unistd.h> |
b/block/parallels.c | ||
---|---|---|
25 | 25 |
*/ |
26 | 26 |
#include "qemu-common.h" |
27 | 27 |
#include "block/block_int.h" |
28 |
#include "module.h" |
|
28 |
#include "qemu/module.h"
|
|
29 | 29 |
|
30 | 30 |
/**************************************************************/ |
31 | 31 |
|
b/block/qcow.c | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
#include "qemu-common.h" |
25 | 25 |
#include "block/block_int.h" |
26 |
#include "module.h" |
|
26 |
#include "qemu/module.h"
|
|
27 | 27 |
#include <zlib.h> |
28 | 28 |
#include "block/aes.h" |
29 | 29 |
#include "migration/migration.h" |
b/block/qcow2.c | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
#include "qemu-common.h" |
25 | 25 |
#include "block/block_int.h" |
26 |
#include "module.h" |
|
26 |
#include "qemu/module.h"
|
|
27 | 27 |
#include <zlib.h> |
28 | 28 |
#include "block/aes.h" |
29 | 29 |
#include "block/qcow2.h" |
30 |
#include "qemu-error.h"
|
|
30 |
#include "qemu/error-report.h"
|
|
31 | 31 |
#include "qapi/qmp/qerror.h" |
32 | 32 |
#include "trace.h" |
33 | 33 |
|
b/block/qed-table.c | ||
---|---|---|
13 | 13 |
*/ |
14 | 14 |
|
15 | 15 |
#include "trace.h" |
16 |
#include "qemu_socket.h" /* for EINPROGRESS on Windows */
|
|
16 |
#include "qemu/sockets.h" /* for EINPROGRESS on Windows */
|
|
17 | 17 |
#include "qed.h" |
18 | 18 |
|
19 | 19 |
typedef struct { |
b/block/qed.c | ||
---|---|---|
12 | 12 |
* |
13 | 13 |
*/ |
14 | 14 |
|
15 |
#include "qemu-timer.h"
|
|
15 |
#include "qemu/timer.h"
|
|
16 | 16 |
#include "trace.h" |
17 | 17 |
#include "qed.h" |
18 | 18 |
#include "qapi/qmp/qerror.h" |
b/block/raw-posix.c | ||
---|---|---|
22 | 22 |
* THE SOFTWARE. |
23 | 23 |
*/ |
24 | 24 |
#include "qemu-common.h" |
25 |
#include "qemu-timer.h"
|
|
26 |
#include "qemu-log.h"
|
|
25 |
#include "qemu/timer.h"
|
|
26 |
#include "qemu/log.h"
|
|
27 | 27 |
#include "block/block_int.h" |
28 |
#include "module.h" |
|
28 |
#include "qemu/module.h"
|
|
29 | 29 |
#include "trace.h" |
30 | 30 |
#include "block/thread-pool.h" |
31 |
#include "iov.h" |
|
31 |
#include "qemu/iov.h"
|
|
32 | 32 |
#include "raw-aio.h" |
33 | 33 |
|
34 | 34 |
#if defined(__APPLE__) && (__MACH__) |
b/block/raw-win32.c | ||
---|---|---|
22 | 22 |
* THE SOFTWARE. |
23 | 23 |
*/ |
24 | 24 |
#include "qemu-common.h" |
25 |
#include "qemu-timer.h"
|
|
25 |
#include "qemu/timer.h"
|
|
26 | 26 |
#include "block/block_int.h" |
27 |
#include "module.h" |
|
27 |
#include "qemu/module.h"
|
|
28 | 28 |
#include "raw-aio.h" |
29 | 29 |
#include "trace.h" |
30 | 30 |
#include "block/thread-pool.h" |
31 |
#include "iov.h" |
|
31 |
#include "qemu/iov.h"
|
|
32 | 32 |
#include <windows.h> |
33 | 33 |
#include <winioctl.h> |
34 | 34 |
|
b/block/raw.c | ||
---|---|---|
1 | 1 |
|
2 | 2 |
#include "qemu-common.h" |
3 | 3 |
#include "block/block_int.h" |
4 |
#include "module.h" |
|
4 |
#include "qemu/module.h"
|
|
5 | 5 |
|
6 | 6 |
static int raw_open(BlockDriverState *bs, int flags) |
7 | 7 |
{ |
b/block/rbd.c | ||
---|---|---|
14 | 14 |
#include <inttypes.h> |
15 | 15 |
|
16 | 16 |
#include "qemu-common.h" |
17 |
#include "qemu-error.h"
|
|
17 |
#include "qemu/error-report.h"
|
|
18 | 18 |
#include "block/block_int.h" |
19 | 19 |
|
20 | 20 |
#include <rbd/librbd.h> |
b/block/sheepdog.c | ||
---|---|---|
13 | 13 |
*/ |
14 | 14 |
|
15 | 15 |
#include "qemu-common.h" |
16 |
#include "qemu-error.h"
|
|
17 |
#include "qemu_socket.h"
|
|
16 |
#include "qemu/error-report.h"
|
|
17 |
#include "qemu/sockets.h"
|
|
18 | 18 |
#include "block/block_int.h" |
19 |
#include "bitops.h" |
|
19 |
#include "qemu/bitops.h"
|
|
20 | 20 |
|
21 | 21 |
#define SD_PROTO_VER 0x01 |
22 | 22 |
|
b/block/vdi.c | ||
---|---|---|
51 | 51 |
|
52 | 52 |
#include "qemu-common.h" |
53 | 53 |
#include "block/block_int.h" |
54 |
#include "module.h" |
|
54 |
#include "qemu/module.h"
|
|
55 | 55 |
#include "migration/migration.h" |
56 | 56 |
|
57 | 57 |
#if defined(CONFIG_UUID) |
b/block/vmdk.c | ||
---|---|---|
25 | 25 |
|
26 | 26 |
#include "qemu-common.h" |
27 | 27 |
#include "block/block_int.h" |
28 |
#include "module.h" |
|
28 |
#include "qemu/module.h"
|
|
29 | 29 |
#include "migration/migration.h" |
30 | 30 |
#include <zlib.h> |
31 | 31 |
|
b/block/vpc.c | ||
---|---|---|
24 | 24 |
*/ |
25 | 25 |
#include "qemu-common.h" |
26 | 26 |
#include "block/block_int.h" |
27 |
#include "module.h" |
|
27 |
#include "qemu/module.h"
|
|
28 | 28 |
#include "migration/migration.h" |
29 | 29 |
#if defined(CONFIG_UUID) |
30 | 30 |
#include <uuid/uuid.h> |
b/block/vvfat.c | ||
---|---|---|
26 | 26 |
#include <dirent.h> |
27 | 27 |
#include "qemu-common.h" |
28 | 28 |
#include "block/block_int.h" |
29 |
#include "module.h" |
|
29 |
#include "qemu/module.h"
|
|
30 | 30 |
#include "migration/migration.h" |
31 | 31 |
|
32 | 32 |
#ifndef S_IWGRP |
b/block/win32-aio.c | ||
---|---|---|
22 | 22 |
* THE SOFTWARE. |
23 | 23 |
*/ |
24 | 24 |
#include "qemu-common.h" |
25 |
#include "qemu-timer.h"
|
|
25 |
#include "qemu/timer.h"
|
|
26 | 26 |
#include "block/block_int.h" |
27 |
#include "module.h" |
|
27 |
#include "qemu/module.h"
|
|
28 | 28 |
#include "qemu-common.h" |
29 | 29 |
#include "block/aio.h" |
30 | 30 |
#include "raw-aio.h" |
31 |
#include "event_notifier.h" |
|
31 |
#include "qemu/event_notifier.h"
|
|
32 | 32 |
#include <windows.h> |
33 | 33 |
#include <winioctl.h> |
34 | 34 |
|
b/blockdev-nbd.c | ||
---|---|---|
17 | 17 |
#include "qmp-commands.h" |
18 | 18 |
#include "trace.h" |
19 | 19 |
#include "block/nbd.h" |
20 |
#include "qemu_socket.h"
|
|
20 |
#include "qemu/sockets.h"
|
|
21 | 21 |
|
22 | 22 |
static int server_fd = -1; |
23 | 23 |
|
b/blockdev.c | ||
---|---|---|
12 | 12 |
#include "block/blockjob.h" |
13 | 13 |
#include "monitor/monitor.h" |
14 | 14 |
#include "qapi/qmp/qerror.h" |
15 |
#include "qemu-option.h"
|
|
16 |
#include "qemu-config.h"
|
|
15 |
#include "qemu/option.h"
|
|
16 |
#include "qemu/config-file.h"
|
|
17 | 17 |
#include "qapi/qmp/types.h" |
18 | 18 |
#include "sysemu.h" |
19 | 19 |
#include "block/block_int.h" |
b/blockdev.h | ||
---|---|---|
12 | 12 |
|
13 | 13 |
#include "block/block.h" |
14 | 14 |
#include "qapi/error.h" |
15 |
#include "qemu-queue.h"
|
|
15 |
#include "qemu/queue.h"
|
|
16 | 16 |
|
17 | 17 |
void blockdev_mark_auto_del(BlockDriverState *bs); |
18 | 18 |
void blockdev_auto_del(BlockDriverState *bs); |
b/blockjob.c | ||
---|---|---|
33 | 33 |
#include "qapi/qmp/qjson.h" |
34 | 34 |
#include "block/coroutine.h" |
35 | 35 |
#include "qmp-commands.h" |
36 |
#include "qemu-timer.h"
|
|
36 |
#include "qemu/timer.h"
|
|
37 | 37 |
|
38 | 38 |
void *block_job_create(const BlockJobType *job_type, BlockDriverState *bs, |
39 | 39 |
int64_t speed, BlockDriverCompletionFunc *cb, |
b/bsd-user/main.c | ||
---|---|---|
31 | 31 |
/* For tb_lock */ |
32 | 32 |
#include "cpu.h" |
33 | 33 |
#include "tcg.h" |
34 |
#include "qemu-timer.h"
|
|
35 |
#include "envlist.h" |
|
34 |
#include "qemu/timer.h"
|
|
35 |
#include "qemu/envlist.h"
|
|
36 | 36 |
|
37 | 37 |
#define DEBUG_LOGFILE "/tmp/qemu.log" |
38 | 38 |
|
b/bsd-user/qemu.h | ||
---|---|---|
146 | 146 |
void fork_start(void); |
147 | 147 |
void fork_end(int child); |
148 | 148 |
|
149 |
#include "qemu-log.h"
|
|
149 |
#include "qemu/log.h"
|
|
150 | 150 |
|
151 | 151 |
/* strace.c */ |
152 | 152 |
void |
/dev/null | ||
---|---|---|
1 |
#ifndef BSWAP_H |
|
2 |
#define BSWAP_H |
|
3 |
|
|
4 |
#include "config-host.h" |
|
5 |
|
|
6 |
#include <inttypes.h> |
|
7 |
#include "softfloat.h" |
|
8 |
|
|
9 |
#ifdef CONFIG_MACHINE_BSWAP_H |
|
10 |
#include <sys/endian.h> |
|
11 |
#include <sys/types.h> |
|
12 |
#include <machine/bswap.h> |
|
13 |
#else |
|
14 |
|
|
15 |
#ifdef CONFIG_BYTESWAP_H |
|
16 |
#include <byteswap.h> |
|
17 |
#else |
|
18 |
|
|
19 |
#define bswap_16(x) \ |
|
20 |
({ \ |
|
21 |
uint16_t __x = (x); \ |
|
22 |
((uint16_t)( \ |
|
23 |
(((uint16_t)(__x) & (uint16_t)0x00ffU) << 8) | \ |
|
24 |
(((uint16_t)(__x) & (uint16_t)0xff00U) >> 8) )); \ |
|
25 |
}) |
|
26 |
|
|
27 |
#define bswap_32(x) \ |
|
28 |
({ \ |
|
29 |
uint32_t __x = (x); \ |
|
30 |
((uint32_t)( \ |
|
31 |
(((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \ |
|
32 |
(((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \ |
|
33 |
(((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \ |
|
34 |
(((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )); \ |
|
35 |
}) |
|
36 |
|
|
37 |
#define bswap_64(x) \ |
|
38 |
({ \ |
|
39 |
uint64_t __x = (x); \ |
|
40 |
((uint64_t)( \ |
|
41 |
(uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000000000ffULL) << 56) | \ |
|
42 |
(uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000000000ff00ULL) << 40) | \ |
|
43 |
(uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \ |
|
44 |
(uint64_t)(((uint64_t)(__x) & (uint64_t)0x00000000ff000000ULL) << 8) | \ |
|
45 |
(uint64_t)(((uint64_t)(__x) & (uint64_t)0x000000ff00000000ULL) >> 8) | \ |
|
46 |
(uint64_t)(((uint64_t)(__x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \ |
|
47 |
(uint64_t)(((uint64_t)(__x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \ |
|
48 |
(uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \ |
|
49 |
}) |
|
50 |
|
|
51 |
#endif /* !CONFIG_BYTESWAP_H */ |
|
52 |
|
|
53 |
static inline uint16_t bswap16(uint16_t x) |
|
54 |
{ |
|
55 |
return bswap_16(x); |
|
56 |
} |
|
57 |
|
|
58 |
static inline uint32_t bswap32(uint32_t x) |
|
59 |
{ |
|
60 |
return bswap_32(x); |
|
61 |
} |
|
62 |
|
|
63 |
static inline uint64_t bswap64(uint64_t x) |
|
64 |
{ |
|
65 |
return bswap_64(x); |
|
66 |
} |
|
67 |
|
|
68 |
#endif /* ! CONFIG_MACHINE_BSWAP_H */ |
|
69 |
|
|
70 |
static inline void bswap16s(uint16_t *s) |
|
71 |
{ |
|
72 |
*s = bswap16(*s); |
|
73 |
} |
|
74 |
|
|
75 |
static inline void bswap32s(uint32_t *s) |
|
76 |
{ |
|
77 |
*s = bswap32(*s); |
|
78 |
} |
|
79 |
|
|
80 |
static inline void bswap64s(uint64_t *s) |
|
81 |
{ |
|
82 |
*s = bswap64(*s); |
|
83 |
} |
|
84 |
|
|
85 |
#if defined(HOST_WORDS_BIGENDIAN) |
|
86 |
#define be_bswap(v, size) (v) |
|
87 |
#define le_bswap(v, size) bswap ## size(v) |
|
88 |
#define be_bswaps(v, size) |
|
89 |
#define le_bswaps(p, size) *p = bswap ## size(*p); |
|
90 |
#else |
|
91 |
#define le_bswap(v, size) (v) |
|
92 |
#define be_bswap(v, size) bswap ## size(v) |
|
93 |
#define le_bswaps(v, size) |
|
94 |
#define be_bswaps(p, size) *p = bswap ## size(*p); |
|
95 |
#endif |
|
96 |
|
|
97 |
#define CPU_CONVERT(endian, size, type)\ |
|
98 |
static inline type endian ## size ## _to_cpu(type v)\ |
|
99 |
{\ |
|
100 |
return endian ## _bswap(v, size);\ |
|
101 |
}\ |
|
102 |
\ |
Also available in: Unified diff