All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Denys Vlasenko <vda.linux@googlemail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] (resend) reuse xxx_fifo_fops for xxx_pipe_fops
Date: Tue, 1 Jul 2008 00:32:55 -0700	[thread overview]
Message-ID: <20080701003255.493f54e0.akpm@linux-foundation.org> (raw)
In-Reply-To: <200807011103.02974.vda.linux@googlemail.com>

On Tue, 1 Jul 2008 11:03:02 +0200 Denys Vlasenko <vda.linux@googlemail.com> wrote:

> Hi Andrew, Al,
> 
> I posted this patch a few months ago, but it apparently
> fell thru cracks. Here we go again.
> 
> I noticed that read/write/rdwr_pipe_fops are (1) const and
> (2) exactly identical to xxx_fifo_fops, which are also const.
> 
> Attached patch #defines xxx_pipe_fops as aliases to xxx_fifo_fops.
> Size difference:
> 
> # size linux-2.6.25-rc6*/*/pipe.o
>    text    data     bss     dec     hex filename
>    6534     144       0    6678    1a16 linux-2.6.25-rc6/fs/pipe.o
>    5862     144       0    6006    1776 linux-2.6.25-rc6-pt/fs/pipe.o
> 
> Run-tested on 2.6.26-rc8. Please apply.
> 
> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>

<argh, an attachment.  save-as, read, edit..>

--- linux-2.6.25-rc6.src/fs/pipe.c	Sat Mar 22 23:00:34 2008
> +++ linux-2.6.25-rc6.pipe/fs/pipe.c	Fri Mar 28 15:52:00 2008
> @@ -814,42 +814,9 @@
>  	.fasync		= pipe_rdwr_fasync,
>  };
>  
> -static const struct file_operations read_pipe_fops = {
> -	.llseek		= no_llseek,
> -	.read		= do_sync_read,
> -	.aio_read	= pipe_read,
> -	.write		= bad_pipe_w,
> -	.poll		= pipe_poll,
> -	.unlocked_ioctl	= pipe_ioctl,
> -	.open		= pipe_read_open,
> -	.release	= pipe_read_release,
> -	.fasync		= pipe_read_fasync,
> -};
> -
> -static const struct file_operations write_pipe_fops = {
> -	.llseek		= no_llseek,
> -	.read		= bad_pipe_r,
> -	.write		= do_sync_write,
> -	.aio_write	= pipe_write,
> -	.poll		= pipe_poll,
> -	.unlocked_ioctl	= pipe_ioctl,
> -	.open		= pipe_write_open,
> -	.release	= pipe_write_release,
> -	.fasync		= pipe_write_fasync,
> -};
> -
> -static const struct file_operations rdwr_pipe_fops = {
> -	.llseek		= no_llseek,
> -	.read		= do_sync_read,
> -	.aio_read	= pipe_read,
> -	.write		= do_sync_write,
> -	.aio_write	= pipe_write,
> -	.poll		= pipe_poll,
> -	.unlocked_ioctl	= pipe_ioctl,
> -	.open		= pipe_rdwr_open,
> -	.release	= pipe_rdwr_release,
> -	.fasync		= pipe_rdwr_fasync,
> -};
> +#define read_pipe_fops  read_fifo_fops
> +#define write_pipe_fops write_fifo_fops
> +#define rdwr_pipe_fops  rdwr_fifo_fops
>  
>  struct pipe_inode_info * alloc_pipe_info(struct inode *inode)
>  {

Well OK.  But there's a risk that someone will go and modify
read_fifo_fops without realising that they're also modifying
read_pipe_fops.

So it'd be better to rename read_fifo_fops to (say) shared_read_fops
then do

#define read_pipe_fops shared_read_fops
#define read_fifo_fops shared_read_fops

no?

  parent reply	other threads:[~2008-07-01  7:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-01  9:03 [PATCH] (resend) reuse xxx_fifo_fops for xxx_pipe_fops Denys Vlasenko
2008-07-01  7:31 ` Christoph Hellwig
2008-07-01  7:32 ` Andrew Morton [this message]
2008-07-01 10:03   ` Denys Vlasenko
2008-07-01  8:10     ` Andrew Morton
2008-07-01  8:15       ` Christoph Hellwig
2008-07-01 12:11       ` Denys Vlasenko
2008-07-01 12:16         ` Denys Vlasenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080701003255.493f54e0.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vda.linux@googlemail.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.