310275370752967f116b2d2758a66aec169c3159
[cascardo/kernel/slides/.git] / 03types / types
1 %Data Types
2 %Thadeu Cascardo
3
4 # Macros
5
6 * include/linux/kernel.h
7 * ARRAY\\_SIZE
8 * FIELD\\_SIZEOF
9 * ALIGN
10 * PTR\\_ALIGN
11 * IS\\_ALIGNED
12
13 # More macros
14
15 * container\\_of
16 * offsetof
17
18 # krefs
19
20 Reference:
21
22 * Documentation/kref.txt
23
24 # API
25
26 * struct kref
27 * kref\\_init - struct kref pointer
28 * kref\\_get - struct kref pointer
29 * kref\\_put - struct kref pointer and release function
30
31 # Usage
32
33 * Embed struct kref into your own structure
34 * Do not forget to call kref\\_init when initializing your structure
35 * Pass a release function as parameter to kref\\_put, where you release your
36   structure
37 * Follow the rules for calling kref\\_get and kref\\_put
38
39 # Rules
40
41 * Must increment count if passing a non-temporary copy
42 * May increment count without a lock if already has a valid pointer
43 * Must decrement when done with the pointer
44 * If code never tries to get a ref without a valid pointer, may be done without
45   a lock
46 * Must serialize getting a ref without a valid pointer with putting a ref
47
48 # Endianness
49
50 # Lists
51
52 # Bitmaps
53
54 # Trees and hashes
55
56 # Other data types