Project

General

Profile

Actions

Feature #2044

closed

Move container_of and ARRAY_SIZE to sys/sysmacros.h

Added by Alexey Zaytsev over 9 years ago. Updated about 9 years ago.

Status:
Resolved
Priority:
Normal
Category:
-
Start date:
2012-01-30
Due date:
% Done:

0%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

Description

The code can be taken from FreeBSD:

#define container_of(p, stype, field) \
((stype *)(((uint8_t *)(p)) - offsetof(stype, field)))

If you wonder what it is, here's an explanation of the Linux container_of macro, which is similar: http://www.kroah.com/log/linux/container_of.html

Actions

Also available in: Atom PDF