Commit 97a32539 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by Linus Torvalds
Browse files

proc: convert everything to "struct proc_ops"

The most notable change is DEFINE_SHOW_ATTRIBUTE macro split in
seq_file.h.

Conversion rule is:

	llseek		=> proc_lseek
	unlocked_ioctl	=> proc_ioctl

	xxx		=> proc_xxx

	delete ".owner = THIS_MODULE" line

[akpm@linux-foundation.org: fix drivers/isdn/capi/kcapi_proc.c]
[sfr@canb.auug.org.au: fix kernel/sched/psi.c]
  Link: http://lkml.kernel.org/r/20200122180545.36222f50@canb.auug.org.au
Link: http://lkml.kernel.org/r/20191225172546.GB13378@avx2


Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d56c0d45
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -119,13 +119,12 @@ static ssize_t srm_env_proc_write(struct file *file, const char __user *buffer,
	return res;
}

static const struct file_operations srm_env_proc_fops = {
	.owner		= THIS_MODULE,
	.open		= srm_env_proc_open,
	.read		= seq_read,
	.llseek		= seq_lseek,
	.release	= single_release,
	.write		= srm_env_proc_write,
static const struct proc_ops srm_env_proc_ops = {
	.proc_open	= srm_env_proc_open,
	.proc_read	= seq_read,
	.proc_lseek	= seq_lseek,
	.proc_release	= single_release,
	.proc_write	= srm_env_proc_write,
};

static int __init
@@ -182,7 +181,7 @@ srm_env_init(void)
	entry = srm_named_entries;
	while (entry->name && entry->id) {
		if (!proc_create_data(entry->name, 0644, named_dir,
			     &srm_env_proc_fops, (void *)entry->id))
			     &srm_env_proc_ops, (void *)entry->id))
			goto cleanup;
		entry++;
	}
@@ -194,7 +193,7 @@ srm_env_init(void)
		char name[4];
		sprintf(name, "%ld", var_num);
		if (!proc_create_data(name, 0644, numbered_dir,
			     &srm_env_proc_fops, (void *)var_num))
			     &srm_env_proc_ops, (void *)var_num))
			goto cleanup;
	}

+4 −4
Original line number Diff line number Diff line
@@ -17,9 +17,9 @@ static ssize_t atags_read(struct file *file, char __user *buf,
	return simple_read_from_buffer(buf, count, ppos, b->data, b->size);
}

static const struct file_operations atags_fops = {
	.read = atags_read,
	.llseek = default_llseek,
static const struct proc_ops atags_proc_ops = {
	.proc_read	= atags_read,
	.proc_lseek	= default_llseek,
};

#define BOOT_PARAMS_SIZE 1536
@@ -61,7 +61,7 @@ static int __init init_atags_procfs(void)
	b->size = size;
	memcpy(b->data, atags_copy, size);

	tags_entry = proc_create_data("atags", 0400, NULL, &atags_fops, b);
	tags_entry = proc_create_data("atags", 0400, NULL, &atags_proc_ops, b);
	if (!tags_entry)
		goto nomem;

+7 −7
Original line number Diff line number Diff line
@@ -162,12 +162,12 @@ static ssize_t alignment_proc_write(struct file *file, const char __user *buffer
	return count;
}

static const struct file_operations alignment_proc_fops = {
	.open		= alignment_proc_open,
	.read		= seq_read,
	.llseek		= seq_lseek,
	.release	= single_release,
	.write		= alignment_proc_write,
static const struct proc_ops alignment_proc_ops = {
	.proc_open	= alignment_proc_open,
	.proc_read	= seq_read,
	.proc_lseek	= seq_lseek,
	.proc_release	= single_release,
	.proc_write	= alignment_proc_write,
};
#endif /* CONFIG_PROC_FS */

@@ -1016,7 +1016,7 @@ static int __init alignment_init(void)
	struct proc_dir_entry *res;

	res = proc_create("cpu/alignment", S_IWUSR | S_IRUGO, NULL,
			  &alignment_proc_fops);
			  &alignment_proc_ops);
	if (!res)
		return -ENOMEM;
#endif
+12 −12
Original line number Diff line number Diff line
@@ -331,10 +331,10 @@ retry:
	return size;
}

static const struct file_operations salinfo_event_fops = {
	.open  = salinfo_event_open,
	.read  = salinfo_event_read,
	.llseek = noop_llseek,
static const struct proc_ops salinfo_event_proc_ops = {
	.proc_open	= salinfo_event_open,
	.proc_read	= salinfo_event_read,
	.proc_lseek	= noop_llseek,
};

static int
@@ -534,12 +534,12 @@ salinfo_log_write(struct file *file, const char __user *buffer, size_t count, lo
	return count;
}

static const struct file_operations salinfo_data_fops = {
	.open    = salinfo_log_open,
	.release = salinfo_log_release,
	.read    = salinfo_log_read,
	.write   = salinfo_log_write,
	.llseek  = default_llseek,
static const struct proc_ops salinfo_data_proc_ops = {
	.proc_open	= salinfo_log_open,
	.proc_release	= salinfo_log_release,
	.proc_read	= salinfo_log_read,
	.proc_write	= salinfo_log_write,
	.proc_lseek	= default_llseek,
};

static int salinfo_cpu_online(unsigned int cpu)
@@ -617,13 +617,13 @@ salinfo_init(void)
			continue;

		entry = proc_create_data("event", S_IRUSR, dir,
					 &salinfo_event_fops, data);
					 &salinfo_event_proc_ops, data);
		if (!entry)
			continue;
		*sdir++ = entry;

		entry = proc_create_data("data", S_IRUSR | S_IWUSR, dir,
					 &salinfo_data_fops, data);
					 &salinfo_data_proc_ops, data);
		if (!entry)
			continue;
		*sdir++ = entry;
+4 −4
Original line number Diff line number Diff line
@@ -26,9 +26,9 @@ static ssize_t bootinfo_read(struct file *file, char __user *buf,
				       bootinfo_size);
}

static const struct file_operations bootinfo_fops = {
	.read = bootinfo_read,
	.llseek = default_llseek,
static const struct proc_ops bootinfo_proc_ops = {
	.proc_read	= bootinfo_read,
	.proc_lseek	= default_llseek,
};

void __init save_bootinfo(const struct bi_record *bi)
@@ -67,7 +67,7 @@ static int __init init_bootinfo_procfs(void)
	if (!bootinfo_copy)
		return -ENOMEM;

	pde = proc_create_data("bootinfo", 0400, NULL, &bootinfo_fops, NULL);
	pde = proc_create_data("bootinfo", 0400, NULL, &bootinfo_proc_ops, NULL);
	if (!pde) {
		kfree(bootinfo_copy);
		return -ENOMEM;
Loading