X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=fs%2Ffile_table.c;h=69652c5bd5f0ad83b983324d4dc2d31b7a1cd689;hb=1e2ae599d37e60958c03ca5e46b1f657619a30cd;hp=602a9ee3023a43817ce1327a4527e07b7560f64e;hpb=3d1e463158febf6e047897597722f768b15350cd;p=safe%2Fjmp%2Flinux-2.6 diff --git a/fs/file_table.c b/fs/file_table.c index 602a9ee..69652c5 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -21,9 +21,12 @@ #include #include #include +#include #include +#include "internal.h" + /* sysctl tunables... */ struct files_stat_struct files_stat = { .max_files = NR_FILE @@ -162,8 +165,8 @@ fail: * If all the callers of init_file() are eliminated, its * code should be moved into this function. */ -struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry, - fmode_t mode, const struct file_operations *fop) +struct file *alloc_file(struct path *path, fmode_t mode, + const struct file_operations *fop) { struct file *file; @@ -171,9 +174,8 @@ struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry, if (!file) return NULL; - file->f_path.dentry = dentry; - file->f_path.mnt = mntget(mnt); - file->f_mapping = dentry->d_inode->i_mapping; + file->f_path = *path; + file->f_mapping = path->dentry->d_inode->i_mapping; file->f_mode = mode; file->f_op = fop; @@ -183,14 +185,14 @@ struct file *alloc_file(struct vfsmount *mnt, struct dentry *dentry, * visible. We do this for consistency, and so * that we can do debugging checks at __fput() */ - if ((mode & FMODE_WRITE) && !special_file(dentry->d_inode->i_mode)) { - int error = 0; + if ((mode & FMODE_WRITE) && !special_file(path->dentry->d_inode->i_mode)) { file_take_write(file); - error = mnt_clone_write(mnt); - WARN_ON(error); + WARN_ON(mnt_clone_write(path->mnt)); } + ima_counts_get(file); return file; } +EXPORT_SYMBOL(alloc_file); void fput(struct file *file) {