fs/kernfs/kernfs-internal.h

Source file repositories/reference/linux-study-clean/fs/kernfs/kernfs-internal.h

File Facts

System
Linux kernel
Corpus path
fs/kernfs/kernfs-internal.h
Extension
.h
Size
6509 bytes
Lines
237
Domain
Core OS
Bucket
VFS And Filesystem Core
Inferred role
Core OS: operation-table or driver-model contract
Status
pattern 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

extern const struct file_operations kernfs_dir_fops;
extern const struct inode_operations kernfs_dir_iops;

struct kernfs_node *kernfs_get_active(struct kernfs_node *kn);
void kernfs_put_active(struct kernfs_node *kn);
int kernfs_add_one(struct kernfs_node *kn);
struct kernfs_node *kernfs_new_node(struct kernfs_node *parent,
				    const char *name, umode_t mode,
				    kuid_t uid, kgid_t gid,
				    unsigned flags);

/*
 * file.c
 */
extern const struct file_operations kernfs_file_fops;

bool kernfs_should_drain_open_files(struct kernfs_node *kn);
void kernfs_drain_open_files(struct kernfs_node *kn);

/*
 * symlink.c
 */
extern const struct inode_operations kernfs_symlink_iops;

/*
 * kernfs locks
 */
extern struct kernfs_global_locks *kernfs_locks;

/* Hashed mutex helpers - protect per-node data structures */
static inline struct mutex *kernfs_node_lock_ptr(struct kernfs_node *kn)
{
	int idx = hash_ptr(kn, NR_KERNFS_LOCK_BITS);

	return &kernfs_locks->node_mutex[idx];
}

static inline struct mutex *kernfs_node_lock(struct kernfs_node *kn)
{
	struct mutex *lock = kernfs_node_lock_ptr(kn);

	mutex_lock(lock);
	return lock;
}

DEFINE_CLASS(kernfs_node_lock, struct mutex *,
	     mutex_unlock(_T), kernfs_node_lock(kn), struct kernfs_node *kn)

#endif	/* __KERNFS_INTERNAL_H */

Annotation

Implementation Notes