From: Josh Durgin <josh.durgin@dreamhost.com>
To: Noah Watkins <jayhawk@cs.ucsc.edu>
Cc: Greg Farnum <gregory.farnum@dreamhost.com>,
Sage Weil <sage@newdream.net>,
ceph-devel@vger.kernel.org
Subject: Re: [PATCH 0/3] Generic libcephfs Java wrappers
Date: Thu, 08 Mar 2012 18:47:33 -0800 [thread overview]
Message-ID: <4F596F45.5090703@dreamhost.com> (raw)
In-Reply-To: <BE584457-833A-4812-B74B-6764D292CCB8@cs.ucsc.edu>
On 03/08/2012 06:28 PM, Noah Watkins wrote:
>
> On Mar 8, 2012, at 6:16 PM, Greg Farnum wrote:
>
>>> /* Returns a configuration value as a string.
>>> * If len is positive, that is the maximum number of bytes we'll write into the
>>> * buffer. If len == -1, we'll call malloc() and set *buf.
>>> * Returns 0 on success, error code otherwise. Returns ENAMETOOLONG if the
>>> * buffer is too short. */
>>
>> Ah. Two things from that:
>> 1) "If len == -1". Which it isn't, here.
>> 2) There is no voodoo, that just isn't going to work. Either it was created incorrectly in reference to md_config_t::get_val, or else code got moved around without updating that documentation. :/ Options including char ** (as you said), char *& (ewww), or…not doing that?
>>
>> Anybody have thoughts on the right solution?
>
> I am partial to APIs that put the burden on the caller to free/expand the buffer in response to -ENAMETOOLONG. /2cents
That sounds good to me. That comment exactly describes the behavior of
md_config_t::get_val(). It would also be cleaner if len didn't have a
special meaning and md_config_t::get_val() used strings instead of
char*. It already uses strings internally, and only the librados C++ api
actually uses len=-1.
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-03-09 2:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-03 0:47 [PATCH 0/3] Generic libcephfs Java wrappers Noah Watkins
2012-03-07 17:37 ` Sage Weil
2012-03-07 18:02 ` Noah Watkins
2012-03-07 21:40 ` Greg Farnum
2012-03-08 17:30 ` Noah Watkins
2012-03-08 18:48 ` Greg Farnum
2012-03-08 18:54 ` Noah Watkins
2012-03-09 2:16 ` Greg Farnum
2012-03-09 2:28 ` Noah Watkins
2012-03-09 2:47 ` Josh Durgin [this message]
2012-03-09 5:18 ` Sage Weil
2012-03-15 4:24 ` Noah Watkins
2012-03-15 4:38 ` Sage Weil
2012-03-15 4:44 ` Noah Watkins
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=4F596F45.5090703@dreamhost.com \
--to=josh.durgin@dreamhost.com \
--cc=ceph-devel@vger.kernel.org \
--cc=gregory.farnum@dreamhost.com \
--cc=jayhawk@cs.ucsc.edu \
--cc=sage@newdream.net \
/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.