From: Jon Loeliger <jdl-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
To: David Gibson <dwg-8fk3Idey6ehBDgjK7y7TUQ@public.gmane.org>
Cc: Scott Wood <scottwood-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org
Subject: Re: dtc: Return code of fdt_get_path()
Date: Tue, 12 Aug 2008 10:57:17 -0500 [thread overview]
Message-ID: <1218556637.26153.0.camel@ld0161-tx32> (raw)
In-Reply-To: <20080807060820.GA12571-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
On Thu, 2008-08-07 at 16:08 +1000, David Gibson wrote:
> Ugh, yes, confirmed that it is buggy. Not sure of the best way to fix
> this, I can see three ways to go here.
>
> 1. Minimally fix the error code bug, make sure NOSPACE is
> returned when the buffer is too small, length of path otherwise,
> update documentation to match.
> 2. Make the code match the documentation: return 0 on success,
> NOSPACE if the buffer is too small.
> 3. Update both code and documentation to match the semantics I
> think I must have intended at some point: always return the path
> length, even if it exceeds the buffer length; caller is responsible
> for checking if the path in the buffer is truncated.
>
> (3) has the possibly useful property that you can use the call with a
> small buffer and if it fails the caller now knows how big a buffer it
> must allocate. With (1) and (2) the caller's only way to deal with
> NOSPACE is to keep allocating bigger buffers until the call succeeds.
> However it makes it more complex for the caller to check the return
> value - not just that it's non-negative put also that it's less than
> the buffer size. Plus its arguably stylistically inconsistent with
> the read-write functions which return NOSPACE when the buffer is
> exceeded with no indication of how much space is needed.
>
> Any views, Jon?
Just rolling back into town and catching up some....
Has this issue been resolved yet?
jdl
next prev parent reply other threads:[~2008-08-12 15:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-05 21:12 dtc: Return code of fdt_get_path() Scott Wood
[not found] ` <4898C236.5030305-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2008-08-06 5:33 ` David Gibson
[not found] ` <20080806053310.GF6690-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
2008-08-07 6:08 ` David Gibson
[not found] ` <20080807060820.GA12571-787xzQ0H9iRg7VrjXcPTGA@public.gmane.org>
2008-08-12 15:57 ` Jon Loeliger [this message]
2008-08-12 23:15 ` David Gibson
2008-08-29 3:07 ` David Gibson
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=1218556637.26153.0.camel@ld0161-tx32 \
--to=jdl-kzfg59tc24xl57midrcfdg@public.gmane.org \
--cc=devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org \
--cc=dwg-8fk3Idey6ehBDgjK7y7TUQ@public.gmane.org \
--cc=scottwood-KZfg59tc24xl57MIdRCFDg@public.gmane.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