]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - ipc/shm.c
doc: move vm/00-INDEX to Documentation/vm
[linux-2.6-omap-h63xx.git] / ipc / shm.c
index a86a3a5c8a19589698dc8b9ec555e1d98891466d..5fc5cf50cf1b847fc630cf2e127f37005337bb94 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -233,7 +233,7 @@ static int shm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 }
 
 #ifdef CONFIG_NUMA
-int shm_set_policy(struct vm_area_struct *vma, struct mempolicy *new)
+static int shm_set_policy(struct vm_area_struct *vma, struct mempolicy *new)
 {
        struct file *file = vma->vm_file;
        struct shm_file_data *sfd = shm_file_data(file);
@@ -243,7 +243,8 @@ int shm_set_policy(struct vm_area_struct *vma, struct mempolicy *new)
        return err;
 }
 
-struct mempolicy *shm_get_policy(struct vm_area_struct *vma, unsigned long addr)
+static struct mempolicy *shm_get_policy(struct vm_area_struct *vma,
+                                       unsigned long addr)
 {
        struct file *file = vma->vm_file;
        struct shm_file_data *sfd = shm_file_data(file);
@@ -906,7 +907,7 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
                goto out_unlock;
 
        path.dentry = dget(shp->shm_file->f_path.dentry);
-       path.mnt    = mntget(shp->shm_file->f_path.mnt);
+       path.mnt    = shp->shm_file->f_path.mnt;
        shp->shm_nattch++;
        size = i_size_read(path.dentry->d_inode);
        shm_unlock(shp);
@@ -914,18 +915,16 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
        err = -ENOMEM;
        sfd = kzalloc(sizeof(*sfd), GFP_KERNEL);
        if (!sfd)
-               goto out_put_path;
+               goto out_put_dentry;
 
        err = -ENOMEM;
-       file = get_empty_filp();
+
+       file = alloc_file(path.mnt, path.dentry, f_mode, &shm_file_operations);
        if (!file)
                goto out_free;
 
-       file->f_op = &shm_file_operations;
        file->private_data = sfd;
-       file->f_path = path;
        file->f_mapping = shp->shm_file->f_mapping;
-       file->f_mode = f_mode;
        sfd->id = shp->id;
        sfd->ns = get_ipc_ns(ns);
        sfd->file = shp->shm_file;
@@ -976,9 +975,8 @@ out_unlock:
 
 out_free:
        kfree(sfd);
-out_put_path:
+out_put_dentry:
        dput(path.dentry);
-       mntput(path.mnt);
        goto out_nattch;
 }