Some operations and some info about TX.
[cascardo/kernel/slides/.git] / 03types / types
index 3102753..da8a825 100644 (file)
@@ -45,12 +45,136 @@ Reference:
   a lock
 * Must serialize getting a ref without a valid pointer with putting a ref
 
+# Basic Types
+
+* include linux/types.h
+* sXX, where XX is 8, 16, 32 or 64
+* uXX
+
 # Endianness
 
+# Little endian and Big endian
+
+* Little endian machines
+       - Alpha
+       - x86
+* Big endian machines
+       - PowerPC
+       - SPARC
+* Multi-endian machines
+       - ARM
+       - MIPS
+       - SH
+
+# Headers
+
+* include asm/byteorder.h
+* include/linux/byteorder/generic.h
+
+# Macros
+
+* cpu\\_to\\_beXX
+* cpu\\_to\\_leXX
+* beXX\\_to\\_cpu
+* leXX\\_to\\_cpu
+* All those with suffix p - use a pointer
+* All those with suffix s - change in situ
+
 # Lists
 
+# Declaration
+
+* include linux/list.h
+* LIST\\_HEAD(head);
+* Embed a struct list\\_head in your structure
+* Use a struct list\\_head pointer to iterate
+
+# Initialization
+
+* INIT\\_LIST\\_HEAD - receives a pointer to the embedded list head
+
+# Operations
+
+* list\\_add - receives a pointer to the element and a head
+* list\\_add\\_tail
+* list\\_del - receives only the pointer to the element
+* list\\_empty
+
+# Access
+
+* list\\_entry(entry, type, member); -- uses container\\_of
+* list\\_first\\_entry(head, type, member);
+
+# Iteration macros
+
+* list\\_for\\_each(lhptr, head);
+* list\\_for\\_each\\_entry(iptr, head, member)
+* list\\_for\\_each\\_safe(lhptr, head);
+
 # Bitmaps
 
-# Trees and hashes
+# Declaration
+
+* include linux/types.h
+* include linux/bitops.h
+* DECLARE\\_BITMAP
+
+# API
+
+* All atomic, prefix \\_ to use non-atomic
+* set\\_bit
+* clear\\_bit
+* change\\_bit
+* test\\_and\\_set\\_bit
+* test\\_and\\_clear\\_bit
+* test\\_and\\_change\\_bit
+
+# Lookup
+
+* find\\_first\\_bit
+* find\\_first\\_zero\\_bit
+* find\\_last\\_bit
+* find\\_next\\_bit
+* find\\_next\\_zero\\_bit
+* for\\_each\\_set\\_bit
+
+# Reb-black tree
+
+# Files
+
+* Documentation/rbtree.txt
+* lib/rbtree.c
+* include linux/rbtree.h
+
+# Usage
+
+* Embed struct rb\\_node into your data structure
+* There's no callback for comparison, write your own lookup and insertion
+  functions
+* Locking is up to the user
+
+# API
+
+* rb\\_entry is the same as container\\_of
+* Create the root with struct rb\\_root name = RB\\_ROOT;
+* Lookup function (see example) uses rb\\_left and rb\\_right members
+* Insertion: lookup insertion point, save the parent and use the functions
+  rb\\_link\\_node and rb\\_insert\\_color (example in Documentation)
+* Erase with rb\\_erase
+* Iterate with functions rb\\_first, rb\\_last, rb\\_next and rb\\_prev
+
+# Hashes
+
+* No hash table
+* There are hash functions found at
+       - include linux/hash.h
+       - include linux/jhash.h
+* Users usually do chaining to resolve collisions
 
 # Other data types
+
+* IDR
+* Flexible Array
+* Plist
+* Radix tree
+* Btree