From nobody Sat Jan 01 21:40:02 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9CC961928AB1; Sat, 1 Jan 2022 21:40:05 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JRFm52tXPz3Ckc; Sat, 1 Jan 2022 21:40:05 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from aniel.nours.eu (nours.eu [176.31.115.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id 147482AC3C; Sat, 1 Jan 2022 21:40:05 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: by aniel.nours.eu (Postfix, from userid 1001) id E7797F5396; Sat, 1 Jan 2022 22:40:02 +0100 (CET) Date: Sat, 1 Jan 2022 22:40:02 +0100 From: Baptiste Daroussin To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" , alfsiciliano@gmail.com Subject: Re: git: 18f20d5d967a - main - bsddialog: convert bsdinstall/distextract Message-ID: <20220101214002.k5jy6o7h2njst7l5@aniel.nours.eu> References: <202201012052.201KqrhV082129@gitrepo.freebsd.org> <41538126-67AC-4C19-9414-BD4E8B85D23B@freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <41538126-67AC-4C19-9414-BD4E8B85D23B@freebsd.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641073205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=95ft9V0o2Y20+c9+v8Jk+XjidiM57FLNLnX+w+OSY9Q=; b=Xn6M/SGDoXMszTFMvCfsXPxvJG0ijNghVefHAMMa5cuzGQmbfwlbnG9ihX90MPFy7VUReC OsL57mcecd47tbSsInXX5VNNTqV5+twLc40v0qqum0Xd0tAet7RnA28PWbKYEd2aJyE2KS HaVqNqdsxly1Tpwkl1p7bx3ulFCLYznGIQQQodd3L9neh3x6bTKgAlE8qF34LBtlOccIPr VCPeXcblxFwP+XwKMz/hB4QrtXga6NAPb5rPw12TmFYa/FqxPxuvNFd2B+OzZ8qB4FblJY gr5Tv3XKV6nAvRwoI8z/+dx2QFoaBpdNyXio4/LwqsHzR88MmscGtubMs4tZ0w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641073205; a=rsa-sha256; cv=none; b=phxyaMY2Ec/RjXTQQo8k+zQocoirsXu8N/JOVSnCpTd7lo3OKhrfle9cbGpQja4R01KNlG wO9CGHKsvWv6KQINI04Fi1OiPdXlOwRde/g3cyUo3TIvczLE9GC8myfjLJOZWEpmtp9G/c iB/EZ++Jha/MV/ibHkV8/yK+AouHBP6MI0nOfimLdQ9fc4breHTcjOBznDJZYARk5Nd1BK i0mkcXBv0VBZvzB02MiQOwgUb1ROPUheyD8f3DMCXOuMV3BkQBtDN2cqecb3F5F+x1LfTy ar5gVBX2x8B8/2brJZSxk3CzBM5kqd7JxoXBomVZlViZwww566frTP5TBFHVuA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On Sat, Jan 01, 2022 at 09:35:50PM +0000, Jessica Clarke wrote: > On 1 Jan 2022, at 20:52, Baptiste Daroussin wrote: > > > > The branch main has been updated by bapt: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=18f20d5d967ae790f121963e1fcee68d729a529e > > > > commit 18f20d5d967ae790f121963e1fcee68d729a529e > > Author: Alfonso Siciliano > > AuthorDate: 2022-01-01 20:50:44 +0000 > > Commit: Baptiste Daroussin > > CommitDate: 2022-01-01 20:51:23 +0000 > > > > bsddialog: convert bsdinstall/distextract > > > > Differential Revision: https://reviews.freebsd.org/D33581 > > --- > > usr.sbin/bsdinstall/distextract/Makefile | 3 +- > > usr.sbin/bsdinstall/distextract/distextract.c | 180 +++++++++++++------------- > > 2 files changed, 92 insertions(+), 91 deletions(-) > > > > diff --git a/usr.sbin/bsdinstall/distextract/Makefile b/usr.sbin/bsdinstall/distextract/Makefile > > index 2b7180e28ea0..5e9f2b9e1473 100644 > > --- a/usr.sbin/bsdinstall/distextract/Makefile > > +++ b/usr.sbin/bsdinstall/distextract/Makefile > > @@ -2,7 +2,8 @@ > > > > BINDIR= ${LIBEXECDIR}/bsdinstall > > PROG= distextract > > -LIBADD= archive dpv dialog m > > +CFLAGS+= -I${SRCTOP}/contrib/bsddialog/lib > > +LIBADD= archive bsddialog m > > > > MAN= > > > > diff --git a/usr.sbin/bsdinstall/distextract/distextract.c b/usr.sbin/bsdinstall/distextract/distextract.c > > index 8ad6c7b2c64b..df10c299ab7f 100644 > > --- a/usr.sbin/bsdinstall/distextract/distextract.c > > +++ b/usr.sbin/bsdinstall/distextract/distextract.c > > @@ -33,11 +33,12 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > #include > > -#include > > -#include > > +#include > > +#include > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -46,30 +47,27 @@ __FBSDID("$FreeBSD$"); > > /* Data to process */ > > static char *distdir = NULL; > > static struct archive *archive = NULL; > > -static struct dpv_file_node *dists = NULL; > > > > /* Function prototypes */ > > static void sig_int(int sig); > > static int count_files(const char *file); > > -static int extract_files(struct dpv_file_node *file, int out); > > +static int extract_files(struct bsddialog_fileminibar *file); > > > > -#define _errx(...) (end_dialog(), errx(__VA_ARGS__)) > > +#define _errx(...) (bsddialog_end(), errx(__VA_ARGS__)) > > > > int > > main(void) > > { > > char *chrootdir; > > char *distributions; > > + unsigned int i; > > int retval; > > - size_t config_size = sizeof(struct dpv_config); > > - size_t file_node_size = sizeof(struct dpv_file_node); > > + size_t minibar_size = sizeof(struct bsddialog_fileminibar); > > size_t span; > > - struct dpv_config *config; > > - struct dpv_file_node *dist = dists; > > - static char backtitle[] = "FreeBSD Installer"; > > - static char title[] = "Archive Extraction"; > > - static char aprompt[] = "\n Overall Progress:"; > > - static char pprompt[] = "Extracting distribution files...\n"; > > + unsigned int nminibars; > > + struct bsddialog_fileminibar *dists; > > + struct bsddialog_progviewconf pvconf; > > + struct bsddialog_conf conf; > > struct sigaction act; > > char error[PATH_MAX + 512]; > > > > @@ -78,17 +76,17 @@ main(void) > > if ((distdir = getenv("BSDINSTALL_DISTDIR")) == NULL) > > distdir = __DECONST(char *, ""); > > > > - /* Initialize dialog(3) */ > > - init_dialog(stdin, stdout); > > - dialog_vars.backtitle = backtitle; > > - dlg_put_backtitle(); > > - > > - dialog_msgbox("", > > - "Checking distribution archives.\nPlease wait...", 4, 35, FALSE); > > - > > - /* > > - * Parse $DISTRIBUTIONS into dpv(3) linked-list > > - */ > > + if (bsddialog_init() == BSDDIALOG_ERROR) > > + errx(EXIT_FAILURE, "Cannot init libbsdialog"); > > + bsddialog_initconf(&conf); > > + bsddialog_backtitle(&conf, __DECONST(char *, "FreeBSD Installer")); > > Can all these interfaces really not just use a const char * rather than > having to scatter __DECONST everywhere if you want to pass a string > literal to functions like this? There are quite a few __DECONST’s of > string literals in this patch alone... > > Jess Adding Alfonso to CC. Yes I agree, the __DECONST are from me, not from Alfonso, I added them to avoid having to play with WARNS and make progress in the conversion anyway. Then start the discussion with Alfonso to see how we can improve this. Best regrads, Bapt