linux 结构体部分成员初始化

来源:互联网 发布:域名主机记录 编辑:程序博客网 时间:2024/06/05 00:49

1. 结构体

struct file_system_type {const char *name;int fs_flags;#define FS_REQUIRES_DEV1 #define FS_BINARY_MOUNTDATA2#define FS_HAS_SUBTYPE4#define FS_USERNS_MOUNT8/* Can be mounted by userns root */#define FS_USERNS_DEV_MOUNT16 /* A userns mount does not imply MNT_NODEV */#define FS_RENAME_DOES_D_MOVE32768/* FS will handle d_move() during rename() internally. */struct dentry *(*mount) (struct file_system_type *, int,       const char *, void *);void (*kill_sb) (struct super_block *);struct module *owner;struct file_system_type * next;struct hlist_head fs_supers;struct lock_class_key s_lock_key;struct lock_class_key s_umount_key;struct lock_class_key s_vfs_rename_key;struct lock_class_key s_writers_key[SB_FREEZE_LEVELS];struct lock_class_key i_lock_key;struct lock_class_key i_mutex_key;struct lock_class_key i_mutex_dir_key;};

2. 结构体部分成员初始化方法

static struct file_system_type proc_fs_type = {.name= "proc",.mount= proc_mount,.kill_sb= proc_kill_sb,.fs_flags= FS_USERNS_MOUNT,};

注意部分成员初始化的格式!