fs/ext4/inode-test.c

Source file repositories/reference/linux-study-clean/fs/ext4/inode-test.c

File Facts

System
Linux kernel
Corpus path
fs/ext4/inode-test.c
Extension
.c
Size
7745 bytes
Lines
284
Domain
Core OS
Bucket
VFS And Filesystem Core
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

struct timestamp_expectation {
	const char *test_case_name;
	struct timespec64 expected;
	u32 extra_bits;
	bool msb_set;
	bool lower_bound;
};

static const struct timestamp_expectation test_data[] = {
	{
		.test_case_name = LOWER_BOUND_NEG_NO_EXTRA_BITS_CASE,
		.msb_set = true,
		.lower_bound = true,
		.extra_bits = 0,
		.expected = {.tv_sec = -0x80000000LL, .tv_nsec = 0L},
	},

	{
		.test_case_name = UPPER_BOUND_NEG_NO_EXTRA_BITS_CASE,
		.msb_set = true,
		.lower_bound = false,
		.extra_bits = 0,
		.expected = {.tv_sec = -1LL, .tv_nsec = 0L},
	},

	{
		.test_case_name = LOWER_BOUND_NONNEG_NO_EXTRA_BITS_CASE,
		.msb_set = false,
		.lower_bound = true,
		.extra_bits = 0,
		.expected = {0LL, 0L},
	},

	{
		.test_case_name = UPPER_BOUND_NONNEG_NO_EXTRA_BITS_CASE,
		.msb_set = false,
		.lower_bound = false,
		.extra_bits = 0,
		.expected = {.tv_sec = 0x7fffffffLL, .tv_nsec = 0L},
	},

	{
		.test_case_name = LOWER_BOUND_NEG_LO_1_CASE,
		.msb_set = true,
		.lower_bound = true,
		.extra_bits = 1,
		.expected = {.tv_sec = 0x80000000LL, .tv_nsec = 0L},
	},

	{
		.test_case_name = UPPER_BOUND_NEG_LO_1_CASE,
		.msb_set = true,
		.lower_bound = false,
		.extra_bits = 1,
		.expected = {.tv_sec = 0xffffffffLL, .tv_nsec = 0L},
	},

	{
		.test_case_name = LOWER_BOUND_NONNEG_LO_1_CASE,
		.msb_set = false,
		.lower_bound = true,
		.extra_bits = 1,
		.expected = {.tv_sec = 0x100000000LL, .tv_nsec = 0L},
	},

	{
		.test_case_name = UPPER_BOUND_NONNEG_LO_1_CASE,
		.msb_set = false,
		.lower_bound = false,
		.extra_bits = 1,
		.expected = {.tv_sec = 0x17fffffffLL, .tv_nsec = 0L},
	},

	{
		.test_case_name = LOWER_BOUND_NEG_HI_1_CASE,
		.msb_set = true,
		.lower_bound = true,
		.extra_bits =  2,
		.expected = {.tv_sec = 0x180000000LL, .tv_nsec = 0L},
	},

	{
		.test_case_name = UPPER_BOUND_NEG_HI_1_CASE,
		.msb_set = true,
		.lower_bound = false,
		.extra_bits = 2,
		.expected = {.tv_sec = 0x1ffffffffLL, .tv_nsec = 0L},
	},

	{

Annotation

Implementation Notes