日期:2014-05-16  浏览次数:20619 次

内核的struct file在哪儿定义的
内核的file结构体在哪儿定义的,怎么找不到啊,我在include/file.h中找到的定义是这样的:
C/C++ code

struct file {
    struct file *next;
    struct file *parent;
    char *name;
    int lineno;
    int flags;
};



这个应该不是内核的file结构吧,里面连文件操作都没有,
我要找的是这个:
C/C++ code

struct file
{
    /*
     * fu_list becomes invalid after file_free is called and queued via
     * fu_rcuhead for RCU freeing
     * */
    union
    {
        struct list_head     fu_list;
        struct rcu_head  fu_rcuhead;
    } f_u;
    struct dentry        *f_dentry;
    struct vfsmount        *f_vfsmnt;
    const struct file_operations *f_op;
    atomic_t       f_count;
    unsigned int        f_flags;
    mode_t                f_mode;
    loff_t f_pos;
    struct fown_structf_owner;
    unsigned int
    f_uid, f_gid;
    struct file_ra_statef_ra;
    unsigned long f_version;
    void              *f_security;       /* needed for tty driver, and maybe others */
    void              *private_data;
#ifdef CONFIG_EPOLL
    /* Used by fs/eventpoll.c to link all the hooks to this file */
    struct list_head     f_ep_links;
    spinlock_t            f_ep_lock;
#endif /* #ifdef CONFIG_EPOLL */
    struct address_space  *f_mapping;
};



但是就是找不到在那个文件中定义的,我的linux内核版本是2.6.38

------解决方案--------------------
include <linux/fs.h>