mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Vladimir Zapolskiy <vz@mleia.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fs: sysfs: don't pass count == 0 to bin file readers
Date: Sun, 24 May 2015 20:07:09 -0400	[thread overview]
Message-ID: <20150525000709.GE7099@htj.duckdns.org> (raw)
In-Reply-To: <555E7C7B.1080706@mleia.com>

On Fri, May 22, 2015 at 03:46:51AM +0300, Vladimir Zapolskiy wrote:
> Hello Tejun,
> 
> On 22.05.2015 02:26, Tejun Heo wrote:
> > Hello, Vladimir.
> > 
> > On Fri, May 22, 2015 at 02:04:31AM +0300, Vladimir Zapolskiy wrote:
> >> But "!size" is a special case,
> >>
> >> 	if (!count || pos >= size)
> >> 		return 0;
> >>
> >> seems to be incorrect in case of !size ===> (pos >= size) == true.
> > 
> > Hmmm... Why is that wrong tho?  If size is zero and pos is zero,
> > there's nothing to do, no?
> 
> positive size value in the context means the fixed exact length of the
> file and if size == 0, then it represents some undefined size, often
> dynamic in runtime. So, if size is zero and pos is zero it stands for
> reading from the beginning of the file as many bytes as allowed by
> battr->read() realization. This special case is utilized by quite many
> bin_attribute users, probably more than half of them set .size to 0.

Ah, right, I completely forgot about that.  Please feel free to add

 Acked-by: Tejun Heo <tj@kernel.org>

to the original patch.

Thanks for the patience.

-- 
tejun

      reply	other threads:[~2015-05-25  0:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-21 21:21 Vladimir Zapolskiy
2015-05-21 22:14 ` Tejun Heo
2015-05-21 23:04   ` Vladimir Zapolskiy
2015-05-21 23:26     ` Tejun Heo
2015-05-22  0:46       ` Vladimir Zapolskiy
2015-05-25  0:07         ` Tejun Heo [this message]

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=20150525000709.GE7099@htj.duckdns.org \
    --to=tj@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vz@mleia.com \
    /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

all inboxes | Powered by JetHome®