aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2008-09-23 18:07:35 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-09-23 18:07:35 -0400
commit5e8814f2f74f53d58aa5679bf32b38a7940033fe (patch)
tree05f70d1d57d20111a57cd35fb971e36f836d24e8 /fs/ext4/super.c
parent9f6200bbfc962d8f926278cf5d5ddb90a228c322 (diff)
downloadkernel_samsung_crespo-5e8814f2f74f53d58aa5679bf32b38a7940033fe.zip
kernel_samsung_crespo-5e8814f2f74f53d58aa5679bf32b38a7940033fe.tar.gz
kernel_samsung_crespo-5e8814f2f74f53d58aa5679bf32b38a7940033fe.tar.bz2
ext4: Combine proc file handling into a single set of functions
Previously mballoc created a separate set of functions for each proc file. This combines the tunables into a single set of functions which gets used for all of the per-superblock proc files, saving approximately 2k of compiled object code. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 7feeec6..9f5468f 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3541,6 +3541,48 @@ static int ext4_get_sb(struct file_system_type *fs_type,
return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super, mnt);
}
+#ifdef CONFIG_PROC_FS
+static int ext4_ui_proc_show(struct seq_file *m, void *v)
+{
+ unsigned int *p = m->private;
+
+ seq_printf(m, "%u\n", *p);
+ return 0;
+}
+
+static int ext4_ui_proc_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, ext4_ui_proc_show, PDE(inode)->data);
+}
+
+static ssize_t ext4_ui_proc_write(struct file *file, const char __user *buf,
+ size_t cnt, loff_t *ppos)
+{
+ unsigned int *p = PDE(file->f_path.dentry->d_inode)->data;
+ char str[32];
+ unsigned long value;
+
+ if (cnt >= sizeof(str))
+ return -EINVAL;
+ if (copy_from_user(str, buf, cnt))
+ return -EFAULT;
+ value = simple_strtol(str, NULL, 0);
+ if (value < 0)
+ return -ERANGE;
+ *p = value;
+ return cnt;
+}
+
+const struct file_operations ext4_ui_proc_fops = {
+ .owner = THIS_MODULE,
+ .open = ext4_ui_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+ .write = ext4_ui_proc_write,
+};
+#endif
+
static struct file_system_type ext4dev_fs_type = {
.owner = THIS_MODULE,
.name = "ext4dev",