All of lore.kernel.org
 help / color / mirror / Atom feed
* simplify procfs code for seq_file instances V2
@ 2018-04-25 15:47 ` Christoph Hellwig
  0 siblings, 0 replies; 171+ messages in thread
From: Christoph Hellwig @ 2018-04-25 15:47 UTC (permalink / raw)
  To: Andrew Morton, Alexander Viro
  Cc: linux-rtc, Alessandro Zummo, Alexandre Belloni, devel,
	linux-kernel, linux-scsi, linux-ide, Greg Kroah-Hartman,
	jfs-discussion, linux-afs, linux-acpi, netdev, netfilter-devel,
	Jiri Slaby, linux-ext4, Alexey Dobriyan, megaraidlinux.pdl,
	drbd-dev

We currently have hundreds of proc files that implement plain, read-only
seq_file based interfaces.  This series consolidates them using new
procfs helpers that take the seq_operations or simple show callback
directly.

A git tree is available at:

    git://git.infradead.org/users/hch/misc.git proc_create.2

Gitweb:

    http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/proc_create.2

Changes since V1:
 - open code proc_create_data to avoid setting not fully initialized
   entries live
 - use unsigned int for state_size
 - dropped the s390/cio/blacklist hunk as it has a write method
 - dropped the IPMI patch given that IPMI proc support is scheduled for
   removal.

^ permalink raw reply	[flat|nested] 171+ messages in thread
* Re: [PATCH 2/3] proc: Add a way to make network proc files writable
@ 2018-05-15 19:08 Alexey Dobriyan
  0 siblings, 0 replies; 171+ messages in thread
From: Alexey Dobriyan @ 2018-05-15 19:08 UTC (permalink / raw)
  To: hch, dhowells; +Cc: linux-kernel, linux-fsdevel

Christoph Hellwig wrote:
> On Tue, May 01, 2018 at 12:20:33AM +0100, David Howells wrote:
> > Provide two extra functions, proc_create_net_data_write() and
> > proc_create_net_single_write() that act like their non-write versions but
> > also set a write method in the proc_dir_entry struct.
> > 
> > An internal simple write function is provided that will copy its buffer and
> > hand it to the pde->write() method if available (or give an error if not).
> > The buffer may be modified by the write method.
> 
> I thought of doing something like this, aѕ it would remove tons of
> boilerplat code from a lot of procfs instances.  But I'd also like to
> hear what Al and Alexey think of it.  We also should offer this for
> non-net proc users as well.

For the record I hate both series. This is kmalloc disease with its
dozens of signatures to do the same thing slightly differently.
It is just runtime .text reduction is hard to argue against.

Function names become longer and signatures themselves become longer and
now you're arguing about indentation and character limit.

I remember reading about abusing C99 intializers to emulate optional
parameters somewhere. If it can be used (with bloat-o-meter in mind)
it will be very much appreciated.

Currently there are

	->proc_fops
	simple seq_file
	custom seq_file with start and stop
	optional write hook
	->data pointer

which is already way too much.

^ permalink raw reply	[flat|nested] 171+ messages in thread

end of thread, other threads:[~2018-05-17 19:14 UTC | newest]

Thread overview: 171+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-25 15:47 simplify procfs code for seq_file instances V2 Christoph Hellwig
2018-04-25 15:47 ` Christoph Hellwig
2018-04-25 15:47 ` Christoph Hellwig
2018-04-25 15:47 ` [PATCH 01/40] net/can: single_open_net needs to be paired with single_release_net Christoph Hellwig
2018-04-25 15:47   ` Christoph Hellwig
2018-04-25 15:47 ` [PATCH 02/40] proc: simplify proc_register calling conventions Christoph Hellwig
2018-04-25 15:47   ` Christoph Hellwig
2018-04-25 15:47   ` Christoph Hellwig
2018-04-25 15:47 ` [PATCH 03/40] proc: add a proc_create_reg helper Christoph Hellwig
2018-04-25 15:47   ` Christoph Hellwig
2018-04-25 15:47   ` Christoph Hellwig
2018-04-25 15:47 ` [PATCH 04/40] proc: introduce proc_create_seq{,_data} Christoph Hellwig
2018-04-25 15:47   ` Christoph Hellwig
2018-04-25 15:47 ` [PATCH 05/40] proc: introduce proc_create_seq_private Christoph Hellwig
2018-04-25 15:47   ` Christoph Hellwig
2018-04-25 15:47   ` Christoph Hellwig
2018-04-25 15:47 ` [PATCH 06/40] proc: introduce proc_create_single{,_data} Christoph Hellwig
2018-04-26  1:45   ` Finn Thain
2018-04-26  1:45     ` Finn Thain
     [not found]     ` <alpine.LNX.2.21.1804261118050.8-i19888lE8tflDoPlx7XIcw@public.gmane.org>
2018-05-15 13:58       ` [PATCH 06/40] proc: introduce proc_create_single{, _data} Christoph Hellwig
2018-05-15 13:58         ` [PATCH 06/40] proc: introduce proc_create_single{,_data} Christoph Hellwig
2018-05-15 13:58         ` Christoph Hellwig
2018-04-25 15:47 ` [PATCH 07/40] ipv{4,6}/udp{,lite}: simplify proc registration Christoph Hellwig
2018-04-25 15:47   ` Christoph Hellwig
2018-04-25 15:47   ` Christoph Hellwig
2018-04-25 15:47 ` [PATCH 08/40] ipv{4,6}/tcp: simplify procfs registration Christoph Hellwig
2018-04-25 15:47   ` Christoph Hellwig
2018-04-25 15:47 ` [PATCH 09/40] ipv{4,6}/ping: simplify proc file creation Christoph Hellwig
2018-04-25 15:47   ` Christoph Hellwig
2018-04-25 15:47 ` [PATCH 10/40] ipv{4, 6}/raw: simplify ѕeq_file code Christoph Hellwig
2018-04-25 15:47   ` [PATCH 10/40] ipv{4,6}/raw: " Christoph Hellwig
2018-04-25 15:47   ` [PATCH 10/40] ipv{4, 6}/raw: " Christoph Hellwig
2018-04-25 15:47 ` [PATCH 11/40] ipv6/flowlabel: simplify pid namespace lookup Christoph Hellwig
2018-04-25 15:47   ` Christoph Hellwig
2018-05-05 12:37   ` Eric W. Biederman
2018-05-05 12:37     ` Eric W. Biederman
     [not found]     ` <878t8y46sy.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2018-05-15 14:56       ` Christoph Hellwig
2018-05-15 14:56         ` Christoph Hellwig
2018-05-15 14:56         ` Christoph Hellwig
2018-05-17  5:28         ` Eric W. Biederman
2018-05-17  5:28           ` Eric W. Biederman
2018-05-17  5:28           ` Eric W. Biederman
     [not found]           ` <871seakg0u.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2018-05-17  6:42             ` Christoph Hellwig
2018-05-17  6:42               ` Christoph Hellwig
2018-05-17  6:42               ` Christoph Hellwig
2018-05-17 19:14               ` Eric W. Biederman
2018-05-17 19:14                 ` Eric W. Biederman
2018-04-25 15:47 ` [PATCH 12/40] net/kcm: simplify proc registration Christoph Hellwig
2018-04-25 15:47   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 13/40] netfilter/x_tables: simplify ѕeq_file code Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 14/40] net: move seq_file_single_net to <linux/seq_file_net.h> Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 15/40] proc: introduce proc_create_net{,_data} Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 16/40] proc: introduce proc_create_net_single Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 17/40] acpi/battery: simplify procfs code Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 18/40] sgi-gru: " Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 19/40] megaraid: " Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 20/40] sg: " Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 21/40] afs: " Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-30 23:20   ` [PATCH 0/3] afs: Network-namespacing and proc David Howells
2018-04-30 23:20     ` [PATCH 1/3] afs: Rearrange fs/afs/proc.c David Howells
2018-05-15 13:43       ` Christoph Hellwig
2018-04-30 23:20     ` [PATCH 2/3] proc: Add a way to make network proc files writable David Howells
2018-05-15 13:48       ` Christoph Hellwig
2018-05-15 14:16       ` David Howells
2018-04-30 23:20     ` [PATCH 3/3] afs: Implement namespacing David Howells
2018-05-15 13:53       ` Christoph Hellwig
2018-05-15 14:28       ` 'Adding' a writable proc file under /proc/net/afs/ [was [PATCH 3/3] afs: Implement namespacing] David Howells
2018-04-25 15:48 ` [PATCH 22/40] ext4: simplify procfs code Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 23/40] jfs: " Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 24/40] staging/rtl8192u: " Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 25/40] resource: switch to proc_create_seq_data Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 26/40] drbd: switch to proc_create_single Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 27/40] rtc/proc: switch to proc_create_single_data Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 18:25   ` Alexandre Belloni
2018-04-25 18:25     ` Alexandre Belloni
2018-04-25 18:25     ` Alexandre Belloni
2018-04-25 15:48 ` [PATCH 28/40] bonding: switch to proc_create_seq_data Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 29/40] hostap: switch to proc_create_{seq,single}_data Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 30/40] neigh: switch to proc_create_seq_data Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 31/40] netfilter/xt_hashlimit: switch to proc_create_{seq, single}_data Christoph Hellwig
2018-04-25 15:48   ` [PATCH 31/40] netfilter/xt_hashlimit: switch to proc_create_{seq,single}_data Christoph Hellwig
2018-04-25 15:48   ` [PATCH 31/40] netfilter/xt_hashlimit: switch to proc_create_{seq, single}_data Christoph Hellwig
2018-04-25 15:48 ` [PATCH 32/40] netfilter/x_tables: switch to proc_create_seq_private Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 33/40] bluetooth: switch to proc_create_seq_data Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 34/40] atm: simplify procfs code Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-05-05 12:51   ` Eric W. Biederman
2018-05-05 12:51     ` Eric W. Biederman
2018-05-05 12:51     ` Eric W. Biederman
     [not found]     ` <87r2mq2rll.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2018-05-15 14:12       ` Christoph Hellwig
2018-05-15 14:12         ` Christoph Hellwig
2018-05-15 14:12         ` Christoph Hellwig
2018-05-17  1:15         ` Eric W. Biederman
2018-05-17  1:15           ` Eric W. Biederman
2018-04-25 15:48 ` [PATCH 35/40] atm: switch to proc_create_seq_private Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 36/40] isdn: replace ->proc_fops with ->proc_show Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 37/40] proc: don't detour through seq->private to get the inode Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 38/40] ide: remove ide_driver_proc_write Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-05-05 13:09   ` Eric W. Biederman
2018-05-05 13:09     ` Eric W. Biederman
2018-05-05 13:09     ` Eric W. Biederman
2018-04-25 15:48 ` [PATCH 39/40] ide: replace ->proc_fops with ->proc_show Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48 ` [PATCH 40/40] tty: " Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-25 15:48   ` Christoph Hellwig
2018-04-30 13:19 ` [PATCH 04/40] proc: introduce proc_create_seq{,_data} David Howells
2018-04-30 13:19   ` David Howells
2018-04-30 13:19   ` David Howells
     [not found]   ` <26540.1525094365-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2018-05-15 14:42     ` [PATCH 04/40] proc: introduce proc_create_seq{, _data} Christoph Hellwig
2018-05-15 14:42       ` [PATCH 04/40] proc: introduce proc_create_seq{,_data} Christoph Hellwig
2018-04-30 15:38 ` simplify procfs code for seq_file instances V2 David Howells
2018-05-06 17:19 ` Alexey Dobriyan
2018-05-06 17:19   ` Alexey Dobriyan
2018-05-06 17:19   ` Alexey Dobriyan
2018-05-06 17:45   ` Al Viro
2018-05-09 16:53     ` Alexey Dobriyan
2018-05-09 16:53       ` Alexey Dobriyan
2018-05-15 14:03   ` Christoph Hellwig
2018-05-15 14:03     ` Christoph Hellwig
2018-05-15 14:03     ` Christoph Hellwig
2018-05-15 19:08 [PATCH 2/3] proc: Add a way to make network proc files writable Alexey Dobriyan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.