git://ftp.safe.ca
/
safe
/
jmp
/
linux-2.6
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[MIPS] TXx9: rename asm-mips/mach-jmr3927 to asm-mips/mach-tx39xx
[safe/jmp/linux-2.6]
/
mm
/
tiny-shmem.c
diff --git
a/mm/tiny-shmem.c
b/mm/tiny-shmem.c
index
cdc6d43
..
ae532f5
100644
(file)
--- a/
mm/tiny-shmem.c
+++ b/
mm/tiny-shmem.c
@@
-12,7
+12,6
@@
#include <linux/fs.h>
#include <linux/init.h>
#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>
#include <linux/vfs.h>
#include <linux/mount.h>
#include <linux/file.h>
@@
-33,9
+32,6
@@
static int __init init_tmpfs(void)
{
BUG_ON(register_filesystem(&tmpfs_fs_type) != 0);
{
BUG_ON(register_filesystem(&tmpfs_fs_type) != 0);
-#ifdef CONFIG_TMPFS
- devfs_mk_dir("shm");
-#endif
shm_mnt = kern_mount(&tmpfs_fs_type);
BUG_ON(IS_ERR(shm_mnt));
shm_mnt = kern_mount(&tmpfs_fs_type);
BUG_ON(IS_ERR(shm_mnt));
@@
-43,12
+39,11
@@
static int __init init_tmpfs(void)
}
module_init(init_tmpfs)
}
module_init(init_tmpfs)
-/*
+/*
*
* shmem_file_setup - get an unlinked file living in 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
* @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)
{
*/
struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
{
@@
-70,27
+65,22
@@
struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
if (!dentry)
goto put_memory;
if (!dentry)
goto put_memory;
- error = -ENFILE;
- file = get_empty_filp();
- if (!file)
- goto put_dentry;
-
error = -ENOSPC;
inode = ramfs_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0);
if (!inode)
error = -ENOSPC;
inode = ramfs_get_inode(root->d_sb, S_IFREG | S_IRWXUGO, 0);
if (!inode)
- goto
close_file
;
+ goto
put_dentry
;
d_instantiate(dentry, inode);
d_instantiate(dentry, inode);
- inode->i_nlink = 0; /* It is unlinked */
+ error = -ENFILE;
+ file = alloc_file(shm_mnt, dentry, FMODE_WRITE | FMODE_READ,
+ &ramfs_file_operations);
+ if (!file)
+ goto put_dentry;
- 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;
+ inode->i_nlink = 0; /* It is unlinked */
/* notify everyone as to the change of file size */
/* notify everyone as to the change of file size */
- error = do_truncate(dentry, size, file);
+ error = do_truncate(dentry, size,
0,
file);
if (error < 0)
goto close_file;
if (error < 0)
goto close_file;
@@
-98,15
+88,16
@@
struct file *shmem_file_setup(char *name, loff_t size, unsigned long flags)
close_file:
put_filp(file);
close_file:
put_filp(file);
+ return ERR_PTR(error);
+
put_dentry:
dput(dentry);
put_memory:
return ERR_PTR(error);
}
put_dentry:
dput(dentry);
put_memory:
return ERR_PTR(error);
}
-/*
+/*
*
* shmem_zero_setup - setup a shared anonymous mapping
* 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)
* @vma: the vma to be mmapped is prepared by do_mmap_pgoff
*/
int shmem_zero_setup(struct vm_area_struct *vma)
@@
-130,16
+121,6
@@
int shmem_unuse(swp_entry_t entry, struct page *page)
return 0;
}
return 0;
}
-int shmem_mmap(struct file *file, struct vm_area_struct *vma)
-{
- file_accessed(file);
-#ifndef CONFIG_MMU
- return ramfs_nommu_mmap(file, vma);
-#else
- return 0;
-#endif
-}
-
#ifndef CONFIG_MMU
unsigned long shmem_get_unmapped_area(struct file *file,
unsigned long addr,
#ifndef CONFIG_MMU
unsigned long shmem_get_unmapped_area(struct file *file,
unsigned long addr,