2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-25 15:07:05 +00:00
Files
openvswitch/datapath/compat.h
Pravin B Shelar eba9291a25 datapath: remove actions.h
There are only two symbols in actions.h. Compatibility function
is moved to compat.h and execute_actions() declaration is moved
to datapath.h

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
2011-11-10 19:35:37 -08:00

47 lines
853 B
C

/*
* Copyright (c) 2011 Nicira Networks.
* Distributed under the terms of the GNU GPL version 2.
*
* Significant portions of this file may be copied from parts of the Linux
* kernel, by Linus Torvalds and others.
*/
#ifndef COMPAT_H
#define COMPAT_H 1
#include <linux/netlink.h>
#ifndef HAVE_NLA_NUL_STRING
static inline int CHECK_NUL_STRING(struct nlattr *attr, int maxlen)
{
char *s;
int len;
if (!attr)
return 0;
len = nla_len(attr);
if (len >= maxlen)
return -EINVAL;
s = nla_data(attr);
if (s[len - 1] != '\0')
return -EINVAL;
return 0;
}
#else
static inline int CHECK_NUL_STRING(struct nlattr *attr, int maxlen)
{
return 0;
}
#endif /* !HAVE_NLA_NUL_STRING */
static inline void skb_clear_rxhash(struct sk_buff *skb)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
skb->rxhash = 0;
#endif
}
#endif /* compat.h */