From nobody Sat Oct 12 18:30:16 2024 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 4XQsVc55NCz5YnT3; Sat, 12 Oct 2024 18:30:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XQsVc3F2yz4Dxm; Sat, 12 Oct 2024 18:30:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728757816; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XBi8qZA5j0xfGesFltkQwiUBYCWKZKhEBV9m9Gu2O5Q=; b=McRuqmOj4NajpHVGU97o5xpom/BM/uumliJBTXPxNUAGG4cw0Y0Fkhv3Tpkklrir6/51c5 3p50+vITkPhI+nWSAbXPeM6b94fgNpkGa21PcVANqK4shGQTlEskLXF0TkP6YrzGeEheqf MpvFa8kLitup0U2oAm/mJiVehRNzfz43/8g3pREDLbhC1lPig52hZXeklUzD8c50HwL37L WnY06/QDIlgN+7V/0sciwRPRvZdi9zN+E+I0ozgk3gsKa4gIqHU188RtPo/ejh4o6NOPEi arT+FY/S139aA0g4OCW6nGPTX+51eHScLgONig8ulh2xgUGl4l2fy84kvFg4Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1728757816; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XBi8qZA5j0xfGesFltkQwiUBYCWKZKhEBV9m9Gu2O5Q=; b=UklaYrLdhOJtSJgxBwcexjfGoF1IpyvH7a+p72zuqU7Zia1e3NE4Md80rOfeZI8qK1SbaW J1+Sot2PTXkIwt5FDzKSz/cBnVOhl0kgYpts227d2aX8gzvg14ZNdqQDlKmdvob/FOsEzK XL39HbxLVhq1JnlxvVaIBt2HvogN9ZbtIU38mNSTUNq7zdx+aJlPzroCVy4tZq/d/6v+PZ qMFA1X7/ZOrMqAVuRY1O8JIakVhf+WlLy2P5YdjYsafwcoS6XKC0V1HswSbRTRFLysEnPY cvGXXIsxhJvCO1bXrODi/arzHLw0JYvKQYF3ki/xd5dmgHvjxhqrSmFq0d/YYw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1728757816; a=rsa-sha256; cv=none; b=f5Dli2ALu/uFZ6OJMMCuJoGWAygoTFnBC6DwFxO3S4yyQnSfpoym8zPZyGwoQHPAc92jaV gL5DnktdwuxwGl94JiLP5djU4bAcjYX4QC121o5uM/wj8eghHT6iblfE91s3u2F5a0v6s3 rdtViEknFNUR2Eqtf+V+YgHhllyHjmAReDNRc4byFlUDpX5rUVrpM7Ya4MbX+VSXb2M0IV cka+FAA2hOzDhMpyE2kn8zxoJcYt+O+NExC/MGxqIC9/AI5quAqMWVccTc1LKSjjcepRhw uAOpPf+JKTNwXlO0AJ2GJ1W/j8TzcDFf13+mzTMqnx2RkC9UpNXSFW4/Sr/ZIA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XQsVc2JBKzLSL; Sat, 12 Oct 2024 18:30:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49CIUG7P091167; Sat, 12 Oct 2024 18:30:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49CIUGm7091162; Sat, 12 Oct 2024 18:30:16 GMT (envelope-from git) Date: Sat, 12 Oct 2024 18:30:16 GMT Message-Id: <202410121830.49CIUGm7091162@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: 3d1b233e039d - main - sesutil(8): Complete libxo transition 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3d1b233e039daa6748cde507e313afa718b47e4d Auto-Submitted: auto-generated The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=3d1b233e039daa6748cde507e313afa718b47e4d commit 3d1b233e039daa6748cde507e313afa718b47e4d Author: Yan-Hao Wang AuthorDate: 2024-10-12 14:49:23 +0000 Commit: Li-Wen Hsu CommitDate: 2024-10-12 18:21:46 +0000 sesutil(8): Complete libxo transition Reviewed by: des MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D41418 --- usr.sbin/sesutil/eltsub.c | 1 - usr.sbin/sesutil/sesutil.c | 46 ++++++++++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/usr.sbin/sesutil/eltsub.c b/usr.sbin/sesutil/eltsub.c index d18fad5cb784..d28c363bcb13 100644 --- a/usr.sbin/sesutil/eltsub.c +++ b/usr.sbin/sesutil/eltsub.c @@ -33,7 +33,6 @@ #include -#include #include #include #include diff --git a/usr.sbin/sesutil/sesutil.c b/usr.sbin/sesutil/sesutil.c index 24ac52bd9b5c..1fedaab39a64 100644 --- a/usr.sbin/sesutil/sesutil.c +++ b/usr.sbin/sesutil/sesutil.c @@ -37,7 +37,6 @@ #include #include -#include #include #include #include @@ -98,26 +97,26 @@ static const int nbcmds = nitems(cmds); static const char *uflag; static void -usage(FILE *out, const char *subcmd) +usage(const char *subcmd) { int i; if (subcmd == NULL) { - fprintf(out, "Usage: %s [-u /dev/ses] [options]\n", + xo_error("usage: %s [-u /dev/ses] [options]\n", getprogname()); - fprintf(out, "Commands supported:\n"); + xo_error("Commands supported:\n"); } for (i = 0; i < nbcmds; i++) { if (subcmd != NULL) { if (strcmp(subcmd, cmds[i].name) == 0) { - fprintf(out, "Usage: %s %s [-u /dev/ses] " + xo_error("usage: %s %s [-u /dev/ses] " "%s\n\t%s\n", getprogname(), subcmd, cmds[i].param, cmds[i].desc); break; } continue; } - fprintf(out, " %-12s%s\n\t\t%s\n\n", cmds[i].name, + xo_error(" %-12s%s\n\t\t%s\n\n", cmds[i].name, cmds[i].param, cmds[i].desc); } @@ -189,7 +188,7 @@ sesled(int argc, char **argv, bool setfault) onoff = false; if (argc != 3) { - usage(stderr, (setfault ? "fault" : "locate")); + usage(setfault ? "fault" : "locate"); } disk = argv[1]; @@ -200,7 +199,7 @@ sesled(int argc, char **argv, bool setfault) if (endptr != NULL && *endptr == '*') { xo_warnx("Must specifying a SES device (-u) to use a SES " "id# to identify a disk"); - usage(stderr, (setfault ? "fault" : "locate")); + usage(setfault ? "fault" : "locate"); } isses = true; } @@ -210,7 +209,7 @@ sesled(int argc, char **argv, bool setfault) } else if (strcmp(argv[2], "off") == 0) { onoff = false; } else { - usage(stderr, (setfault ? "fault" : "locate")); + usage(setfault ? "fault" : "locate"); } if (strcmp(disk, "all") == 0) { @@ -422,7 +421,7 @@ objmap(int argc, char **argv __unused) char str[32]; if (argc != 1) { - usage(stderr, "map"); + usage("map"); } memset(&e_desc, 0, sizeof(e_desc)); @@ -542,7 +541,8 @@ objmap(int argc, char **argv __unused) free(e_desc.elm_desc_str); xo_close_list("enclosures"); xo_close_container("sesutil"); - xo_finish(); + if (xo_finish() < 0) + xo_err(EXIT_FAILURE, "stdout"); return (EXIT_SUCCESS); } @@ -587,7 +587,7 @@ fetch_device_details(char *devnames, char **model, char **serial, off_t *size) comma = (int)strcspn(devnames, ","); asprintf(&tmp, "/dev/%.*s", comma, devnames); if (tmp == NULL) - err(1, "asprintf"); + xo_err(EXIT_FAILURE, "asprintf"); fd = open(tmp, O_RDONLY); free(tmp); if (fd < 0) { @@ -729,7 +729,7 @@ show(int argc, char **argv __unused) char str[32]; if (argc != 1) { - usage(stderr, "map"); + usage("map"); } first_ses = true; @@ -871,7 +871,8 @@ show(int argc, char **argv __unused) free(e_desc.elm_desc_str); xo_close_list("enclosures"); xo_close_container("sesutil"); - xo_finish(); + if (xo_finish() < 0) + xo_err(EXIT_FAILURE, "stdout"); return (EXIT_SUCCESS); } @@ -886,7 +887,7 @@ encstatus(int argc, char **argv __unused) status = 0; if (argc != 1) { - usage(stderr, "status"); + usage("status"); } /* Get the list of ses devices */ @@ -963,7 +964,8 @@ encstatus(int argc, char **argv __unused) xo_close_list("enclosures"); xo_close_container("sesutil"); - xo_finish(); + if (xo_finish() < 0) + xo_err(EXIT_FAILURE, "stdout"); if (status == 1) { return (EXIT_SUCCESS); @@ -980,7 +982,7 @@ main(int argc, char **argv) argc = xo_parse_args(argc, argv); if (argc < 0) - exit(1); + exit(EXIT_FAILURE); uflag = "/dev/ses[0-9]*"; while ((ch = getopt_long(argc, argv, "u:", NULL, NULL)) != -1) { @@ -990,15 +992,15 @@ main(int argc, char **argv) break; case '?': default: - usage(stderr, NULL); + usage(NULL); } } argc -= optind; argv += optind; if (argc < 1) { - warnx("Missing command"); - usage(stderr, NULL); + xo_warnx("Missing command"); + usage(NULL); } for (i = 0; i < nbcmds; i++) { @@ -1009,8 +1011,8 @@ main(int argc, char **argv) } if (cmd == NULL) { - warnx("unknown command %s", argv[0]); - usage(stderr, NULL); + xo_warnx("unknown command %s", argv[0]); + usage(NULL); } return (cmd->exec(argc, argv));