diff options
Diffstat (limited to 'arch/um/drivers/pcap_user.c')
-rw-r--r-- | arch/um/drivers/pcap_user.c | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/arch/um/drivers/pcap_user.c b/arch/um/drivers/pcap_user.c index 11921a7baa7b..a1747dc0ff6f 100644 --- a/arch/um/drivers/pcap_user.c +++ b/arch/um/drivers/pcap_user.c | |||
@@ -42,39 +42,39 @@ static int pcap_open(void *data) | |||
42 | int err; | 42 | int err; |
43 | 43 | ||
44 | if(pri->pcap == NULL) | 44 | if(pri->pcap == NULL) |
45 | return(-ENODEV); | 45 | return -ENODEV; |
46 | 46 | ||
47 | if(pri->filter != NULL){ | 47 | if(pri->filter != NULL){ |
48 | err = dev_netmask(pri->dev, &netmask); | 48 | err = dev_netmask(pri->dev, &netmask); |
49 | if(err < 0){ | 49 | if(err < 0){ |
50 | printk("pcap_open : dev_netmask failed\n"); | 50 | printk("pcap_open : dev_netmask failed\n"); |
51 | return(-EIO); | 51 | return -EIO; |
52 | } | 52 | } |
53 | 53 | ||
54 | pri->compiled = um_kmalloc(sizeof(struct bpf_program)); | 54 | pri->compiled = um_kmalloc(sizeof(struct bpf_program)); |
55 | if(pri->compiled == NULL){ | 55 | if(pri->compiled == NULL){ |
56 | printk("pcap_open : kmalloc failed\n"); | 56 | printk("pcap_open : kmalloc failed\n"); |
57 | return(-ENOMEM); | 57 | return -ENOMEM; |
58 | } | 58 | } |
59 | 59 | ||
60 | err = pcap_compile(pri->pcap, | 60 | err = pcap_compile(pri->pcap, |
61 | (struct bpf_program *) pri->compiled, | 61 | (struct bpf_program *) pri->compiled, |
62 | pri->filter, pri->optimize, netmask); | 62 | pri->filter, pri->optimize, netmask); |
63 | if(err < 0){ | 63 | if(err < 0){ |
64 | printk("pcap_open : pcap_compile failed - '%s'\n", | 64 | printk("pcap_open : pcap_compile failed - '%s'\n", |
65 | pcap_geterr(pri->pcap)); | 65 | pcap_geterr(pri->pcap)); |
66 | return(-EIO); | 66 | return -EIO; |
67 | } | 67 | } |
68 | 68 | ||
69 | err = pcap_setfilter(pri->pcap, pri->compiled); | 69 | err = pcap_setfilter(pri->pcap, pri->compiled); |
70 | if(err < 0){ | 70 | if(err < 0){ |
71 | printk("pcap_open : pcap_setfilter failed - '%s'\n", | 71 | printk("pcap_open : pcap_setfilter failed - '%s'\n", |
72 | pcap_geterr(pri->pcap)); | 72 | pcap_geterr(pri->pcap)); |
73 | return(-EIO); | 73 | return -EIO; |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | return(PCAP_FD(pri->pcap)); | 77 | return PCAP_FD(pri->pcap); |
78 | } | 78 | } |
79 | 79 | ||
80 | static void pcap_remove(void *data) | 80 | static void pcap_remove(void *data) |
@@ -114,11 +114,11 @@ int pcap_user_read(int fd, void *buffer, int len, struct pcap_data *pri) | |||
114 | n = pcap_dispatch(pri->pcap, 1, handler, (u_char *) &hdata); | 114 | n = pcap_dispatch(pri->pcap, 1, handler, (u_char *) &hdata); |
115 | if(n < 0){ | 115 | if(n < 0){ |
116 | printk("pcap_dispatch failed - %s\n", pcap_geterr(pri->pcap)); | 116 | printk("pcap_dispatch failed - %s\n", pcap_geterr(pri->pcap)); |
117 | return(-EIO); | 117 | return -EIO; |
118 | } | 118 | } |
119 | else if(n == 0) | 119 | else if(n == 0) |
120 | return(0); | 120 | return 0; |
121 | return(hdata.len); | 121 | return hdata.len; |
122 | } | 122 | } |
123 | 123 | ||
124 | const struct net_user_info pcap_user_info = { | 124 | const struct net_user_info pcap_user_info = { |
@@ -131,14 +131,3 @@ const struct net_user_info pcap_user_info = { | |||
131 | .delete_address = NULL, | 131 | .delete_address = NULL, |
132 | .max_packet = MAX_PACKET - ETH_HEADER_OTHER | 132 | .max_packet = MAX_PACKET - ETH_HEADER_OTHER |
133 | }; | 133 | }; |
134 | |||
135 | /* | ||
136 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
137 | * Emacs will notice this stuff at the end of the file and automatically | ||
138 | * adjust the settings for this buffer only. This must remain at the end | ||
139 | * of the file. | ||
140 | * --------------------------------------------------------------------------- | ||
141 | * Local variables: | ||
142 | * c-file-style: "linux" | ||
143 | * End: | ||
144 | */ | ||