From: Thadeu Lima de Souza Cascardo Date: Sun, 16 May 2010 17:20:48 +0000 (-0300) Subject: Basic types, endianness and lists. X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fkernel%2Fslides%2F.git;a=commitdiff_plain;h=85cb4d3103a464c14806da5aec12a0e1c8054f02 Basic types, endianness and lists. --- diff --git a/03types/types b/03types/types index 3102753..80a0e4e 100644 --- a/03types/types +++ b/03types/types @@ -45,10 +45,69 @@ 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 + +* FIXME +* Little endian machines + - x86 +* Big endian machines + - SPARC + - MIPS +* Multi-endian machines + - ARM + +# 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 + +* 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