Commit 5de3d3bd authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds

[PATCH] shmem whitespace cleanups

Regularize the erratic whitespace conventions in mm/shmem.c.  Removal
of blank line changes BUG_ON line numbers, otherwise builds the same.
parent 42ec8004
...@@ -140,7 +140,7 @@ static void shmem_free_block(struct inode *inode) ...@@ -140,7 +140,7 @@ static void shmem_free_block(struct inode *inode)
* *
* It has to be called with the spinlock held. * It has to be called with the spinlock held.
*/ */
static void shmem_recalc_inode(struct inode * inode) static void shmem_recalc_inode(struct inode *inode)
{ {
struct shmem_inode_info *info = SHMEM_I(inode); struct shmem_inode_info *info = SHMEM_I(inode);
long freed; long freed;
...@@ -511,8 +511,7 @@ static int shmem_notify_change(struct dentry *dentry, struct iattr *attr) ...@@ -511,8 +511,7 @@ static int shmem_notify_change(struct dentry *dentry, struct iattr *attr)
return error; return error;
} }
static void shmem_delete_inode(struct inode *inode)
static void shmem_delete_inode(struct inode * inode)
{ {
struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
struct shmem_inode_info *info = SHMEM_I(inode); struct shmem_inode_info *info = SHMEM_I(inode);
...@@ -524,12 +523,12 @@ static void shmem_delete_inode(struct inode * inode) ...@@ -524,12 +523,12 @@ static void shmem_delete_inode(struct inode * inode)
if (info->flags & VM_ACCOUNT) if (info->flags & VM_ACCOUNT)
vm_unacct_memory(VM_ACCT(inode->i_size)); vm_unacct_memory(VM_ACCT(inode->i_size));
inode->i_size = 0; inode->i_size = 0;
shmem_truncate (inode); shmem_truncate(inode);
} }
BUG_ON(inode->i_blocks); BUG_ON(inode->i_blocks);
spin_lock (&sbinfo->stat_lock); spin_lock(&sbinfo->stat_lock);
sbinfo->free_inodes++; sbinfo->free_inodes++;
spin_unlock (&sbinfo->stat_lock); spin_unlock(&sbinfo->stat_lock);
clear_inode(inode); clear_inode(inode);
} }
...@@ -629,10 +628,10 @@ static int shmem_unuse_inode(struct shmem_inode_info *info, swp_entry_t entry, s ...@@ -629,10 +628,10 @@ static int shmem_unuse_inode(struct shmem_inode_info *info, swp_entry_t entry, s
int shmem_unuse(swp_entry_t entry, struct page *page) int shmem_unuse(swp_entry_t entry, struct page *page)
{ {
struct list_head *p; struct list_head *p;
struct shmem_inode_info * info; struct shmem_inode_info *info;
int found = 0; int found = 0;
spin_lock (&shmem_ilock); spin_lock(&shmem_ilock);
list_for_each(p, &shmem_inodes) { list_for_each(p, &shmem_inodes) {
info = list_entry(p, struct shmem_inode_info, list); info = list_entry(p, struct shmem_inode_info, list);
...@@ -643,14 +642,14 @@ int shmem_unuse(swp_entry_t entry, struct page *page) ...@@ -643,14 +642,14 @@ int shmem_unuse(swp_entry_t entry, struct page *page)
break; break;
} }
} }
spin_unlock (&shmem_ilock); spin_unlock(&shmem_ilock);
return found; return found;
} }
/* /*
* Move the page from the page cache to the swap cache. * Move the page from the page cache to the swap cache.
*/ */
static int shmem_writepage(struct page * page) static int shmem_writepage(struct page *page)
{ {
struct shmem_inode_info *info; struct shmem_inode_info *info;
swp_entry_t *entry, swap; swp_entry_t *entry, swap;
...@@ -909,10 +908,10 @@ struct page *shmem_nopage(struct vm_area_struct *vma, unsigned long address, int ...@@ -909,10 +908,10 @@ struct page *shmem_nopage(struct vm_area_struct *vma, unsigned long address, int
return page; return page;
} }
void shmem_lock(struct file * file, int lock) void shmem_lock(struct file *file, int lock)
{ {
struct inode * inode = file->f_dentry->d_inode; struct inode *inode = file->f_dentry->d_inode;
struct shmem_inode_info * info = SHMEM_I(inode); struct shmem_inode_info *info = SHMEM_I(inode);
spin_lock(&info->lock); spin_lock(&info->lock);
if (lock) if (lock)
...@@ -922,9 +921,9 @@ void shmem_lock(struct file * file, int lock) ...@@ -922,9 +921,9 @@ void shmem_lock(struct file * file, int lock)
spin_unlock(&info->lock); spin_unlock(&info->lock);
} }
static int shmem_mmap(struct file * file, struct vm_area_struct * vma) static int shmem_mmap(struct file *file, struct vm_area_struct *vma)
{ {
struct vm_operations_struct * ops; struct vm_operations_struct *ops;
struct inode *inode = file->f_dentry->d_inode; struct inode *inode = file->f_dentry->d_inode;
ops = &shmem_vm_ops; ops = &shmem_vm_ops;
...@@ -937,17 +936,17 @@ static int shmem_mmap(struct file * file, struct vm_area_struct * vma) ...@@ -937,17 +936,17 @@ static int shmem_mmap(struct file * file, struct vm_area_struct * vma)
struct inode *shmem_get_inode(struct super_block *sb, int mode, int dev) struct inode *shmem_get_inode(struct super_block *sb, int mode, int dev)
{ {
struct inode * inode; struct inode *inode;
struct shmem_inode_info *info; struct shmem_inode_info *info;
struct shmem_sb_info *sbinfo = SHMEM_SB(sb); struct shmem_sb_info *sbinfo = SHMEM_SB(sb);
spin_lock (&sbinfo->stat_lock); spin_lock(&sbinfo->stat_lock);
if (!sbinfo->free_inodes) { if (!sbinfo->free_inodes) {
spin_unlock (&sbinfo->stat_lock); spin_unlock(&sbinfo->stat_lock);
return NULL; return NULL;
} }
sbinfo->free_inodes--; sbinfo->free_inodes--;
spin_unlock (&sbinfo->stat_lock); spin_unlock(&sbinfo->stat_lock);
inode = new_inode(sb); inode = new_inode(sb);
if (inode) { if (inode) {
...@@ -971,9 +970,9 @@ struct inode *shmem_get_inode(struct super_block *sb, int mode, int dev) ...@@ -971,9 +970,9 @@ struct inode *shmem_get_inode(struct super_block *sb, int mode, int dev)
case S_IFREG: case S_IFREG:
inode->i_op = &shmem_inode_operations; inode->i_op = &shmem_inode_operations;
inode->i_fop = &shmem_file_operations; inode->i_fop = &shmem_file_operations;
spin_lock (&shmem_ilock); spin_lock(&shmem_ilock);
list_add_tail(&info->list, &shmem_inodes); list_add_tail(&info->list, &shmem_inodes);
spin_unlock (&shmem_ilock); spin_unlock(&shmem_ilock);
break; break;
case S_IFDIR: case S_IFDIR:
inode->i_nlink++; inode->i_nlink++;
...@@ -1019,7 +1018,7 @@ static struct inode_operations shmem_symlink_inode_operations; ...@@ -1019,7 +1018,7 @@ static struct inode_operations shmem_symlink_inode_operations;
static struct inode_operations shmem_symlink_inline_operations; static struct inode_operations shmem_symlink_inline_operations;
static ssize_t static ssize_t
shmem_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos) shmem_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
{ {
struct inode *inode = file->f_dentry->d_inode; struct inode *inode = file->f_dentry->d_inode;
unsigned long limit = current->rlim[RLIMIT_FSIZE].rlim_cur; unsigned long limit = current->rlim[RLIMIT_FSIZE].rlim_cur;
...@@ -1156,7 +1155,7 @@ shmem_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos) ...@@ -1156,7 +1155,7 @@ shmem_file_write(struct file *file,const char *buf,size_t count,loff_t *ppos)
goto unlock; goto unlock;
} }
static void do_shmem_file_read(struct file * filp, loff_t *ppos, read_descriptor_t * desc) static void do_shmem_file_read(struct file *filp, loff_t *ppos, read_descriptor_t *desc)
{ {
struct inode *inode = filp->f_dentry->d_inode; struct inode *inode = filp->f_dentry->d_inode;
struct address_space *mapping = inode->i_mapping; struct address_space *mapping = inode->i_mapping;
...@@ -1228,7 +1227,7 @@ static void do_shmem_file_read(struct file * filp, loff_t *ppos, read_descriptor ...@@ -1228,7 +1227,7 @@ static void do_shmem_file_read(struct file * filp, loff_t *ppos, read_descriptor
UPDATE_ATIME(inode); UPDATE_ATIME(inode);
} }
static ssize_t shmem_file_read(struct file * filp, char * buf, size_t count, loff_t *ppos) static ssize_t shmem_file_read(struct file *filp, char *buf, size_t count, loff_t *ppos)
{ {
ssize_t retval; ssize_t retval;
...@@ -1259,12 +1258,12 @@ static int shmem_statfs(struct super_block *sb, struct statfs *buf) ...@@ -1259,12 +1258,12 @@ static int shmem_statfs(struct super_block *sb, struct statfs *buf)
buf->f_type = TMPFS_MAGIC; buf->f_type = TMPFS_MAGIC;
buf->f_bsize = PAGE_CACHE_SIZE; buf->f_bsize = PAGE_CACHE_SIZE;
spin_lock (&sbinfo->stat_lock); spin_lock(&sbinfo->stat_lock);
buf->f_blocks = sbinfo->max_blocks; buf->f_blocks = sbinfo->max_blocks;
buf->f_bavail = buf->f_bfree = sbinfo->free_blocks; buf->f_bavail = buf->f_bfree = sbinfo->free_blocks;
buf->f_files = sbinfo->max_inodes; buf->f_files = sbinfo->max_inodes;
buf->f_ffree = sbinfo->free_inodes; buf->f_ffree = sbinfo->free_inodes;
spin_unlock (&sbinfo->stat_lock); spin_unlock(&sbinfo->stat_lock);
buf->f_namelen = NAME_MAX; buf->f_namelen = NAME_MAX;
return 0; return 0;
} }
...@@ -1274,7 +1273,7 @@ static int shmem_statfs(struct super_block *sb, struct statfs *buf) ...@@ -1274,7 +1273,7 @@ static int shmem_statfs(struct super_block *sb, struct statfs *buf)
*/ */
static int shmem_mknod(struct inode *dir, struct dentry *dentry, int mode, int dev) static int shmem_mknod(struct inode *dir, struct dentry *dentry, int mode, int dev)
{ {
struct inode * inode = shmem_get_inode(dir->i_sb, mode, dev); struct inode *inode = shmem_get_inode(dir->i_sb, mode, dev);
int error = -ENOSPC; int error = -ENOSPC;
if (inode) { if (inode) {
...@@ -1287,7 +1286,7 @@ static int shmem_mknod(struct inode *dir, struct dentry *dentry, int mode, int d ...@@ -1287,7 +1286,7 @@ static int shmem_mknod(struct inode *dir, struct dentry *dentry, int mode, int d
return error; return error;
} }
static int shmem_mkdir(struct inode * dir, struct dentry * dentry, int mode) static int shmem_mkdir(struct inode *dir, struct dentry *dentry, int mode)
{ {
int error; int error;
...@@ -1305,7 +1304,7 @@ static int shmem_create(struct inode *dir, struct dentry *dentry, int mode) ...@@ -1305,7 +1304,7 @@ static int shmem_create(struct inode *dir, struct dentry *dentry, int mode)
/* /*
* Link a file.. * Link a file..
*/ */
static int shmem_link(struct dentry *old_dentry, struct inode * dir, struct dentry * dentry) static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
{ {
struct inode *inode = old_dentry->d_inode; struct inode *inode = old_dentry->d_inode;
...@@ -1351,7 +1350,7 @@ static int shmem_empty(struct dentry *dentry) ...@@ -1351,7 +1350,7 @@ static int shmem_empty(struct dentry *dentry)
return 1; return 1;
} }
static int shmem_unlink(struct inode * dir, struct dentry *dentry) static int shmem_unlink(struct inode *dir, struct dentry *dentry)
{ {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
...@@ -1362,7 +1361,7 @@ static int shmem_unlink(struct inode * dir, struct dentry *dentry) ...@@ -1362,7 +1361,7 @@ static int shmem_unlink(struct inode * dir, struct dentry *dentry)
return 0; return 0;
} }
static int shmem_rmdir(struct inode * dir, struct dentry *dentry) static int shmem_rmdir(struct inode *dir, struct dentry *dentry)
{ {
if (!shmem_empty(dentry)) if (!shmem_empty(dentry))
return -ENOTEMPTY; return -ENOTEMPTY;
...@@ -1377,7 +1376,7 @@ static int shmem_rmdir(struct inode * dir, struct dentry *dentry) ...@@ -1377,7 +1376,7 @@ static int shmem_rmdir(struct inode * dir, struct dentry *dentry)
* it exists so that the VFS layer correctly free's it when it * it exists so that the VFS layer correctly free's it when it
* gets overwritten. * gets overwritten.
*/ */
static int shmem_rename(struct inode * old_dir, struct dentry *old_dentry, struct inode * new_dir,struct dentry *new_dentry) static int shmem_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry)
{ {
struct inode *inode = old_dentry->d_inode; struct inode *inode = old_dentry->d_inode;
int they_are_dirs = S_ISDIR(inode->i_mode); int they_are_dirs = S_ISDIR(inode->i_mode);
...@@ -1402,14 +1401,14 @@ static int shmem_rename(struct inode * old_dir, struct dentry *old_dentry, struc ...@@ -1402,14 +1401,14 @@ static int shmem_rename(struct inode * old_dir, struct dentry *old_dentry, struc
return 0; return 0;
} }
static int shmem_symlink(struct inode * dir, struct dentry *dentry, const char * symname) static int shmem_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
{ {
int error; int error;
int len; int len;
struct inode *inode; struct inode *inode;
struct page *page; struct page *page;
char *kaddr; char *kaddr;
struct shmem_inode_info * info; struct shmem_inode_info *info;
len = strlen(symname) + 1; len = strlen(symname) + 1;
if (len > PAGE_CACHE_SIZE) if (len > PAGE_CACHE_SIZE)
...@@ -1437,9 +1436,9 @@ static int shmem_symlink(struct inode * dir, struct dentry *dentry, const char * ...@@ -1437,9 +1436,9 @@ static int shmem_symlink(struct inode * dir, struct dentry *dentry, const char *
return error; return error;
} }
inode->i_op = &shmem_symlink_inode_operations; inode->i_op = &shmem_symlink_inode_operations;
spin_lock (&shmem_ilock); spin_lock(&shmem_ilock);
list_add_tail(&info->list, &shmem_inodes); list_add_tail(&info->list, &shmem_inodes);
spin_unlock (&shmem_ilock); spin_unlock(&shmem_ilock);
kaddr = kmap(page); kaddr = kmap(page);
memcpy(kaddr, symname, len); memcpy(kaddr, symname, len);
kunmap(page); kunmap(page);
...@@ -1456,7 +1455,7 @@ static int shmem_symlink(struct inode * dir, struct dentry *dentry, const char * ...@@ -1456,7 +1455,7 @@ static int shmem_symlink(struct inode * dir, struct dentry *dentry, const char *
static int shmem_readlink_inline(struct dentry *dentry, char *buffer, int buflen) static int shmem_readlink_inline(struct dentry *dentry, char *buffer, int buflen)
{ {
return vfs_readlink(dentry,buffer,buflen, (const char *)SHMEM_I(dentry->d_inode)); return vfs_readlink(dentry, buffer, buflen, (const char *)SHMEM_I(dentry->d_inode));
} }
static int shmem_follow_link_inline(struct dentry *dentry, struct nameidata *nd) static int shmem_follow_link_inline(struct dentry *dentry, struct nameidata *nd)
...@@ -1501,7 +1500,7 @@ static struct inode_operations shmem_symlink_inode_operations = { ...@@ -1501,7 +1500,7 @@ static struct inode_operations shmem_symlink_inode_operations = {
.follow_link = shmem_follow_link, .follow_link = shmem_follow_link,
}; };
static int shmem_parse_options(char *options, int *mode, uid_t *uid, gid_t *gid, unsigned long * blocks, unsigned long *inodes) static int shmem_parse_options(char *options, int *mode, uid_t *uid, gid_t *gid, unsigned long *blocks, unsigned long *inodes)
{ {
char *this_char, *value, *rest; char *this_char, *value, *rest;
...@@ -1564,7 +1563,7 @@ static int shmem_parse_options(char *options, int *mode, uid_t *uid, gid_t *gid, ...@@ -1564,7 +1563,7 @@ static int shmem_parse_options(char *options, int *mode, uid_t *uid, gid_t *gid,
} }
static int shmem_remount_fs (struct super_block *sb, int *flags, char *data) static int shmem_remount_fs(struct super_block *sb, int *flags, char *data)
{ {
struct shmem_sb_info *sbinfo = SHMEM_SB(sb); struct shmem_sb_info *sbinfo = SHMEM_SB(sb);
unsigned long max_blocks = sbinfo->max_blocks; unsigned long max_blocks = sbinfo->max_blocks;
...@@ -1575,16 +1574,16 @@ static int shmem_remount_fs (struct super_block *sb, int *flags, char *data) ...@@ -1575,16 +1574,16 @@ static int shmem_remount_fs (struct super_block *sb, int *flags, char *data)
return shmem_set_size(sbinfo, max_blocks, max_inodes); return shmem_set_size(sbinfo, max_blocks, max_inodes);
} }
int shmem_sync_file(struct file * file, struct dentry *dentry, int datasync) int shmem_sync_file(struct file *file, struct dentry *dentry, int datasync)
{ {
return 0; return 0;
} }
#endif #endif
static int shmem_fill_super(struct super_block * sb, void * data, int silent) static int shmem_fill_super(struct super_block *sb, void *data, int silent)
{ {
struct inode * inode; struct inode *inode;
struct dentry * root; struct dentry *root;
unsigned long blocks, inodes; unsigned long blocks, inodes;
int mode = S_IRWXUGO | S_ISVTX; int mode = S_IRWXUGO | S_ISVTX;
uid_t uid = current->fsuid; uid_t uid = current->fsuid;
...@@ -1615,7 +1614,7 @@ static int shmem_fill_super(struct super_block * sb, void * data, int silent) ...@@ -1615,7 +1614,7 @@ static int shmem_fill_super(struct super_block * sb, void * data, int silent)
sb->s_flags |= MS_NOUSER; sb->s_flags |= MS_NOUSER;
#endif #endif
spin_lock_init (&sbinfo->stat_lock); spin_lock_init(&sbinfo->stat_lock);
sbinfo->max_blocks = blocks; sbinfo->max_blocks = blocks;
sbinfo->free_blocks = blocks; sbinfo->free_blocks = blocks;
sbinfo->max_inodes = inodes; sbinfo->max_inodes = inodes;
...@@ -1655,7 +1654,7 @@ static void shmem_put_super(struct super_block *sb) ...@@ -1655,7 +1654,7 @@ static void shmem_put_super(struct super_block *sb)
sb->u.generic_sbp = NULL; sb->u.generic_sbp = NULL;
} }
static kmem_cache_t * shmem_inode_cachep; static kmem_cache_t *shmem_inode_cachep;
static struct inode *shmem_alloc_inode(struct super_block *sb) static struct inode *shmem_alloc_inode(struct super_block *sb)
{ {
...@@ -1671,7 +1670,7 @@ static void shmem_destroy_inode(struct inode *inode) ...@@ -1671,7 +1670,7 @@ static void shmem_destroy_inode(struct inode *inode)
kmem_cache_free(shmem_inode_cachep, SHMEM_I(inode)); kmem_cache_free(shmem_inode_cachep, SHMEM_I(inode));
} }
static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) static void init_once(void *foo, kmem_cache_t *cachep, unsigned long flags)
{ {
struct shmem_inode_info *p = (struct shmem_inode_info *) foo; struct shmem_inode_info *p = (struct shmem_inode_info *) foo;
...@@ -1775,7 +1774,7 @@ static struct vfsmount *shm_mnt; ...@@ -1775,7 +1774,7 @@ static struct vfsmount *shm_mnt;
static int __init init_shmem_fs(void) static int __init init_shmem_fs(void)
{ {
int error; int error;
struct vfsmount * res; struct vfsmount *res;
error = init_inodecache(); error = init_inodecache();
if (error) if (error)
...@@ -1783,21 +1782,21 @@ static int __init init_shmem_fs(void) ...@@ -1783,21 +1782,21 @@ static int __init init_shmem_fs(void)
error = register_filesystem(&tmpfs_fs_type); error = register_filesystem(&tmpfs_fs_type);
if (error) { if (error) {
printk (KERN_ERR "Could not register tmpfs\n"); printk(KERN_ERR "Could not register tmpfs\n");
goto out2; goto out2;
} }
#ifdef CONFIG_TMPFS #ifdef CONFIG_TMPFS
error = register_filesystem(&shmem_fs_type); error = register_filesystem(&shmem_fs_type);
if (error) { if (error) {
printk (KERN_ERR "Could not register shm fs\n"); printk(KERN_ERR "Could not register shm fs\n");
goto out1; goto out1;
} }
devfs_mk_dir (NULL, "shm", NULL); devfs_mk_dir(NULL, "shm", NULL);
#endif #endif
res = kern_mount(&tmpfs_fs_type); res = kern_mount(&tmpfs_fs_type);
if (IS_ERR (res)) { if (IS_ERR (res)) {
error = PTR_ERR(res); error = PTR_ERR(res);
printk (KERN_ERR "could not kern_mount tmpfs\n"); printk(KERN_ERR "could not kern_mount tmpfs\n");
goto out; goto out;
} }
shm_mnt = res; shm_mnt = res;
...@@ -1838,11 +1837,11 @@ module_exit(exit_shmem_fs) ...@@ -1838,11 +1837,11 @@ module_exit(exit_shmem_fs)
* @size: size to be set for the file * @size: size to be set for the file
* *
*/ */
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)
{ {
int error; int error;
struct file *file; struct file *file;
struct inode * inode; struct inode *inode;
struct dentry *dentry, *root; struct dentry *dentry, *root;
struct qstr this; struct qstr this;
...@@ -1884,7 +1883,7 @@ struct file *shmem_file_setup(char * name, loff_t size, unsigned long flags) ...@@ -1884,7 +1883,7 @@ struct file *shmem_file_setup(char * name, loff_t size, unsigned long flags)
close_file: close_file:
put_filp(file); put_filp(file);
put_dentry: put_dentry:
dput (dentry); dput(dentry);
put_memory: put_memory:
if (flags & VM_ACCOUNT) if (flags & VM_ACCOUNT)
vm_unacct_memory(VM_ACCT(size)); vm_unacct_memory(VM_ACCT(size));
...@@ -1906,7 +1905,7 @@ int shmem_zero_setup(struct vm_area_struct *vma) ...@@ -1906,7 +1905,7 @@ int shmem_zero_setup(struct vm_area_struct *vma)
return PTR_ERR(file); return PTR_ERR(file);
if (vma->vm_file) if (vma->vm_file)
fput (vma->vm_file); fput(vma->vm_file);
vma->vm_file = file; vma->vm_file = file;
vma->vm_ops = &shmem_vm_ops; vma->vm_ops = &shmem_vm_ops;
return 0; return 0;
......
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