Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fddda2b7 authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

proc: introduce proc_create_seq{,_data}



Variants of proc_create{,_data} that directly take a struct seq_operations
argument and drastically reduces the boilerplate code in the callers.

All trivial callers converted over.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 7aed53d1
Loading
Loading
Loading
Loading
+1 −14
Original line number Diff line number Diff line
@@ -1942,19 +1942,6 @@ static const struct seq_operations ioc_seq_ops = {
	.show  = ioc_show
};

static int
ioc_open(struct inode *inode, struct file *file)
{
	return seq_open(file, &ioc_seq_ops);
}

static const struct file_operations ioc_fops = {
	.open    = ioc_open,
	.read    = seq_read,
	.llseek  = seq_lseek,
	.release = seq_release
};

static void __init
ioc_proc_init(void)
{
@@ -1964,7 +1951,7 @@ ioc_proc_init(void)
	if (!dir)
		return;

	proc_create(ioc_list->name, 0, dir, &ioc_fops);
	proc_create_seq(ioc_list->name, 0, dir, &ioc_seq_ops);
}
#endif

+1 −15
Original line number Diff line number Diff line
@@ -5708,13 +5708,6 @@ const struct seq_operations pfm_seq_ops = {
 	.show =		pfm_proc_show
};

static int
pfm_proc_open(struct inode *inode, struct file *file)
{
	return seq_open(file, &pfm_seq_ops);
}


/*
 * we come here as soon as local_cpu_data->pfm_syst_wide is set. this happens
 * during pfm_enable() hence before pfm_start(). We cannot assume monitoring
@@ -6537,13 +6530,6 @@ pfm_probe_pmu(void)
	return 0;
}

static const struct file_operations pfm_proc_fops = {
	.open		= pfm_proc_open,
	.read		= seq_read,
	.llseek		= seq_lseek,
	.release	= seq_release,
};

int __init
pfm_init(void)
{
@@ -6615,7 +6601,7 @@ pfm_init(void)
	/*
	 * create /proc/perfmon (mostly for debugging purposes)
	 */
	perfmon_dir = proc_create("perfmon", S_IRUGO, NULL, &pfm_proc_fops);
	perfmon_dir = proc_create_seq("perfmon", S_IRUGO, NULL, &pfm_seq_ops);
	if (perfmon_dir == NULL) {
		printk(KERN_ERR "perfmon: cannot create /proc entry, perfmon disabled\n");
		pmu_conf = NULL;
+1 −13
Original line number Diff line number Diff line
@@ -386,18 +386,6 @@ static const struct seq_operations service_level_seq_ops = {
	.show		= service_level_show
};

static int service_level_open(struct inode *inode, struct file *file)
{
	return seq_open(file, &service_level_seq_ops);
}

static const struct file_operations service_level_ops = {
	.open		= service_level_open,
	.read		= seq_read,
	.llseek 	= seq_lseek,
	.release	= seq_release
};

static void service_level_vm_print(struct seq_file *m,
				   struct service_level *slr)
{
@@ -420,7 +408,7 @@ static struct service_level service_level_vm = {

static __init int create_proc_service_level(void)
{
	proc_create("service_levels", 0, NULL, &service_level_ops);
	proc_create_seq("service_levels", 0, NULL, &service_level_seq_ops);
	if (MACHINE_IS_VM)
		register_service_level(&service_level_vm);
	return 0;
+2 −26
Original line number Diff line number Diff line
@@ -1027,18 +1027,6 @@ static const struct seq_operations partitions_op = {
	.stop	= disk_seqf_stop,
	.show	= show_partition
};

static int partitions_open(struct inode *inode, struct file *file)
{
	return seq_open(file, &partitions_op);
}

static const struct file_operations proc_partitions_operations = {
	.open		= partitions_open,
	.read		= seq_read,
	.llseek		= seq_lseek,
	.release	= seq_release,
};
#endif


@@ -1377,22 +1365,10 @@ static const struct seq_operations diskstats_op = {
	.show	= diskstats_show
};

static int diskstats_open(struct inode *inode, struct file *file)
{
	return seq_open(file, &diskstats_op);
}

static const struct file_operations proc_diskstats_operations = {
	.open		= diskstats_open,
	.read		= seq_read,
	.llseek		= seq_lseek,
	.release	= seq_release,
};

static int __init proc_genhd_init(void)
{
	proc_create("diskstats", 0, NULL, &proc_diskstats_operations);
	proc_create("partitions", 0, NULL, &proc_partitions_operations);
	proc_create_seq("diskstats", 0, NULL, &diskstats_op);
	proc_create_seq("partitions", 0, NULL, &partitions_op);
	return 0;
}
module_init(proc_genhd_init);
+1 −13
Original line number Diff line number Diff line
@@ -94,21 +94,9 @@ static const struct seq_operations crypto_seq_ops = {
	.show		= c_show
};

static int crypto_info_open(struct inode *inode, struct file *file)
{
	return seq_open(file, &crypto_seq_ops);
}
        
static const struct file_operations proc_crypto_ops = {
	.open		= crypto_info_open,
	.read		= seq_read,
	.llseek		= seq_lseek,
	.release	= seq_release
};

void __init crypto_init_proc(void)
{
	proc_create("crypto", 0, NULL, &proc_crypto_ops);
	proc_create_seq("crypto", 0, NULL, &crypto_seq_ops);
}

void __exit crypto_exit_proc(void)
Loading