diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2007-10-21 20:56:24 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2007-10-23 01:49:49 -0400 |
commit | b45d8cb054d7677d75176ae22a584fd84e4650e9 (patch) | |
tree | f9b91a045a6e602ccb3d8a478d2b235701e1c09e | |
parent | 9653c4aff94e43de5f4ef918d47e00018beb4105 (diff) |
Make lguest_launcher.h types userspace-friendly
lguest_launcher.h uses "u32" not "__u32", which sets a bad example. Fix that,
and include <linux/types.h>.
This means we need to use -I on the Launcher build line so types.h is found.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r-- | Documentation/lguest/Makefile | 2 | ||||
-rw-r--r-- | Documentation/lguest/lguest.c | 4 | ||||
-rw-r--r-- | include/linux/lguest_launcher.h | 21 |
3 files changed, 14 insertions, 13 deletions
diff --git a/Documentation/lguest/Makefile b/Documentation/lguest/Makefile index c0b7a4556390..526c15fd83af 100644 --- a/Documentation/lguest/Makefile +++ b/Documentation/lguest/Makefile | |||
@@ -11,7 +11,7 @@ endif | |||
11 | include $(KBUILD_OUTPUT)/.config | 11 | include $(KBUILD_OUTPUT)/.config |
12 | LGUEST_GUEST_TOP := ($(CONFIG_PAGE_OFFSET) - 0x08000000) | 12 | LGUEST_GUEST_TOP := ($(CONFIG_PAGE_OFFSET) - 0x08000000) |
13 | 13 | ||
14 | CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 -Wl,-T,lguest.lds | 14 | CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include -Wl,-T,lguest.lds |
15 | LDLIBS:=-lz | 15 | LDLIBS:=-lz |
16 | # Removing this works for some versions of ld.so (eg. Ubuntu Feisty) and | 16 | # Removing this works for some versions of ld.so (eg. Ubuntu Feisty) and |
17 | # not others (eg. FC7). | 17 | # not others (eg. FC7). |
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c index 276f2f651286..fa838e2eb656 100644 --- a/Documentation/lguest/lguest.c +++ b/Documentation/lguest/lguest.c | |||
@@ -45,8 +45,8 @@ typedef unsigned long long u64; | |||
45 | typedef uint32_t u32; | 45 | typedef uint32_t u32; |
46 | typedef uint16_t u16; | 46 | typedef uint16_t u16; |
47 | typedef uint8_t u8; | 47 | typedef uint8_t u8; |
48 | #include "../../include/linux/lguest_launcher.h" | 48 | #include "linux/lguest_launcher.h" |
49 | #include "../../include/asm-x86/e820.h" | 49 | #include "asm-x86/e820.h" |
50 | /*:*/ | 50 | /*:*/ |
51 | 51 | ||
52 | #define PAGE_PRESENT 0x7 /* Present, RW, Execute */ | 52 | #define PAGE_PRESENT 0x7 /* Present, RW, Execute */ |
diff --git a/include/linux/lguest_launcher.h b/include/linux/lguest_launcher.h index 641670579446..736e19a510c1 100644 --- a/include/linux/lguest_launcher.h +++ b/include/linux/lguest_launcher.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef _ASM_LGUEST_USER | 1 | #ifndef _ASM_LGUEST_USER |
2 | #define _ASM_LGUEST_USER | 2 | #define _ASM_LGUEST_USER |
3 | /* Everything the "lguest" userspace program needs to know. */ | 3 | /* Everything the "lguest" userspace program needs to know. */ |
4 | #include <linux/types.h> | ||
4 | /* They can register up to 32 arrays of lguest_dma. */ | 5 | /* They can register up to 32 arrays of lguest_dma. */ |
5 | #define LGUEST_MAX_DMA 32 | 6 | #define LGUEST_MAX_DMA 32 |
6 | /* At most we can dma 16 lguest_dma in one op. */ | 7 | /* At most we can dma 16 lguest_dma in one op. */ |
@@ -37,9 +38,9 @@ | |||
37 | struct lguest_dma | 38 | struct lguest_dma |
38 | { | 39 | { |
39 | /* 0 if free to be used, filled by the Host. */ | 40 | /* 0 if free to be used, filled by the Host. */ |
40 | u32 used_len; | 41 | __u32 used_len; |
42 | __u16 len[LGUEST_MAX_DMA_SECTIONS]; | ||
41 | unsigned long addr[LGUEST_MAX_DMA_SECTIONS]; | 43 | unsigned long addr[LGUEST_MAX_DMA_SECTIONS]; |
42 | u16 len[LGUEST_MAX_DMA_SECTIONS]; | ||
43 | }; | 44 | }; |
44 | /*:*/ | 45 | /*:*/ |
45 | 46 | ||
@@ -52,11 +53,11 @@ struct lguest_block_page | |||
52 | { | 53 | { |
53 | /* 0 is a read, 1 is a write. */ | 54 | /* 0 is a read, 1 is a write. */ |
54 | int type; | 55 | int type; |
55 | u32 sector; /* Offset in device = sector * 512. */ | 56 | __u32 sector; /* Offset in device = sector * 512. */ |
56 | u32 bytes; /* Length expected to be read/written in bytes */ | 57 | __u32 bytes; /* Length expected to be read/written in bytes */ |
57 | /* 0 = pending, 1 = done, 2 = done, error */ | 58 | /* 0 = pending, 1 = done, 2 = done, error */ |
58 | int result; | 59 | int result; |
59 | u32 num_sectors; /* Disk length = num_sectors * 512 */ | 60 | __u32 num_sectors; /* Disk length = num_sectors * 512 */ |
60 | }; | 61 | }; |
61 | 62 | ||
62 | /*D:520 The network device is basically a memory page where all the Guests on | 63 | /*D:520 The network device is basically a memory page where all the Guests on |
@@ -86,21 +87,21 @@ struct lguest_net | |||
86 | */ | 87 | */ |
87 | struct lguest_device_desc { | 88 | struct lguest_device_desc { |
88 | /* The device type: console, network, disk etc. */ | 89 | /* The device type: console, network, disk etc. */ |
89 | u16 type; | 90 | __u16 type; |
90 | #define LGUEST_DEVICE_T_CONSOLE 1 | 91 | #define LGUEST_DEVICE_T_CONSOLE 1 |
91 | #define LGUEST_DEVICE_T_NET 2 | 92 | #define LGUEST_DEVICE_T_NET 2 |
92 | #define LGUEST_DEVICE_T_BLOCK 3 | 93 | #define LGUEST_DEVICE_T_BLOCK 3 |
93 | 94 | ||
94 | /* The specific features of this device: these depends on device type | 95 | /* The specific features of this device: these depends on device type |
95 | * except for LGUEST_DEVICE_F_RANDOMNESS. */ | 96 | * except for LGUEST_DEVICE_F_RANDOMNESS. */ |
96 | u16 features; | 97 | __u16 features; |
97 | #define LGUEST_NET_F_NOCSUM 0x4000 /* Don't bother checksumming */ | 98 | #define LGUEST_NET_F_NOCSUM 0x4000 /* Don't bother checksumming */ |
98 | #define LGUEST_DEVICE_F_RANDOMNESS 0x8000 /* IRQ is fairly random */ | 99 | #define LGUEST_DEVICE_F_RANDOMNESS 0x8000 /* IRQ is fairly random */ |
99 | 100 | ||
100 | /* This is how the Guest reports status of the device: the Host can set | 101 | /* This is how the Guest reports status of the device: the Host can set |
101 | * LGUEST_DEVICE_S_REMOVED to indicate removal, but the rest are only | 102 | * LGUEST_DEVICE_S_REMOVED to indicate removal, but the rest are only |
102 | * ever manipulated by the Guest, and only ever set. */ | 103 | * ever manipulated by the Guest, and only ever set. */ |
103 | u16 status; | 104 | __u16 status; |
104 | /* 256 and above are device specific. */ | 105 | /* 256 and above are device specific. */ |
105 | #define LGUEST_DEVICE_S_ACKNOWLEDGE 1 /* We have seen device. */ | 106 | #define LGUEST_DEVICE_S_ACKNOWLEDGE 1 /* We have seen device. */ |
106 | #define LGUEST_DEVICE_S_DRIVER 2 /* We have found a driver */ | 107 | #define LGUEST_DEVICE_S_DRIVER 2 /* We have found a driver */ |
@@ -111,8 +112,8 @@ struct lguest_device_desc { | |||
111 | 112 | ||
112 | /* Each device exists somewhere in Guest physical memory, over some | 113 | /* Each device exists somewhere in Guest physical memory, over some |
113 | * number of pages. */ | 114 | * number of pages. */ |
114 | u16 num_pages; | 115 | __u16 num_pages; |
115 | u32 pfn; | 116 | __u32 pfn; |
116 | }; | 117 | }; |
117 | /*:*/ | 118 | /*:*/ |
118 | 119 | ||