include/linux/array_size.h

Source file repositories/reference/linux-study-clean/include/linux/array_size.h

File Facts

System
Linux kernel
Corpus path
include/linux/array_size.h
Extension
.h
Size
478 bytes
Lines
20
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

#ifndef _LINUX_ARRAY_SIZE_H
#define _LINUX_ARRAY_SIZE_H

#include <linux/compiler.h>

/**
 * ARRAY_SIZE - get the number of elements in array @arr
 * @arr: array to be sized
 */
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))

/**
 * ARRAY_END - get a pointer to one past the last element in array @arr
 * @arr: array
 */
#define ARRAY_END(arr)  (&(arr)[ARRAY_SIZE(arr)])

#endif  /* _LINUX_ARRAY_SIZE_H */

Annotation

Implementation Notes