From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 318BDA0C45; Wed, 6 Oct 2021 10:11:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 009C7413D0; Wed, 6 Oct 2021 10:11:38 +0200 (CEST) Received: from smtpservice.6wind.com (host.78.145.23.62.rev.coltfrance.com [62.23.145.78]) by mails.dpdk.org (Postfix) with ESMTP id D7B9941100 for ; Wed, 6 Oct 2021 10:11:37 +0200 (CEST) Received: from 6wind.com (unknown [10.16.18.213]) by smtpservice.6wind.com (Postfix) with ESMTP id AD98460015; Wed, 6 Oct 2021 10:11:37 +0200 (CEST) Date: Wed, 6 Oct 2021 10:11:40 +0200 From: Olivier Matz To: Dmitry Kozlyuk Cc: dev@dpdk.org, Ali Alnubani , Gregory Etelson , David Marchand , Ray Kinsella Message-ID: References: <20211005005516.132377-1-dmitry.kozliuk@gmail.com> <20211005201545.179902-1-dmitry.kozliuk@gmail.com> <20211005201545.179902-3-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211005201545.179902-3-dmitry.kozliuk@gmail.com> Subject: Re: [dpdk-dev] [PATCH v4 2/2] cmdline: make struct rdline opaque X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Dmitry, On Tue, Oct 05, 2021 at 11:15:45PM +0300, Dmitry Kozlyuk wrote: > Hide struct rdline definition and some RDLINE_* constants in order > to be able to change internal buffer sizes transparently to the user. > Add new functions: > > * rdline_new(): allocate and initialize struct rdline. > This function replaces rdline_init() and takes an extra parameter: > opaque user data for the callbacks. > * rdline_free(): deallocate struct rdline. > * rdline_get_history_buffer_size(): for use in tests. > * rdline_get_opaque(): to obtain user data in callback functions. > > Remove rdline_init() function from library headers and export list, > because using it requires the knowledge of sizeof(struct rdline). > > Signed-off-by: Dmitry Kozlyuk [...] > /** > - * Init fields for a struct rdline. Call this only once at the beginning > - * of your program. > - * \param rdl A pointer to an uninitialized struct rdline > + * Allocate and initialize a new rdline instance. > + * > + * \param rdl Receives a pointer to the allocated structure. > * \param write_char The function used by the function to write a character > * \param validate A pointer to the function to execute when the > * user validates the buffer. > * \param complete A pointer to the function to execute when the > * user completes the buffer. > + * \param opaque User data for use in the callbacks. > + * > + * \return 0 on success, negative errno-style code in failure. > */ > -int rdline_init(struct rdline *rdl, > - rdline_write_char_t *write_char, > - rdline_validate_t *validate, > - rdline_complete_t *complete); > +__rte_experimental > +struct rdline *rdline_new(rdline_write_char_t *write_char, > + rdline_validate_t *validate, > + rdline_complete_t *complete, > + void *opaque); The API documentation was not updated after the v4 changes. Apart from this, LGTM, you can directly add my ack in the next version. Thanks, Olivier