From mboxrd@z Thu Jan 1 00:00:00 1970 From: Josh Durgin Subject: Re: [PATCH 0/3] Generic libcephfs Java wrappers Date: Thu, 08 Mar 2012 18:47:33 -0800 Message-ID: <4F596F45.5090703@dreamhost.com> References: <4F516A20.8060901@cs.ucsc.edu> <3071055F-EFD8-441A-913C-B04C8BC662FF@cs.ucsc.edu> <4B306D7B-E017-445D-8F76-AB0EDC7B61D7@cs.ucsc.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mail.hq.newdream.net ([66.33.206.127]:54512 "EHLO mail.hq.newdream.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751526Ab2CICrd convert rfc822-to-8bit (ORCPT ); Thu, 8 Mar 2012 21:47:33 -0500 In-Reply-To: Sender: ceph-devel-owner@vger.kernel.org List-ID: To: Noah Watkins Cc: Greg Farnum , Sage Weil , ceph-devel@vger.kernel.org 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 wri= te into the >>> * buffer. If len =3D=3D -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 =3D=3D -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 includ= ing char ** (as you said), char *& (ewww), or=85not 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=20 md_config_t::get_val(). It would also be cleaner if len didn't have a=20 special meaning and md_config_t::get_val() used strings instead of=20 char*. It already uses strings internally, and only the librados C++ ap= i=20 actually uses len=3D-1. -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" i= n the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html