From: Ben Pfaff Date: Wed, 24 Feb 2010 21:47:09 +0000 (-0800) Subject: Merge "master" into "next". X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02dd3123a0e312f1d33403e744af52dd6096f12d;p=openvswitch Merge "master" into "next". --- 02dd3123a0e312f1d33403e744af52dd6096f12d diff --cc include/openflow/openflow.h index 27dae8fd,78061118..b77cd701 --- a/include/openflow/openflow.h +++ b/include/openflow/openflow.h @@@ -37,20 -37,10 +37,14 @@@ #define OFP_ASSERT BOOST_STATIC_ASSERT #endif /* __cplusplus */ - #ifndef SWIG - #define OFP_PACKED __attribute__((packed)) - #else - #define OFP_PACKED /* SWIG doesn't understand __attribute. */ - #endif - +/* Version number: + * Non-experimental versions released: 0x01 + * Experimental versions released: 0x81 -- 0x99 + */ /* The most significant bit being set in the version field indicates an - * experimental OpenFlow version. + * experimental OpenFlow version. */ -#define OFP_VERSION 0x97 +#define OFP_VERSION 0x01 #define OFP_MAX_TABLE_NAME_LEN 32 #define OFP_MAX_PORT_NAME_LEN 16 diff --cc lib/compiler.h index 6c0db0fe,2bb801a4..6bf51445 --- a/lib/compiler.h +++ b/lib/compiler.h @@@ -24,8 -24,13 +24,15 @@@ #define STRFTIME_FORMAT(FMT) __attribute__((__format__(__strftime__, FMT, 0))) #define MALLOC_LIKE __attribute__((__malloc__)) #define ALWAYS_INLINE __attribute__((always_inline)) - #define likely(x) __builtin_expect((x),1) - #define unlikely(x) __builtin_expect((x),0) +#define WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) + #else + #define NO_RETURN + #define OVS_UNUSED + #define PRINTF_FORMAT(FMT, ARG1) + #define STRFTIME_FORMAT(FMT) + #define MALLOC_LIKE + #define ALWAYS_INLINE ++#define WARN_UNUSED_RESULT + #endif #endif /* compiler.h */ diff --cc lib/vconn.c index f8d3beb0,51a51b9c..d8807fda --- a/lib/vconn.c +++ b/lib/vconn.c @@@ -184,51 -221,31 +222,51 @@@ vconn_open(const char *name, int min_ve COVERAGE_INC(vconn_open); check_vconn_classes(); - *vconnp = NULL; - prefix_len = strcspn(name, ":"); - if (prefix_len == strlen(name)) { - return EAFNOSUPPORT; + /* Look up the class. */ + error = vconn_lookup_class(name, &class); + if (!class) { + goto error; } - for (i = 0; i < ARRAY_SIZE(vconn_classes); i++) { - struct vconn_class *class = vconn_classes[i]; - if (strlen(class->name) == prefix_len - && !memcmp(class->name, name, prefix_len)) { - struct vconn *vconn; - char *suffix_copy = xstrdup(name + prefix_len + 1); - int retval = class->open(name, suffix_copy, &vconn); - free(suffix_copy); - if (!retval) { - assert(vconn->state != VCS_CONNECTING - || vconn->class->connect); - vconn->min_version = min_version; - *vconnp = vconn; - } - return retval; - } + + /* Call class's "open" function. */ + suffix_copy = xstrdup(strchr(name, ':') + 1); + error = class->open(name, suffix_copy, &vconn); + free(suffix_copy); + if (error) { + goto error; } - return EAFNOSUPPORT; + + /* Success. */ + assert(vconn->state != VCS_CONNECTING || vconn->class->connect); + vconn->min_version = min_version; + *vconnp = vconn; + return 0; + + error: + *vconnp = NULL; + return error; } +/* Allows 'vconn' to perform maintenance activities, such as flushing output + * buffers. */ +void +vconn_run(struct vconn *vconn) +{ + if (vconn->class->run) { + (vconn->class->run)(vconn); + } +} + +/* Arranges for the poll loop to wake up when 'vconn' needs to perform + * maintenance activities. */ +void +vconn_run_wait(struct vconn *vconn) +{ + if (vconn->class->run_wait) { + (vconn->class->run_wait)(vconn); + } +} + int vconn_open_block(const char *name, int min_version, struct vconn **vconnp) { diff --cc ofproto/ofproto.c index 0e422146,3768eede..189aa2c8 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@@ -754,12 -759,8 +754,14 @@@ ofproto_destroy(struct ofproto *p mac_learning_destroy(p->ml); + free(p->mfr_desc); + free(p->hw_desc); + free(p->sw_desc); + free(p->serial_desc); + free(p->dp_desc); + + port_array_destroy(&p->ports); + free(p); }