fs/befs/befs_fs_types.h

Source file repositories/reference/linux-study-clean/fs/befs/befs_fs_types.h

File Facts

System
Linux kernel
Corpus path
fs/befs/befs_fs_types.h
Extension
.h
Size
5086 bytes
Lines
257
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

#ifndef _LINUX_BEFS_FS_TYPES
#define _LINUX_BEFS_FS_TYPES

#ifdef __KERNEL__
#include <linux/types.h>
#endif /*__KERNEL__*/

#define PACKED __attribute__ ((__packed__))

/*
 * Max name lengths of BFS
 */

#define BEFS_NAME_LEN 255

#define BEFS_SYMLINK_LEN 144
#define BEFS_NUM_DIRECT_BLOCKS 12
#define B_OS_NAME_LENGTH 32

/* The datastream blocks mapped by the double-indirect
 * block are always 4 fs blocks long.
 * This eliminates the need for linear searches among
 * the potentially huge number of indirect blocks
 *
 * Err. Should that be 4 fs blocks or 4k???
 * It matters on large blocksize volumes
 */
#define BEFS_DBLINDIR_BRUN_LEN 4

/*
 * Flags of superblock
 */

enum super_flags {
	BEFS_BYTESEX_BE,
	BEFS_BYTESEX_LE,
	BEFS_CLEAN = 0x434c454e,
	BEFS_DIRTY = 0x44495254,
	BEFS_SUPER_MAGIC1 = 0x42465331,	/* BFS1 */
	BEFS_SUPER_MAGIC2 = 0xdd121031,
	BEFS_SUPER_MAGIC3 = 0x15b6830e,
};

#define BEFS_BYTEORDER_NATIVE 0x42494745
#define BEFS_BYTEORDER_NATIVE_LE ((__force fs32)cpu_to_le32(BEFS_BYTEORDER_NATIVE))
#define BEFS_BYTEORDER_NATIVE_BE ((__force fs32)cpu_to_be32(BEFS_BYTEORDER_NATIVE))

#define BEFS_SUPER_MAGIC BEFS_SUPER_MAGIC1
#define BEFS_SUPER_MAGIC1_LE ((__force fs32)cpu_to_le32(BEFS_SUPER_MAGIC1))
#define BEFS_SUPER_MAGIC1_BE ((__force fs32)cpu_to_be32(BEFS_SUPER_MAGIC1))

/*
 * Flags of inode
 */

#define BEFS_INODE_MAGIC1 0x3bbe0ad9

enum inode_flags {
	BEFS_INODE_IN_USE = 0x00000001,
	BEFS_ATTR_INODE = 0x00000004,
	BEFS_INODE_LOGGED = 0x00000008,
	BEFS_INODE_DELETED = 0x00000010,
	BEFS_LONG_SYMLINK = 0x00000040,
	BEFS_PERMANENT_FLAG = 0x0000ffff,
	BEFS_INODE_NO_CREATE = 0x00010000,
	BEFS_INODE_WAS_WRITTEN = 0x00020000,
	BEFS_NO_TRANSACTION = 0x00040000,
};
/*
 * On-Disk datastructures of BeFS
 */

typedef u64 __bitwise fs64;
typedef u32 __bitwise fs32;
typedef u16 __bitwise fs16;

typedef u64 befs_off_t;
typedef fs64 befs_time_t;

/* Block runs */
typedef struct {
	fs32 allocation_group;
	fs16 start;
	fs16 len;
} PACKED befs_disk_block_run;

typedef struct {
	u32 allocation_group;
	u16 start;
	u16 len;

Annotation

Implementation Notes