Lines 75-80
Link Here
|
75 |
static void VNetUserIfUnsetupNotify(VNetUserIF *userIf); |
75 |
static void VNetUserIfUnsetupNotify(VNetUserIF *userIf); |
76 |
static int VNetUserIfSetupNotify(VNetUserIF *userIf, VNet_Notify *vn); |
76 |
static int VNetUserIfSetupNotify(VNetUserIF *userIf, VNet_Notify *vn); |
77 |
|
77 |
|
|
|
78 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11) |
79 |
extern int skb_copy_datagram(const struct sk_buff *from, |
80 |
int offset, char __user *to, int size); |
81 |
#endif |
82 |
|
78 |
/* |
83 |
/* |
79 |
*----------------------------------------------------------------------------- |
84 |
*----------------------------------------------------------------------------- |
80 |
* |
85 |
* |
Lines 153-164
Link Here
|
153 |
static INLINE int |
158 |
static INLINE int |
154 |
VNetUserIfMapUint32Ptr(VA uAddr, struct page **p, uint32 **ptr) |
159 |
VNetUserIfMapUint32Ptr(VA uAddr, struct page **p, uint32 **ptr) |
155 |
{ |
160 |
{ |
|
|
161 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14) |
162 |
if (access_ok(VERIFY_READ, (void *)uAddr, sizeof (uint32)) || |
163 |
access_ok(VERIFY_WRITE, (void *)uAddr, sizeof (uint32)) || |
164 |
(((uAddr + sizeof(uint32)) & ~(PAGE_SIZE - 1)) != |
165 |
(uAddr & ~(PAGE_SIZE - 1)))) { |
166 |
return -EINVAL; |
167 |
} |
168 |
#else |
156 |
if (verify_area(VERIFY_READ, (void *)uAddr, sizeof (uint32)) || |
169 |
if (verify_area(VERIFY_READ, (void *)uAddr, sizeof (uint32)) || |
157 |
verify_area(VERIFY_WRITE, (void *)uAddr, sizeof (uint32)) || |
170 |
verify_area(VERIFY_WRITE, (void *)uAddr, sizeof (uint32)) || |
158 |
(((uAddr + sizeof(uint32)) & ~(PAGE_SIZE - 1)) != |
171 |
(((uAddr + sizeof(uint32)) & ~(PAGE_SIZE - 1)) != |
159 |
(uAddr & ~(PAGE_SIZE - 1)))) { |
172 |
(uAddr & ~(PAGE_SIZE - 1)))) { |
160 |
return -EINVAL; |
173 |
return -EINVAL; |
161 |
} |
174 |
} |
|
|
175 |
#endif |
162 |
|
176 |
|
163 |
*p = UserifLockPage(uAddr); |
177 |
*p = UserifLockPage(uAddr); |
164 |
if (*p == NULL) { |
178 |
if (*p == NULL) { |
Lines 932-934
Link Here
|
932 |
*ret = (VNetPort*)userIf; |
946 |
*ret = (VNetPort*)userIf; |
933 |
return 0; |
947 |
return 0; |
934 |
} |
948 |
} |
|
|
949 |
|
950 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11) |
951 |
/* |
952 |
* Copy a datagram to a linear buffer. See |
953 |
* http://lkml.org/lkml/2005/1/22/60 for source reference. |
954 |
*/ |
955 |
int skb_copy_datagram(const struct sk_buff *skb, int offset, char __user *to, int size) |
956 |
{ |
957 |
struct iovec iov = { |
958 |
.iov_base = to, |
959 |
.iov_len =size, |
960 |
}; |
961 |
|
962 |
return skb_copy_datagram_iovec(skb, offset, &iov, size); |
963 |
} |
964 |
#endif |