Commit a869e179 authored by Hirofumi Ogawa's avatar Hirofumi Ogawa Committed by Linus Torvalds

[PATCH] Simplify ramfs_getattr() and move it to the generic libfs.c

This moves ramfs_getattr() to fs/libfs.c as simple_getattr()
parent a5b32379
......@@ -6,6 +6,15 @@
#include <linux/pagemap.h>
#include <linux/smp_lock.h>
int simple_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat)
{
struct inode *inode = dentry->d_inode;
generic_fillattr(inode, stat);
stat->blocks = inode->i_mapping->nrpages << (PAGE_CACHE_SHIFT - 9);
return 0;
}
int simple_statfs(struct super_block *sb, struct statfs *buf)
{
buf->f_type = sb->s_magic;
......
......@@ -116,28 +116,6 @@ static int ramfs_create(struct inode *dir, struct dentry *dentry, int mode)
return ramfs_mknod(dir, dentry, mode | S_IFREG, 0);
}
static int ramfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat)
{
struct inode *inode = dentry->d_inode;
stat->dev = inode->i_sb->s_dev;
stat->ino = inode->i_ino;
stat->mode = inode->i_mode;
stat->nlink = inode->i_nlink;
stat->uid = inode->i_uid;
stat->gid = inode->i_gid;
stat->rdev = kdev_t_to_nr(inode->i_rdev);
stat->atime = inode->i_atime;
stat->mtime = inode->i_mtime;
stat->ctime = inode->i_ctime;
stat->size = inode->i_size;
stat->blocks = inode->i_mapping->nrpages << (PAGE_CACHE_SHIFT - 9);
stat->blksize = inode->i_blksize;
return 0;
}
static int ramfs_symlink(struct inode * dir, struct dentry *dentry, const char * symname)
{
struct inode *inode;
......@@ -171,7 +149,7 @@ static struct file_operations ramfs_file_operations = {
};
static struct inode_operations ramfs_file_inode_operations = {
.getattr = ramfs_getattr,
.getattr = simple_getattr,
};
static struct inode_operations ramfs_dir_inode_operations = {
......
......@@ -1300,6 +1300,7 @@ extern int dcache_dir_open(struct inode *, struct file *);
extern int dcache_dir_close(struct inode *, struct file *);
extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
extern int dcache_readdir(struct file *, void *, filldir_t);
extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
extern int simple_statfs(struct super_block *, struct statfs *);
extern int simple_link(struct dentry *, struct inode *, struct dentry *);
extern int simple_unlink(struct inode *, struct dentry *);
......
......@@ -299,6 +299,7 @@ EXPORT_SYMBOL(dcache_dir_open);
EXPORT_SYMBOL(dcache_dir_close);
EXPORT_SYMBOL(dcache_dir_lseek);
EXPORT_SYMBOL(dcache_readdir);
EXPORT_SYMBOL(simple_getattr);
EXPORT_SYMBOL(simple_statfs);
EXPORT_SYMBOL(simple_lookup);
EXPORT_SYMBOL(simple_dir_operations);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment