[ovs-dev] [PATCH] Broken build on MSVC

Alin Serdean aserdean at cloudbasesolutions.com
Mon Mar 16 20:11:23 UTC 2015


Remove pad member from struct ofpact_nest.

Also MSVC does not support parameters with __declspec as stated in:
https://msdn.microsoft.com/en-us/library/373ak2y1.aspx so accommodate the
code to the new format.

Signed-off-by: Alin Gabriel Serdean <aserdean at cloudbasesolutions.com>
---
 lib/ofp-actions.c      | 12 ++++++------
 lib/ofp-actions.h      |  8 ++++----
 ofproto/ofproto-dpif.c |  2 +-
 ofproto/ofproto.c      |  2 +-
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index 260d854..dac77fe 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -5625,7 +5625,7 @@ ofpact_check__(enum ofputil_protocol *usable_protocols, struct ofpact *a,
  *
  * May temporarily modify 'flow', but restores the changes before returning. */
 enum ofperr
-ofpacts_check(struct ofpact ofpacts[], size_t ofpacts_len,
+ofpacts_check(struct ofpact *ofpacts, size_t ofpacts_len,
               struct flow *flow, ofp_port_t max_ports,
               uint8_t table_id, uint8_t n_tables,
               enum ofputil_protocol *usable_protocols)
@@ -5653,7 +5653,7 @@ ofpacts_check(struct ofpact ofpacts[], size_t ofpacts_len,
 /* Like ofpacts_check(), but reports inconsistencies as
  * OFPERR_OFPBAC_MATCH_INCONSISTENT rather than clearing bits. */
 enum ofperr
-ofpacts_check_consistency(struct ofpact ofpacts[], size_t ofpacts_len,
+ofpacts_check_consistency(struct ofpact *ofpacts, size_t ofpacts_len,
                           struct flow *flow, ofp_port_t max_ports,
                           uint8_t table_id, uint8_t n_tables,
                           enum ofputil_protocol usable_protocols)
@@ -5675,7 +5675,7 @@ ofpacts_check_consistency(struct ofpact ofpacts[], size_t ofpacts_len,
  * 'allowed_ovsinsts' is a bitmap of OVSINST_* values, in which 1-bits indicate
  * instructions that are allowed within 'ofpacts[]'. */
 static enum ofperr
-ofpacts_verify(const struct ofpact ofpacts[], size_t ofpacts_len,
+ofpacts_verify(const struct ofpact *ofpacts, size_t ofpacts_len,
                uint32_t allowed_ovsinsts)
 {
     const struct ofpact *a;
@@ -5749,7 +5749,7 @@ encode_ofpact(const struct ofpact *a, enum ofp_version ofp_version,
  * actions in 'openflow', appending the actions to any existing data in
  * 'openflow'. */
 size_t
-ofpacts_put_openflow_actions(const struct ofpact ofpacts[], size_t ofpacts_len,
+ofpacts_put_openflow_actions(const struct ofpact *ofpacts, size_t ofpacts_len,
                              struct ofpbuf *openflow,
                              enum ofp_version ofp_version)
 {
@@ -5770,7 +5770,7 @@ ofpact_is_apply_actions(const struct ofpact *a)
 }
 
 void
-ofpacts_put_openflow_instructions(const struct ofpact ofpacts[],
+ofpacts_put_openflow_instructions(const struct ofpact *ofpacts,
                                   size_t ofpacts_len,
                                   struct ofpbuf *openflow,
                                   enum ofp_version ofp_version)
@@ -6059,7 +6059,7 @@ ofpacts_equal(const struct ofpact *a, size_t a_len,
  * This function relies on the order of 'ofpacts' being correct (as checked by
  * ofpacts_verify()). */
 uint32_t
-ofpacts_get_meter(const struct ofpact ofpacts[], size_t ofpacts_len)
+ofpacts_get_meter(const struct ofpact *ofpacts, size_t ofpacts_len)
 {
     const struct ofpact *a;
 
diff --git a/lib/ofp-actions.h b/lib/ofp-actions.h
index c232513..3ad7cbf 100644
--- a/lib/ofp-actions.h
+++ b/lib/ofp-actions.h
@@ -1,4 +1,4 @@
-/*
+/* 
  * Copyright (c) 2012, 2013, 2014, 2015 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -175,6 +175,7 @@ OVS_ALIGNED_STRUCT(OFPACT_ALIGNTO, ofpact) {
                                  * struct ofpact, excluding padding. */
 };
 BUILD_ASSERT_DECL(sizeof(struct ofpact) == OFPACT_ALIGNTO);
+typedef struct ofpact _ofpact;
 
 static inline struct ofpact *
 ofpact_next(const struct ofpact *ofpact)
@@ -457,7 +458,6 @@ struct ofpact_meter {
  * Used for OFPIT11_WRITE_ACTIONS. */
 struct ofpact_nest {
     struct ofpact ofpact;
-    uint8_t pad[PAD_SIZE(sizeof(struct ofpact), OFPACT_ALIGNTO)];
     struct ofpact actions[];
 };
 BUILD_ASSERT_DECL(offsetof(struct ofpact_nest, actions) % OFPACT_ALIGNTO == 0);
@@ -752,8 +752,8 @@ bool ofpacts_output_to_port(const struct ofpact[], size_t ofpacts_len,
                             ofp_port_t port);
 bool ofpacts_output_to_group(const struct ofpact[], size_t ofpacts_len,
                              uint32_t group_id);
-bool ofpacts_equal(const struct ofpact a[], size_t a_len,
-                   const struct ofpact b[], size_t b_len);
+bool ofpacts_equal(const struct ofpact[], size_t a_len,
+                   const struct ofpact[], size_t b_len);
 uint32_t ofpacts_get_meter(const struct ofpact[], size_t ofpacts_len);
 
 /* Formatting and parsing ofpacts. */
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 38ad6e2..9480548 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -4897,7 +4897,7 @@ exit:
 static void
 ofproto_trace(struct ofproto_dpif *ofproto, struct flow *flow,
               const struct dp_packet *packet,
-              const struct ofpact ofpacts[], size_t ofpacts_len,
+              const struct ofpact *ofpacts, size_t ofpacts_len,
               struct ds *ds)
 {
     struct trace_ctx trace;
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 07a1f5d..4a7fd8c 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -3205,7 +3205,7 @@ reject_slave_controller(struct ofconn *ofconn)
  * Returns 0 if successful, otherwise an OpenFlow error. */
 static enum ofperr
 ofproto_check_ofpacts(struct ofproto *ofproto,
-                      const struct ofpact ofpacts[], size_t ofpacts_len)
+                      const struct ofpact *ofpacts, size_t ofpacts_len)
 {
     const struct ofpact *a;
     uint32_t mid;
-- 
1.9.5.msysgit.0



More information about the dev mailing list