pkt_sched: Remove qdisc->ops->requeue() etc.
[safe/jmp/linux-2.6] / mm / tiny-shmem.c
index c13a216..3e67d57 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <linux/fs.h>
 #include <linux/init.h>
-#include <linux/devfs_fs_kernel.h>
 #include <linux/vfs.h>
 #include <linux/mount.h>
 #include <linux/file.h>
@@ -31,21 +30,20 @@ static struct vfsmount *shm_mnt;
 
 static int __init init_tmpfs(void)
 {
-       register_filesystem(&tmpfs_fs_type);
-#ifdef CONFIG_TMPFS
-       devfs_mk_dir("shm");
-#endif
+       BUG_ON(register_filesystem(&tmpfs_fs_type) != 0);
+
        shm_mnt = kern_mount(&tmpfs_fs_type);
+       BUG_ON(IS_ERR(shm_mnt));
+
        return 0;
 }
 module_init(init_tmpfs)
 
-/*
+/**
  * shmem_file_setup - get an unlinked file living in tmpfs
- *
  * @name: name for dentry (to be seen in /proc/<pid>/maps
  * @size: size to be set for the file
- *
+ * @flags: vm_flags
  */
 struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
 {
@@ -80,11 +78,14 @@ struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
        d_instantiate(dentry, inode);
        inode->i_size = size;
        inode->i_nlink = 0;     /* It is unlinked */
-       file->f_vfsmnt = mntget(shm_mnt);
-       file->f_dentry = dentry;
-       file->f_mapping = inode->i_mapping;
-       file->f_op = &ramfs_file_operations;
-       file->f_mode = FMODE_WRITE | FMODE_READ;
+       init_file(file, shm_mnt, dentry, FMODE_WRITE | FMODE_READ,
+                       &ramfs_file_operations);
+
+#ifndef CONFIG_MMU
+       error = ramfs_nommu_expand_for_mapping(inode, size);
+       if (error)
+               goto close_file;
+#endif
        return file;
 
 close_file:
@@ -94,10 +95,10 @@ put_dentry:
 put_memory:
        return ERR_PTR(error);
 }
+EXPORT_SYMBOL_GPL(shmem_file_setup);
 
-/*
+/**
  * shmem_zero_setup - setup a shared anonymous mapping
- *
  * @vma: the vma to be mmapped is prepared by do_mmap_pgoff
  */
 int shmem_zero_setup(struct vm_area_struct *vma)
@@ -120,3 +121,14 @@ int shmem_unuse(swp_entry_t entry, struct page *page)
 {
        return 0;
 }
+
+#ifndef CONFIG_MMU
+unsigned long shmem_get_unmapped_area(struct file *file,
+                                     unsigned long addr,
+                                     unsigned long len,
+                                     unsigned long pgoff,
+                                     unsigned long flags)
+{
+       return ramfs_nommu_get_unmapped_area(file, addr, len, pgoff, flags);
+}
+#endif