public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Todd Inglett <tinglett@vnet.ibm.com>
To: "J.D. Hood" <jdthood@yahoo.co.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: proc_file_read() hack?
Date: Mon, 25 Mar 2002 12:18:28 -0600	[thread overview]
Message-ID: <3C9F69F4.3010908@vnet.ibm.com> (raw)
In-Reply-To: <20020323114004.92117.qmail@web10307.mail.yahoo.com>

J.D. Hood wrote:

> I posted a patch which includes the following comment:
> 
> +			/*
> +			 * How to be a proc read function
> +			 * ------------------------------
[...]


How about applying my trivial patch and then adding this to your nice 
comment?

3) Set *start = an address outside the buffer.
    Put the data of the requested offset at *start.
    Return the number of bytes of data placed there.
    If this number is greater than zero and you
    didn't signal eof and the reader is prepared to
    take more data you will be called again with the
    requested offset advanced by the number ob tyes
    absorbed.

The code should still work with the other cases now that the hack is 
fixed.  Of course, rather than add 3), it would be better to re-word 2) 
(e.g. "Set *start = address of the buffer which may or may not be in the 
given buffer.).

There are cases where the data is available and need not be copied.  My 
code got simpler when I got rid of the need to copy my data around.

-todd





  reply	other threads:[~2002-03-25 18:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-23 11:40 proc_file_read() hack? J.D. Hood
2002-03-25 18:18 ` Todd Inglett [this message]
2002-03-25 19:45   ` Thomas Hood
2002-03-27 18:26     ` Todd Inglett
2002-03-28  1:02       ` Thomas Hood
2002-03-28 15:29         ` Todd Inglett
  -- strict thread matches above, loose matches on Subject: below --
2002-03-22 14:34 Todd Inglett

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=3C9F69F4.3010908@vnet.ibm.com \
    --to=tinglett@vnet.ibm.com \
    --cc=jdthood@yahoo.co.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox