浏览代码

neigh: Create mechanism for generic neigh private areas.

The implementation private sits right after the primary_key memory.

Signed-off-by: David S. Miller <davem@davemloft.net>
David Miller 14 年之前
父节点
当前提交
1026fec873
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      include/net/neighbour.h

+ 7 - 0
include/net/neighbour.h

@@ -179,6 +179,13 @@ struct neigh_table {
 	struct pneigh_entry	**phash_buckets;
 	struct pneigh_entry	**phash_buckets;
 };
 };
 
 
+#define NEIGH_PRIV_ALIGN	sizeof(long long)
+
+static inline void *neighbour_priv(const struct neighbour *n)
+{
+	return (char *)n + ALIGN(sizeof(*n) + n->tbl->key_len, NEIGH_PRIV_ALIGN);
+}
+
 /* flags for neigh_update() */
 /* flags for neigh_update() */
 #define NEIGH_UPDATE_F_OVERRIDE			0x00000001
 #define NEIGH_UPDATE_F_OVERRIDE			0x00000001
 #define NEIGH_UPDATE_F_WEAK_OVERRIDE		0x00000002
 #define NEIGH_UPDATE_F_WEAK_OVERRIDE		0x00000002