All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefani Seibold <stefani@seibold.net>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] Fix proc_file_write missing ppos update
Date: Sat, 08 Aug 2009 11:29:52 +0200	[thread overview]
Message-ID: <1249723792.31457.14.camel@wall-e> (raw)
In-Reply-To: <m1tz0idc5b.fsf@fess.ebiederm.org>

Am Freitag, den 07.08.2009, 23:59 -0700 schrieb Eric W. Biederman:
> Andrew Morton <akpm@linux-foundation.org> writes:
> 
> > On Fri, 07 Aug 2009 23:43:07 +0200
> > Stefani Seibold <stefani@seibold.net> wrote:
> >
> 
> >> So what is your suggestion? Should we drop this patch or should we
> >> analyze the users and fix it?
> >
> > Well.
> >
> > We could review all implementations of ->write_proc.  There only seem
> > to be twenty or so.
> >
> > If any of them will have their behaviour altered by this patch then
> > let's look at those on a case-by-case basis and decide whether making
> > this change will have an acceptable risk.
> >
> > If we _do_ find one for which we simply cannot make this behavioural
> > change then..  ugh.  We could perhaps add a new `bool
> > proc_dir_entry.implement_old_broken_behaviour' and set that flag for
> > the offending driver(s) and test it within proc_write_file().
> >
> > Or we could do
> >
> > 	if (pde->write_proc_new) {
> > 		rv = pde->write_proc_new(file, buffer, count, pde->data);
> > 		*ppos += rv;
> > 	} else {
> > 		rv = pde->write_proc(file, buffer, count, pde->data);
> > 	}
> >
> > which is really the same thing and isn't obviously better ;)
> >
> >> My opinion is to fix it, because it is wrong and it limits the usage of
> >> the proc_write operation. Many embedded developers like me count on proc
> >> support, because it is much simpler to use than the seqfile thing.
> 
> The simple and portable answer is to implement your own file_operations.
> 

This is what i still doing since a long time:

<CodeSnip>
 proc_entry = create_proc_entry(procname, S_IRUGO|S_IWUGO, NULL);

 proc_entry->read_proc = proc_read_foo;

 bar->proc_file_operations.llseek = proc_entry->proc_fops->llseek;
 bar->proc_file_operations.read = proc_entry->proc_fops->read;
 bar->proc_file_operations.write = proc_write_foo;

 proc_entry->proc_fops = &bar->proc_file_operations;
</CodeSnip>

This works very well for me, but it requires some additional step
because of the buggy interface.

But the question is: can we fix this bug? 

I will have a look on the current users of proc->write and if there are
no driver which is depending on the old behavior we can fix it. 
   
> It is unlikely that implementing a new totally unstructured proc file is
> a good idea.
> 

That is your opinion. I still use it f.e. to access a eeprom.
 
> I'm not quite up to speed on write_proc but I believe we have been spraying
> read_proc and write_proc because of problems with the interface.
> 

First: I never noticed a problem with the current proc interface. The
only issue i figured out is the proc_write ppos problem.

Second: If speed matters or not is a question of the use case. Sometimes
a simple solution is required.  

Stefani



  reply	other threads:[~2009-08-08  9:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-07 20:27 [PATCH] Fix proc_file_write missing ppos update Stefani Seibold
2009-08-07 20:58 ` Andrew Morton
2009-08-07 21:43   ` Stefani Seibold
2009-08-07 22:16     ` Andrew Morton
2009-08-08  6:59       ` Eric W. Biederman
2009-08-08  9:29         ` Stefani Seibold [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-08-29 16:38 Stefani Seibold
2009-08-29 23:16 ` Christoph Hellwig
2009-08-30  8:09   ` Alexey Dobriyan
2009-08-30 19:10     ` Stefani Seibold
2009-08-30 19:05   ` Stefani Seibold
2009-08-31  6:33     ` Alexey Dobriyan
2009-08-31 15:44       ` Arnd Bergmann
2009-08-31 17:19         ` Alexey Dobriyan
2009-08-31 17:21           ` Christoph Hellwig
2009-08-31 20:19           ` Arnd Bergmann
2009-09-12 15:28     ` Al Viro
2009-09-12 15:57       ` Stefani Seibold
2009-09-12 20:51         ` Eric W. Biederman

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=1249723792.31457.14.camel@wall-e \
    --to=stefani@seibold.net \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.