Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F103099121
D47554.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D47554.id.diff
View Options
diff --git a/sys/netlink/netlink_snl.h b/sys/netlink/netlink_snl.h
--- a/sys/netlink/netlink_snl.h
+++ b/sys/netlink/netlink_snl.h
@@ -31,6 +31,12 @@
* Simple Netlink Library
*/
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <netlink/netlink.h>
+#include <netlink/netlink_bitset.h>
+
#include <assert.h>
#include <errno.h>
#include <stdalign.h>
@@ -41,11 +47,6 @@
#include <string.h>
#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netlink/netlink.h>
-#include <netlink/netlink_bitset.h>
-
#define _roundup2(x, y) (((x)+((y)-1))&(~((y)-1)))
#define NETLINK_ALIGN_SIZE sizeof(uint32_t)
@@ -68,8 +69,6 @@
((char *)NLA_NEXT(_attr) <= _NLA_END(_start, _len)); \
_attr = NLA_NEXT(_attr))
-#define NL_ARRAY_LEN(_a) (sizeof(_a) / sizeof((_a)[0]))
-
struct linear_buffer {
char *base; /* Base allocated memory pointer */
uint32_t offset; /* Currently used offset */
@@ -166,8 +165,8 @@
.out_size = _sz_out, \
.fp = &((_fp)[0]), \
.np = &((_np)[0]), \
- .fp_size = NL_ARRAY_LEN(_fp), \
- .np_size = NL_ARRAY_LEN(_np), \
+ .fp_size = nitems(_fp), \
+ .np_size = nitems(_np), \
.cb_post = _cb, \
}
@@ -179,7 +178,7 @@
.in_hdr_size = _sz_h_in, \
.out_size = _sz_out, \
.fp = &((_fp)[0]), \
- .fp_size = NL_ARRAY_LEN(_fp), \
+ .fp_size = nitems(_fp), \
.cb_post = _cb, \
}
@@ -190,7 +189,7 @@
static const struct snl_hdr_parser _name = { \
.out_size = _sz_out, \
.np = &((_np)[0]), \
- .np_size = NL_ARRAY_LEN(_np), \
+ .np_size = nitems(_np), \
.cb_post = _cb, \
}
@@ -418,7 +417,7 @@
}
}
}
-#define SNL_VERIFY_PARSERS(_p) snl_verify_parsers((_p), NL_ARRAY_LEN(_p))
+#define SNL_VERIFY_PARSERS(_p) snl_verify_parsers((_p), nitems(_p))
static const struct snl_attr_parser *
find_parser(const struct snl_attr_parser *ps, int pslen, int key)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 21, 11:28 PM (6 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14634209
Default Alt Text
D47554.id.diff (1 KB)
Attached To
Mode
D47554: snl(3): use nitems() from param.h
Attached
Detach File
Event Timeline
Log In to Comment