【求助】关于内核结构的赋值问题
在研究/proc文件系统的时候(《LINUX内核分析及编程》),发现这样的一段代码:
struct proc_dir_entry Our_Proc_File =
{
0,
4,
"test",
S_IFREG | S_IFUGO,
1,
0,0,
80,
NULL,
procfile_read,
NULL
};
而struct proc_dir_entry是这样的:
struct proc_dir_entry{
unsigned short low_ino;
unsigned short namelen;
const char* name;
mode_t mode;
nlink_t nlink;
uid_t uid;
gid_t gid;
unsigned long size;
struct inode_operations* proc_iops;
struct file_operations* proc_fops;
get_info_t* get_info;
struct module* owner;
struct proc_dir_entry *next, *parent, *subdir;
void* data;
read_proc_t* read_proc;
write_proc_t* write_proc;
atomic_t count;
int deleted;
kdev_t rdev;
};
如果是下面这种形式的赋值我还知道:
struct proc_dir_entry Our_Proc_File =
{
low_ino:0,
namelen:4,
name:"test",
mode:S_IFREG | S_IFUGO,
nlink:1,
uid:0,gid:0,
size:80,
next:NULL,
read_proc_t:procfile_read,
write_proc_t:NULL
};
第一种赋值方式真搞不明白为什么可以那样?是不是有什么窍门?