O'Reilly logo

Linux Device Drivers, Second Edition by Alessandro Rubini, Jonathan Corbet

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Quick Reference

The following symbols were introduced in this chapter.

#include <linux/types.h> , typedef u8; , typedef u16; , typedef u32; , typedef u64;

These types are guaranteed to be 8-, 16-, 32-, and 64-bit unsigned integer values. The equivalent signed types exist as well. In user space, you can refer to the types as __u8, __u16, and so forth.

#include <asm/page.h> , PAGE_SIZE , PAGE_SHIFT

These symbols define the number of bytes per page for the current architecture and the number of bits in the page offset (12 for 4-KB pages and 13 for 8-KB pages).

#include <asm/byteorder.h> , __LITTLE_ENDIAN , __BIG_ENDIAN

Only one of the two symbols is defined, depending on the architecture.

#include <asm/byteorder.h> , u32 __cpu_to_le32 (u32); , u32 __le32_to_cpu (u32); ,

Functions for converting between known byte orders and that of the processor. There are more than 60 such functions; see the various files in include/linux/byteorder/ for a full list and the ways in which they are defined.

#include <asm/unaligned.h> , get_unaligned(ptr); , put_unaligned(val, ptr);

Some architectures need to protect unaligned data access using these macros. The macros expand to normal pointer dereferencing for architectures that permit you to access unaligned data.

#include <linux/list.h> , list_add(struct list_head *new, struct list_head *head); , list_add_tail(struct list_head *new, struct list_head *head); , list_del(struct list_head *entry); , list_empty(struct list_head *head); , list_entry(entry, type, member); , list_splice(struct list_head *list, struct list_head *head);

Functions for manipulating circular, doubly linked lists.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required