[ovs-dev] [PATCH 2/5] vswitchd: Consistently use size_t for action lengths.

Jesse Gross jesse at nicira.com
Sun Dec 12 20:47:04 UTC 2010


Currently the type of the datapath action length is mixture of
size_t and unsigned int.  However, size_t is really defined as an
unsigned long, which causes the build to fail on 64-bit platforms.
This consistently uses size_t.
---
 lib/dpif-linux.c  |    2 +-
 lib/dpif-netdev.c |   10 +++++-----
 lib/dpif.c        |    2 +-
 lib/odp-util.c    |    2 +-
 ofproto/in-band.c |    2 +-
 ofproto/in-band.h |    2 +-
 ofproto/ofproto.c |    4 ++--
 vswitchd/bridge.c |    2 +-
 8 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c
index 6aa3335..870e03e 100644
--- a/lib/dpif-linux.c
+++ b/lib/dpif-linux.c
@@ -392,7 +392,7 @@ dpif_linux_flow_list(const struct dpif *dpif_, struct odp_flow flows[], int n)
 
 static int
 dpif_linux_execute(struct dpif *dpif_,
-                   const struct nlattr *actions, unsigned int actions_len,
+                   const struct nlattr *actions, size_t actions_len,
                    const struct ofpbuf *buf)
 {
     struct odp_execute execute;
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 29f3cc9..74cd0ca 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -109,7 +109,7 @@ struct dp_netdev_flow {
 
     /* Actions. */
     struct nlattr *actions;
-    unsigned int actions_len;
+    size_t actions_len;
 };
 
 /* Interface to netdev-based datapath. */
@@ -142,7 +142,7 @@ static int dp_netdev_output_control(struct dp_netdev *, const struct ofpbuf *,
 static int dp_netdev_execute_actions(struct dp_netdev *,
                                      struct ofpbuf *, struct flow *,
                                      const struct nlattr *actions,
-                                     unsigned int actions_len);
+                                     size_t actions_len);
 
 static struct dpif_class dpif_dummy_class;
 
@@ -621,7 +621,7 @@ dpif_netdev_flow_get(const struct dpif *dpif, struct odp_flow flows[], int n)
 
 static int
 dpif_netdev_validate_actions(const struct nlattr *actions,
-                             unsigned int actions_len, bool *mutates)
+                             size_t actions_len, bool *mutates)
 {
     const struct nlattr *a;
     unsigned int left;
@@ -801,7 +801,7 @@ dpif_netdev_flow_list(const struct dpif *dpif, struct odp_flow flows[], int n)
 
 static int
 dpif_netdev_execute(struct dpif *dpif,
-                    const struct nlattr *actions, unsigned int actions_len,
+                    const struct nlattr *actions, size_t actions_len,
                     const struct ofpbuf *packet)
 {
     struct dp_netdev *dp = get_dp_netdev(dpif);
@@ -1197,7 +1197,7 @@ static int
 dp_netdev_execute_actions(struct dp_netdev *dp,
                           struct ofpbuf *packet, struct flow *key,
                           const struct nlattr *actions,
-                          unsigned int actions_len)
+                          size_t actions_len)
 {
     const struct nlattr *a;
     unsigned int left;
diff --git a/lib/dpif.c b/lib/dpif.c
index d4d9b34..a0f638a 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -1132,7 +1132,7 @@ static void
 log_flow_message(const struct dpif *dpif, int error, const char *operation,
                  const struct odp_flow_key *flow,
                  const struct odp_flow_stats *stats,
-                 const struct nlattr *actions, unsigned int actions_len)
+                 const struct nlattr *actions, size_t actions_len)
 {
     struct ds ds = DS_EMPTY_INITIALIZER;
     ds_put_format(&ds, "%s: ", dpif_name(dpif));
diff --git a/lib/odp-util.c b/lib/odp-util.c
index dd6b629..91320c4 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -171,7 +171,7 @@ format_odp_action(struct ds *ds, const struct nlattr *a)
 
 void
 format_odp_actions(struct ds *ds, const struct nlattr *actions,
-                   unsigned int actions_len)
+                   size_t actions_len)
 {
     if (actions_len) {
         const struct nlattr *a;
diff --git a/ofproto/in-band.c b/ofproto/in-band.c
index 9655f10..6623aca 100644
--- a/ofproto/in-band.c
+++ b/ofproto/in-band.c
@@ -429,7 +429,7 @@ in_band_msg_in_hook(struct in_band *in_band, const struct flow *flow,
  * allowed to be set up in the datapath. */
 bool
 in_band_rule_check(struct in_band *in_band, const struct flow *flow,
-                   const struct nlattr *actions, unsigned int actions_len)
+                   const struct nlattr *actions, size_t actions_len)
 {
     if (!in_band) {
         return true;
diff --git a/ofproto/in-band.h b/ofproto/in-band.h
index 972acaa..d90dc85 100644
--- a/ofproto/in-band.h
+++ b/ofproto/in-band.h
@@ -41,7 +41,7 @@ bool in_band_msg_in_hook(struct in_band *, const struct flow *,
                          const struct ofpbuf *packet);
 bool in_band_rule_check(struct in_band *, const struct flow *,
                         const struct nlattr *odp_actions,
-                        unsigned int actions_len);
+                        size_t actions_len);
 void in_band_flushed(struct in_band *);
 
 #endif /* in-band.h */
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 255df65..c7f211a 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -225,7 +225,7 @@ struct facet {
     bool installed;              /* Installed in datapath? */
     bool may_install;            /* True ordinarily; false if actions must
                                   * be reassessed for every packet. */
-    unsigned int actions_len;    /* Number of bytes in actions[]. */
+    size_t actions_len;          /* Number of bytes in actions[]. */
     struct nlattr *actions;      /* Datapath actions. */
     tag_type tags;               /* Tags (set only by hooks). */
     struct netflow_flow nf_flow; /* Per-flow NetFlow tracking data. */
@@ -2050,7 +2050,7 @@ rule_has_out_port(const struct rule *rule, ovs_be16 out_port)
  * Takes ownership of 'packet'. */
 static bool
 execute_odp_actions(struct ofproto *ofproto, uint16_t in_port,
-                    const struct nlattr *odp_actions, unsigned int actions_len,
+                    const struct nlattr *odp_actions, size_t actions_len,
                     struct ofpbuf *packet)
 {
     if (actions_len == NLA_ALIGN(NLA_HDRLEN + sizeof(uint64_t))
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 8ade873..6691746 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -2719,7 +2719,7 @@ bridge_normal_ofhook_cb(const struct flow *flow, const struct ofpbuf *packet,
 static void
 bridge_account_flow_ofhook_cb(const struct flow *flow, tag_type tags,
                               const struct nlattr *actions,
-                              unsigned int actions_len,
+                              size_t actions_len,
                               unsigned long long int n_bytes, void *br_)
 {
     struct bridge *br = br_;
-- 
1.7.1





More information about the dev mailing list