diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2010-08-27 10:39:48 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-08-26 19:09:51 -0400 |
commit | f846619e7f875b0efa9853b1c821bbc756656d47 (patch) | |
tree | 8d79aeea72a1d66e54b1c7ebf8db39d362ace9d0 | |
parent | d4348c678977c7093438bbbf2067c49396ae941b (diff) |
lguest: clean up warnings in demonstration launcher.
These days the headers we use are in glibc. If those are too old, you can
add the -I lines to get the kernel headers.
In file included from ../../include/linux/if_tun.h:19,
from lguest.c:33:
../../include/linux/types.h:13:2: warning: #warning "Attempt to use kernel headers from user space, see http://kernelnewbies.org/KernelHeaders"
lguest.c: In function ‘setup_tun_net’:
lguest.c:1456: warning: dereferencing pointer ‘sin’ does break strict-aliasing rules
lguest.c:1457: warning: dereferencing pointer ‘sin’ does break strict-aliasing rules
lguest.c:1450: note: initialized from here
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r-- | Documentation/lguest/Makefile | 3 | ||||
-rw-r--r-- | Documentation/lguest/lguest.c | 23 |
2 files changed, 14 insertions, 12 deletions
diff --git a/Documentation/lguest/Makefile b/Documentation/lguest/Makefile index 28c8cdfcafd8..bebac6b4f332 100644 --- a/Documentation/lguest/Makefile +++ b/Documentation/lguest/Makefile | |||
@@ -1,5 +1,6 @@ | |||
1 | # This creates the demonstration utility "lguest" which runs a Linux guest. | 1 | # This creates the demonstration utility "lguest" which runs a Linux guest. |
2 | CFLAGS:=-m32 -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -I../../include -I../../arch/x86/include -U_FORTIFY_SOURCE | 2 | # Missing headers? Add "-I../../include -I../../arch/x86/include" |
3 | CFLAGS:=-m32 -Wall -Wmissing-declarations -Wmissing-prototypes -O3 -U_FORTIFY_SOURCE | ||
3 | 4 | ||
4 | all: lguest | 5 | all: lguest |
5 | 6 | ||
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c index e9ce3c554514..8a6a8c6d4980 100644 --- a/Documentation/lguest/lguest.c +++ b/Documentation/lguest/lguest.c | |||
@@ -39,14 +39,14 @@ | |||
39 | #include <limits.h> | 39 | #include <limits.h> |
40 | #include <stddef.h> | 40 | #include <stddef.h> |
41 | #include <signal.h> | 41 | #include <signal.h> |
42 | #include "linux/lguest_launcher.h" | 42 | #include <linux/virtio_config.h> |
43 | #include "linux/virtio_config.h" | 43 | #include <linux/virtio_net.h> |
44 | #include "linux/virtio_net.h" | 44 | #include <linux/virtio_blk.h> |
45 | #include "linux/virtio_blk.h" | 45 | #include <linux/virtio_console.h> |
46 | #include "linux/virtio_console.h" | 46 | #include <linux/virtio_rng.h> |
47 | #include "linux/virtio_rng.h" | 47 | #include <linux/virtio_ring.h> |
48 | #include "linux/virtio_ring.h" | 48 | #include <asm/bootparam.h> |
49 | #include "asm/bootparam.h" | 49 | #include "../../include/linux/lguest_launcher.h" |
50 | /*L:110 | 50 | /*L:110 |
51 | * We can ignore the 42 include files we need for this program, but I do want | 51 | * We can ignore the 42 include files we need for this program, but I do want |
52 | * to draw attention to the use of kernel-style types. | 52 | * to draw attention to the use of kernel-style types. |
@@ -1447,14 +1447,15 @@ static void add_to_bridge(int fd, const char *if_name, const char *br_name) | |||
1447 | static void configure_device(int fd, const char *tapif, u32 ipaddr) | 1447 | static void configure_device(int fd, const char *tapif, u32 ipaddr) |
1448 | { | 1448 | { |
1449 | struct ifreq ifr; | 1449 | struct ifreq ifr; |
1450 | struct sockaddr_in *sin = (struct sockaddr_in *)&ifr.ifr_addr; | 1450 | struct sockaddr_in sin; |
1451 | 1451 | ||
1452 | memset(&ifr, 0, sizeof(ifr)); | 1452 | memset(&ifr, 0, sizeof(ifr)); |
1453 | strcpy(ifr.ifr_name, tapif); | 1453 | strcpy(ifr.ifr_name, tapif); |
1454 | 1454 | ||
1455 | /* Don't read these incantations. Just cut & paste them like I did! */ | 1455 | /* Don't read these incantations. Just cut & paste them like I did! */ |
1456 | sin->sin_family = AF_INET; | 1456 | sin.sin_family = AF_INET; |
1457 | sin->sin_addr.s_addr = htonl(ipaddr); | 1457 | sin.sin_addr.s_addr = htonl(ipaddr); |
1458 | memcpy(&ifr.ifr_addr, &sin, sizeof(sin)); | ||
1458 | if (ioctl(fd, SIOCSIFADDR, &ifr) != 0) | 1459 | if (ioctl(fd, SIOCSIFADDR, &ifr) != 0) |
1459 | err(1, "Setting %s interface address", tapif); | 1460 | err(1, "Setting %s interface address", tapif); |
1460 | ifr.ifr_flags = IFF_UP; | 1461 | ifr.ifr_flags = IFF_UP; |