2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-01 14:55:18 +00:00

lib/ofpbuf: Rename private fields to discourage direct use.

Direct use of 'data', 'base', and 'size' will break DPDK builds.  Try
to wean us off the habit by renaming the fields.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Alex Wang <alexw@nicira.com>
This commit is contained in:
Jarno Rajahalme
2014-04-08 08:36:33 -07:00
parent 8bd43ce6dc
commit 3f976e12a0

View File

@@ -60,9 +60,9 @@ struct ofpbuf {
#ifdef DPDK_NETDEV #ifdef DPDK_NETDEV
struct rte_mbuf mbuf; /* DPDK mbuf */ struct rte_mbuf mbuf; /* DPDK mbuf */
#else #else
void *base; /* First byte of allocated space. */ void *base_; /* First byte of allocated space. */
void *data; /* First byte actually in use. */ void *data_; /* First byte actually in use. */
uint32_t size; /* Number of bytes in use. */ uint32_t size_; /* Number of bytes in use. */
#endif #endif
uint32_t allocated; /* Number of bytes allocated. */ uint32_t allocated; /* Number of bytes allocated. */
@@ -389,32 +389,32 @@ static inline void ofpbuf_set_size(struct ofpbuf *b, uint32_t v)
#else #else
static inline void * ofpbuf_data(const struct ofpbuf *b) static inline void * ofpbuf_data(const struct ofpbuf *b)
{ {
return b->data; return b->data_;
} }
static inline void ofpbuf_set_data(struct ofpbuf *b, void *d) static inline void ofpbuf_set_data(struct ofpbuf *b, void *d)
{ {
b->data = d; b->data_ = d;
} }
static inline void * ofpbuf_base(const struct ofpbuf *b) static inline void * ofpbuf_base(const struct ofpbuf *b)
{ {
return b->base; return b->base_;
} }
static inline void ofpbuf_set_base(struct ofpbuf *b, void *d) static inline void ofpbuf_set_base(struct ofpbuf *b, void *d)
{ {
b->base = d; b->base_ = d;
} }
static inline uint32_t ofpbuf_size(const struct ofpbuf *b) static inline uint32_t ofpbuf_size(const struct ofpbuf *b)
{ {
return b->size; return b->size_;
} }
static inline void ofpbuf_set_size(struct ofpbuf *b, uint32_t v) static inline void ofpbuf_set_size(struct ofpbuf *b, uint32_t v)
{ {
b->size = v; b->size_ = v;
} }
#endif #endif