[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150525000709.GE7099@htj.duckdns.org>
Date: Sun, 24 May 2015 20:07:09 -0400
From: Tejun Heo <tj@...nel.org>
To: Vladimir Zapolskiy <vz@...ia.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fs: sysfs: don't pass count == 0 to bin file readers
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@...nel.org>
to the original patch.
Thanks for the patience.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists