From: http://blog.yaabou.com /? P = 82
_ User indicates a pointer to a user space, so the kernel cannot be used directly.
# Ifdef _ checker __
# DEFINE _ User _ attribute _ (noderef, address_space (1 )))
# DEFINE _ KERNEL/* default address space */
# Else
# DEFINE _ User
# DEFINE _ KERNEL
# Endif
Noderef tells the compiler that the pointer reference should not be removed because it is meaningless in the current address space.
The checker indicates whether sprase is used (a static analysis tool used to analyze bugs in the kernel source code ). Do you want to study it? Haha. See http://sparse.wiki.kernel.org/index.php/Main_Page
Therefore, copy_to_user and copy_from_user are used in the kernel.
_ Iomem is a feature added in 2.6.9. Indicates the memory space that points to an I/O. It is mainly used to consider the versatility of the driver. The representation of I/O space may vary depending on the CPU architecture. When _ iomem is used, compiler ignores the variable check (because void _ iomem is used ). HoweverSparse will check it. When the _ iomem pointer is mixed with the normal pointer, it will issue some warnings.
The following are some new functions for a variable:
Unsigned int ioread8 (void _ iomem * ADDR );
Unsigned int ioread16 (void _ iomem * ADDR );
Unsigned int ioread32 (void _ iomem * ADDR );
Void iowrite8 (u8 value, void _ iomem * ADDR );
Void iowrite16 (2010value, void _ iomem * ADDR );
Void iowrite32 (u32 value, void _ iomem * ADDR );
You can take a look at the http://lwn.net/Articles/102240/
And http://lwn.net/Articles/102232/