From f3a5415e6d0350bb9ae6783c976061995a192d7b Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Sun, 16 May 2010 13:50:52 -0300 Subject: [PATCH] Conversion macros and krefs. --- 03types/types | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 03types/types diff --git a/03types/types b/03types/types new file mode 100644 index 0000000..3102753 --- /dev/null +++ b/03types/types @@ -0,0 +1,56 @@ +%Data Types +%Thadeu Cascardo + +# Macros + +* include/linux/kernel.h +* ARRAY\\_SIZE +* FIELD\\_SIZEOF +* ALIGN +* PTR\\_ALIGN +* IS\\_ALIGNED + +# More macros + +* container\\_of +* offsetof + +# krefs + +Reference: + +* Documentation/kref.txt + +# API + +* struct kref +* kref\\_init - struct kref pointer +* kref\\_get - struct kref pointer +* kref\\_put - struct kref pointer and release function + +# Usage + +* Embed struct kref into your own structure +* Do not forget to call kref\\_init when initializing your structure +* Pass a release function as parameter to kref\\_put, where you release your + structure +* Follow the rules for calling kref\\_get and kref\\_put + +# Rules + +* Must increment count if passing a non-temporary copy +* May increment count without a lock if already has a valid pointer +* Must decrement when done with the pointer +* If code never tries to get a ref without a valid pointer, may be done without + a lock +* Must serialize getting a ref without a valid pointer with putting a ref + +# Endianness + +# Lists + +# Bitmaps + +# Trees and hashes + +# Other data types -- 2.20.1