uvers should be using the proper alloc_file helper instead of an
open-coded get_empty_filp.  In fact this was the last modular user
so we can kill the export aswell and force people to use the proper
interface.

Also remove the useless setting of .owner and the fops_get because all
this is not required for file_operations instances in the same module
as the underlying filesystem.


Signed-off-by: Christoph Hellwig <[EMAIL PROTECTED]>

Index: linux-2.6/drivers/infiniband/core/uverbs_main.c
===================================================================
--- linux-2.6.orig/drivers/infiniband/core/uverbs_main.c        2008-02-25 
20:05:12.000000000 +0100
+++ linux-2.6/drivers/infiniband/core/uverbs_main.c     2008-02-25 
20:05:46.000000000 +0100
@@ -372,7 +372,6 @@ static int ib_uverbs_event_close(struct 
 }
 
 static const struct file_operations uverbs_event_fops = {
-       .owner   = THIS_MODULE,
        .read    = ib_uverbs_event_read,
        .poll    = ib_uverbs_event_poll,
        .release = ib_uverbs_event_close,
@@ -516,26 +515,21 @@ struct file *ib_uverbs_alloc_event_file(
                goto err;
        }
 
-       filp = get_empty_filp();
+       /*
+        * fops_get() can't fail here, because we're coming from a
+        * system call on a uverbs file, which will already have a
+        * module reference.
+        */
+       filp = alloc_file(uverbs_event_mnt, uverbs_event_mnt->mnt_root,
+                         FMODE_READ, &uverbs_event_fops);
        if (!filp) {
                ret = -ENFILE;
                goto err_fd;
        }
 
+       filp->private_data = ev_file;
        ev_file->file      = filp;
 
-       /*
-        * fops_get() can't fail here, because we're coming from a
-        * system call on a uverbs file, which will already have a
-        * module reference.
-        */
-       filp->f_op         = fops_get(&uverbs_event_fops);
-       filp->f_path.mnt           = mntget(uverbs_event_mnt);
-       filp->f_path.dentry        = dget(uverbs_event_mnt->mnt_root);
-       filp->f_mapping    = filp->f_path.dentry->d_inode->i_mapping;
-       filp->f_flags      = O_RDONLY;
-       filp->f_mode       = FMODE_READ;
-       filp->private_data = ev_file;
 
        return filp;
 
Index: linux-2.6/fs/file_table.c
===================================================================
--- linux-2.6.orig/fs/file_table.c      2008-02-25 20:05:12.000000000 +0100
+++ linux-2.6/fs/file_table.c   2008-02-25 20:05:46.000000000 +0100
@@ -80,9 +80,13 @@ int proc_nr_files(ctl_table *table, int 
 }
 #endif
 
-/* Find an unused file structure and return a pointer to it.
+/*
+ * Find an unused file structure and return a pointer to it.
  * Returns NULL, if there are no more free file structures or
  * we run out of memory.
+ *
+ * Note that this is an internal helper.  Please use alloc_file
+ * or anon_inode_getfd instead.
  */
 struct file *get_empty_filp(void)
 {
@@ -135,8 +139,6 @@ fail:
        return NULL;
 }
 
-EXPORT_SYMBOL(get_empty_filp);
-
 /**
  * alloc_file - allocate and initialize a 'struct file'
  * @mnt: the vfsmount on which the file will reside
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to