From owner-svn-src-head@freebsd.org Wed Jun 19 15:36:06 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6FEE015BC3AF; Wed, 19 Jun 2019 15:36:06 +0000 (UTC) (envelope-from mav@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1D3BC6B43B; Wed, 19 Jun 2019 15:36:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E89282664A; Wed, 19 Jun 2019 15:36:05 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5JFa5le090774; Wed, 19 Jun 2019 15:36:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5JFa2EO090757; Wed, 19 Jun 2019 15:36:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201906191536.x5JFa2EO090757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 19 Jun 2019 15:36:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349195 - in head/sys: geom geom/concat geom/eli geom/journal geom/mirror geom/multipath geom/part geom/raid geom/raid3 geom/stripe kern X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys: geom geom/concat geom/eli geom/journal geom/mirror geom/multipath geom/part geom/raid geom/raid3 geom/stripe kern X-SVN-Commit-Revision: 349195 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1D3BC6B43B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.99 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.99)[-0.989,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Jun 2019 15:36:06 -0000 Author: mav Date: Wed Jun 19 15:36:02 2019 New Revision: 349195 URL: https://svnweb.freebsd.org/changeset/base/349195 Log: Use sbuf_cat() in GEOM confxml generation. When it comes to megabytes of text, difference between sbuf_printf() and sbuf_cat() becomes substantial. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/geom/concat/g_concat.c head/sys/geom/eli/g_eli.c head/sys/geom/geom_disk.c head/sys/geom/geom_dump.c head/sys/geom/geom_int.h head/sys/geom/journal/g_journal.c head/sys/geom/mirror/g_mirror.c head/sys/geom/multipath/g_multipath.c head/sys/geom/part/g_part_apm.c head/sys/geom/part/g_part_bsd64.c head/sys/geom/part/g_part_gpt.c head/sys/geom/part/g_part_mbr.c head/sys/geom/raid/g_raid.c head/sys/geom/raid3/g_raid3.c head/sys/geom/stripe/g_stripe.c head/sys/kern/kern_uuid.c Modified: head/sys/geom/concat/g_concat.c ============================================================================== --- head/sys/geom/concat/g_concat.c Wed Jun 19 15:26:52 2019 (r349194) +++ head/sys/geom/concat/g_concat.c Wed Jun 19 15:36:02 2019 (r349195) @@ -1004,24 +1004,24 @@ g_concat_dumpconf(struct sbuf *sb, const char *indent, sbuf_printf(sb, "%s", indent); switch (sc->sc_type) { case G_CONCAT_TYPE_AUTOMATIC: - sbuf_printf(sb, "AUTOMATIC"); + sbuf_cat(sb, "AUTOMATIC"); break; case G_CONCAT_TYPE_MANUAL: - sbuf_printf(sb, "MANUAL"); + sbuf_cat(sb, "MANUAL"); break; default: - sbuf_printf(sb, "UNKNOWN"); + sbuf_cat(sb, "UNKNOWN"); break; } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%sTotal=%u, Online=%u\n", indent, sc->sc_ndisks, g_concat_nvalid(sc)); sbuf_printf(sb, "%s", indent); if (sc->sc_provider != NULL && sc->sc_provider->error == 0) - sbuf_printf(sb, "UP"); + sbuf_cat(sb, "UP"); else - sbuf_printf(sb, "DOWN"); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "DOWN"); + sbuf_cat(sb, "\n"); } } Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Wed Jun 19 15:26:52 2019 (r349194) +++ head/sys/geom/eli/g_eli.c Wed Jun 19 15:36:02 2019 (r349195) @@ -1328,17 +1328,17 @@ g_eli_dumpconf(struct sbuf *sb, const char *indent, st (uintmax_t)sc->sc_ekeys_allocated); sbuf_printf(sb, "%s", indent); if (sc->sc_flags == 0) - sbuf_printf(sb, "NONE"); + sbuf_cat(sb, "NONE"); else { int first = 1; #define ADD_FLAG(flag, name) do { \ if (sc->sc_flags & (flag)) { \ if (!first) \ - sbuf_printf(sb, ", "); \ + sbuf_cat(sb, ", "); \ else \ first = 0; \ - sbuf_printf(sb, name); \ + sbuf_cat(sb, name); \ } \ } while (0) ADD_FLAG(G_ELI_FLAG_SUSPEND, "SUSPEND"); @@ -1358,7 +1358,7 @@ g_eli_dumpconf(struct sbuf *sb, const char *indent, st ADD_FLAG(G_ELI_FLAG_AUTORESIZE, "AUTORESIZE"); #undef ADD_FLAG } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); if (!(sc->sc_flags & G_ELI_FLAG_ONETIME)) { sbuf_printf(sb, "%s%u\n", indent, @@ -1368,16 +1368,16 @@ g_eli_dumpconf(struct sbuf *sb, const char *indent, st sbuf_printf(sb, "%s", indent); switch (sc->sc_crypto) { case G_ELI_CRYPTO_HW: - sbuf_printf(sb, "hardware"); + sbuf_cat(sb, "hardware"); break; case G_ELI_CRYPTO_SW: - sbuf_printf(sb, "software"); + sbuf_cat(sb, "software"); break; default: - sbuf_printf(sb, "UNKNOWN"); + sbuf_cat(sb, "UNKNOWN"); break; } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); if (sc->sc_flags & G_ELI_FLAG_AUTH) { sbuf_printf(sb, "%s%s\n", Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Wed Jun 19 15:26:52 2019 (r349194) +++ head/sys/geom/geom_disk.c Wed Jun 19 15:36:02 2019 (r349195) @@ -599,15 +599,15 @@ g_disk_dumpconf(struct sbuf *sb, const char *indent, s */ sbuf_printf(sb, "%s", indent); if (dp->d_rotation_rate == DISK_RR_UNKNOWN) /* Old drives */ - sbuf_printf(sb, "unknown"); /* don't report RPM. */ + sbuf_cat(sb, "unknown"); /* don't report RPM. */ else if (dp->d_rotation_rate == DISK_RR_NON_ROTATING) - sbuf_printf(sb, "0"); + sbuf_cat(sb, "0"); else if ((dp->d_rotation_rate >= DISK_RR_MIN) && (dp->d_rotation_rate <= DISK_RR_MAX)) sbuf_printf(sb, "%u", dp->d_rotation_rate); else - sbuf_printf(sb, "invalid"); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "invalid"); + sbuf_cat(sb, "\n"); if (dp->d_getattr != NULL) { buf = g_malloc(DISK_IDENT_SIZE, M_WAITOK); bp = g_alloc_bio(); @@ -617,35 +617,34 @@ g_disk_dumpconf(struct sbuf *sb, const char *indent, s bp->bio_data = buf; res = dp->d_getattr(bp); sbuf_printf(sb, "%s", indent); - g_conf_printf_escaped(sb, "%s", - res == 0 ? buf: dp->d_ident); - sbuf_printf(sb, "\n"); + g_conf_cat_escaped(sb, res == 0 ? buf : dp->d_ident); + sbuf_cat(sb, "\n"); bp->bio_attribute = "GEOM::lunid"; bp->bio_length = DISK_IDENT_SIZE; bp->bio_data = buf; if (dp->d_getattr(bp) == 0) { sbuf_printf(sb, "%s", indent); - g_conf_printf_escaped(sb, "%s", buf); - sbuf_printf(sb, "\n"); + g_conf_cat_escaped(sb, buf); + sbuf_cat(sb, "\n"); } bp->bio_attribute = "GEOM::lunname"; bp->bio_length = DISK_IDENT_SIZE; bp->bio_data = buf; if (dp->d_getattr(bp) == 0) { sbuf_printf(sb, "%s", indent); - g_conf_printf_escaped(sb, "%s", buf); - sbuf_printf(sb, "\n"); + g_conf_cat_escaped(sb, buf); + sbuf_cat(sb, "\n"); } g_destroy_bio(bp); g_free(buf); } else { sbuf_printf(sb, "%s", indent); - g_conf_printf_escaped(sb, "%s", dp->d_ident); - sbuf_printf(sb, "\n"); + g_conf_cat_escaped(sb, dp->d_ident); + sbuf_cat(sb, "\n"); } sbuf_printf(sb, "%s", indent); - g_conf_printf_escaped(sb, "%s", dp->d_descr); - sbuf_printf(sb, "\n"); + g_conf_cat_escaped(sb, dp->d_descr); + sbuf_cat(sb, "\n"); } } Modified: head/sys/geom/geom_dump.c ============================================================================== --- head/sys/geom/geom_dump.c Wed Jun 19 15:26:52 2019 (r349194) +++ head/sys/geom/geom_dump.c Wed Jun 19 15:36:02 2019 (r349195) @@ -105,10 +105,10 @@ g_confdot(void *p, int flag ) KASSERT(flag != EV_CANCEL, ("g_confdot was cancelled")); sb = p; g_topology_assert(); - sbuf_printf(sb, "digraph geom {\n"); + sbuf_cat(sb, "digraph geom {\n"); LIST_FOREACH(mp, &g_classes, class) g_confdot_class(sb, mp); - sbuf_printf(sb, "}\n"); + sbuf_cat(sb, "}\n"); sbuf_finish(sb); } @@ -125,7 +125,7 @@ g_conftxt_geom(struct sbuf *sb, struct g_geom *gp, int pp->name, (uintmax_t)pp->mediasize, pp->sectorsize); if (gp->dumpconf != NULL) gp->dumpconf(sb, NULL, gp, NULL, pp); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); LIST_FOREACH(cp, &pp->consumers, consumers) g_conftxt_geom(sb, cp->geom, level + 1); } @@ -156,12 +156,26 @@ g_conftxt(void *p, int flag) sbuf_finish(sb); } +void +g_conf_cat_escaped(struct sbuf *sb, const char *buf) +{ + const u_char *c; + for (c = buf; *c != '\0'; c++) { + if (*c == '&' || *c == '<' || *c == '>' || + *c == '\'' || *c == '"' || *c > 0x7e) + sbuf_printf(sb, "&#x%X;", *c); + else if (*c == '\t' || *c == '\n' || *c == '\r' || *c > 0x1f) + sbuf_putc(sb, *c); + else + sbuf_putc(sb, '?'); + } +} + void g_conf_printf_escaped(struct sbuf *sb, const char *fmt, ...) { struct sbuf *s; - const u_char *c; va_list ap; s = sbuf_new_auto(); @@ -170,15 +184,7 @@ g_conf_printf_escaped(struct sbuf *sb, const char *fmt va_end(ap); sbuf_finish(s); - for (c = sbuf_data(s); *c != '\0'; c++) { - if (*c == '&' || *c == '<' || *c == '>' || - *c == '\'' || *c == '"' || *c > 0x7e) - sbuf_printf(sb, "&#x%X;", *c); - else if (*c == '\t' || *c == '\n' || *c == '\r' || *c > 0x1f) - sbuf_putc(sb, *c); - else - sbuf_putc(sb, '?'); - } + g_conf_cat_escaped(sb, sbuf_data(s)); sbuf_delete(s); } @@ -195,11 +201,11 @@ g_conf_consumer(struct sbuf *sb, struct g_consumer *cp if (cp->geom->flags & G_GEOM_WITHER) ; else if (cp->geom->dumpconf != NULL) { - sbuf_printf(sb, "\t \n"); + sbuf_cat(sb, "\t \n"); cp->geom->dumpconf(sb, "\t ", cp->geom, cp, NULL); - sbuf_printf(sb, "\t \n"); + sbuf_cat(sb, "\t \n"); } - sbuf_printf(sb, "\t\n"); + sbuf_cat(sb, "\t\n"); } static void @@ -210,24 +216,24 @@ g_conf_provider(struct sbuf *sb, struct g_provider *pp sbuf_printf(sb, "\t \n", pp->geom); sbuf_printf(sb, "\t r%dw%de%d\n", pp->acr, pp->acw, pp->ace); - sbuf_printf(sb, "\t "); - g_conf_printf_escaped(sb, "%s", pp->name); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\t "); + g_conf_cat_escaped(sb, pp->name); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "\t %jd\n", (intmax_t)pp->mediasize); sbuf_printf(sb, "\t %u\n", pp->sectorsize); sbuf_printf(sb, "\t %ju\n", (uintmax_t)pp->stripesize); sbuf_printf(sb, "\t %ju\n", (uintmax_t)pp->stripeoffset); if (pp->flags & G_PF_WITHER) - sbuf_printf(sb, "\t \n"); + sbuf_cat(sb, "\t \n"); else if (pp->geom->flags & G_GEOM_WITHER) ; else if (pp->geom->dumpconf != NULL) { - sbuf_printf(sb, "\t \n"); + sbuf_cat(sb, "\t \n"); pp->geom->dumpconf(sb, "\t ", pp->geom, NULL, pp); - sbuf_printf(sb, "\t \n"); + sbuf_cat(sb, "\t \n"); } - sbuf_printf(sb, "\t\n"); + sbuf_cat(sb, "\t\n"); } @@ -240,16 +246,16 @@ g_conf_geom(struct sbuf *sb, struct g_geom *gp, struct sbuf_printf(sb, " \n", gp); sbuf_printf(sb, " \n", gp->class); - sbuf_printf(sb, " "); - g_conf_printf_escaped(sb, "%s", gp->name); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, " "); + g_conf_cat_escaped(sb, gp->name); + sbuf_cat(sb, "\n"); sbuf_printf(sb, " %d\n", gp->rank); if (gp->flags & G_GEOM_WITHER) - sbuf_printf(sb, " \n"); + sbuf_cat(sb, " \n"); else if (gp->dumpconf != NULL) { - sbuf_printf(sb, " \n"); + sbuf_cat(sb, " \n"); gp->dumpconf(sb, "\t", gp, NULL, NULL); - sbuf_printf(sb, " \n"); + sbuf_cat(sb, " \n"); } LIST_FOREACH(cp2, &gp->consumer, consumer) { if (cp != NULL && cp != cp2) @@ -263,11 +269,11 @@ g_conf_geom(struct sbuf *sb, struct g_geom *gp, struct g_conf_provider(sb, pp2); } LIST_FOREACH(gap, &gp->aliases, ga_next) { - sbuf_printf(sb, " \n"); - g_conf_printf_escaped(sb, "%s", gap->ga_alias); - sbuf_printf(sb, " \n"); + sbuf_cat(sb, " \n"); + g_conf_cat_escaped(sb, gap->ga_alias); + sbuf_cat(sb, " \n"); } - sbuf_printf(sb, " \n"); + sbuf_cat(sb, " \n"); } static void @@ -276,15 +282,15 @@ g_conf_class(struct sbuf *sb, struct g_class *mp, stru struct g_geom *gp2; sbuf_printf(sb, " \n", mp); - sbuf_printf(sb, " "); - g_conf_printf_escaped(sb, "%s", mp->name); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, " "); + g_conf_cat_escaped(sb, mp->name); + sbuf_cat(sb, "\n"); LIST_FOREACH(gp2, &mp->geom, geom) { if (gp != NULL && gp != gp2) continue; g_conf_geom(sb, gp2, pp, cp); } - sbuf_printf(sb, " \n"); + sbuf_cat(sb, " \n"); } void @@ -293,13 +299,13 @@ g_conf_specific(struct sbuf *sb, struct g_class *mp, s struct g_class *mp2; g_topology_assert(); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); LIST_FOREACH(mp2, &g_classes, class) { if (mp != NULL && mp != mp2) continue; g_conf_class(sb, mp2, gp, pp, cp); } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_finish(sb); } Modified: head/sys/geom/geom_int.h ============================================================================== --- head/sys/geom/geom_int.h Wed Jun 19 15:26:52 2019 (r349194) +++ head/sys/geom/geom_int.h Wed Jun 19 15:36:02 2019 (r349195) @@ -59,6 +59,7 @@ extern int g_debugflags; /* geom_dump.c */ void g_confxml(void *, int flag); void g_conf_specific(struct sbuf *sb, struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp); +void g_conf_cat_escaped(struct sbuf *sb, const char *buf); void g_conf_printf_escaped(struct sbuf *sb, const char *fmt, ...); void g_confdot(void *, int flag); void g_conftxt(void *, int flag); Modified: head/sys/geom/journal/g_journal.c ============================================================================== --- head/sys/geom/journal/g_journal.c Wed Jun 19 15:26:52 2019 (r349194) +++ head/sys/geom/journal/g_journal.c Wed Jun 19 15:36:02 2019 (r349195) @@ -2623,15 +2623,15 @@ g_journal_dumpconf(struct sbuf *sb, const char *indent sbuf_printf(sb, "%s", indent); if (cp == sc->sc_dconsumer) { - sbuf_printf(sb, "Data"); + sbuf_cat(sb, "Data"); first = 0; } if (cp == sc->sc_jconsumer) { if (!first) - sbuf_printf(sb, ","); - sbuf_printf(sb, "Journal"); + sbuf_cat(sb, ","); + sbuf_cat(sb, "Journal"); } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); if (cp == sc->sc_jconsumer) { sbuf_printf(sb, "%jd\n", (intmax_t)sc->sc_jstart); Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Wed Jun 19 15:26:52 2019 (r349194) +++ head/sys/geom/mirror/g_mirror.c Wed Jun 19 15:36:02 2019 (r349195) @@ -3373,12 +3373,12 @@ g_mirror_dumpconf(struct sbuf *sb, const char *indent, if (disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING) { sbuf_printf(sb, "%s", indent); if (disk->d_sync.ds_offset == 0) - sbuf_printf(sb, "0%%"); + sbuf_cat(sb, "0%"); else sbuf_printf(sb, "%u%%", (u_int)((disk->d_sync.ds_offset * 100) / sc->sc_mediasize)); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); if (disk->d_sync.ds_offset > 0) sbuf_printf(sb, "%s%jd" "\n", indent, @@ -3390,17 +3390,17 @@ g_mirror_dumpconf(struct sbuf *sb, const char *indent, disk->d_genid); sbuf_printf(sb, "%s", indent); if (disk->d_flags == 0) - sbuf_printf(sb, "NONE"); + sbuf_cat(sb, "NONE"); else { int first = 1; #define ADD_FLAG(flag, name) do { \ if ((disk->d_flags & (flag)) != 0) { \ if (!first) \ - sbuf_printf(sb, ", "); \ + sbuf_cat(sb, ", "); \ else \ first = 0; \ - sbuf_printf(sb, name); \ + sbuf_cat(sb, name); \ } \ } while (0) ADD_FLAG(G_MIRROR_DISK_FLAG_DIRTY, "DIRTY"); @@ -3412,7 +3412,7 @@ g_mirror_dumpconf(struct sbuf *sb, const char *indent, ADD_FLAG(G_MIRROR_DISK_FLAG_BROKEN, "BROKEN"); #undef ADD_FLAG } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s%u\n", indent, disk->d_priority); sbuf_printf(sb, "%s%s\n", indent, @@ -3421,39 +3421,39 @@ g_mirror_dumpconf(struct sbuf *sb, const char *indent, sbuf_printf(sb, "%s", indent); switch (sc->sc_type) { case G_MIRROR_TYPE_AUTOMATIC: - sbuf_printf(sb, "AUTOMATIC"); + sbuf_cat(sb, "AUTOMATIC"); break; case G_MIRROR_TYPE_MANUAL: - sbuf_printf(sb, "MANUAL"); + sbuf_cat(sb, "MANUAL"); break; default: - sbuf_printf(sb, "UNKNOWN"); + sbuf_cat(sb, "UNKNOWN"); break; } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s%u\n", indent, (u_int)sc->sc_id); sbuf_printf(sb, "%s%u\n", indent, sc->sc_syncid); sbuf_printf(sb, "%s%u\n", indent, sc->sc_genid); sbuf_printf(sb, "%s", indent); if (sc->sc_flags == 0) - sbuf_printf(sb, "NONE"); + sbuf_cat(sb, "NONE"); else { int first = 1; #define ADD_FLAG(flag, name) do { \ if ((sc->sc_flags & (flag)) != 0) { \ if (!first) \ - sbuf_printf(sb, ", "); \ + sbuf_cat(sb, ", "); \ else \ first = 0; \ - sbuf_printf(sb, name); \ + sbuf_cat(sb, name); \ } \ } while (0) ADD_FLAG(G_MIRROR_DEVICE_FLAG_NOFAILSYNC, "NOFAILSYNC"); ADD_FLAG(G_MIRROR_DEVICE_FLAG_NOAUTOSYNC, "NOAUTOSYNC"); #undef ADD_FLAG } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s%u\n", indent, (u_int)sc->sc_slice); sbuf_printf(sb, "%s%s\n", indent, @@ -3468,7 +3468,7 @@ g_mirror_dumpconf(struct sbuf *sb, const char *indent, sbuf_printf(sb, "%s", "COMPLETE"); else sbuf_printf(sb, "%s", "DEGRADED"); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); } } Modified: head/sys/geom/multipath/g_multipath.c ============================================================================== --- head/sys/geom/multipath/g_multipath.c Wed Jun 19 15:26:52 2019 (r349194) +++ head/sys/geom/multipath/g_multipath.c Wed Jun 19 15:36:02 2019 (r349195) @@ -1450,7 +1450,7 @@ g_multipath_ctl_getactive(struct gctl_req *req, struct } else if (sc->sc_active && sc->sc_active->provider) { sbuf_printf(sb, "%s\n", sc->sc_active->provider->name); } else { - sbuf_printf(sb, "none\n"); + sbuf_cat(sb, "none\n"); } sbuf_finish(sb); gctl_set_param_err(req, "output", sbuf_data(sb), sbuf_len(sb) + 1); Modified: head/sys/geom/part/g_part_apm.c ============================================================================== --- head/sys/geom/part/g_part_apm.c Wed Jun 19 15:26:52 2019 (r349194) +++ head/sys/geom/part/g_part_apm.c Wed Jun 19 15:36:02 2019 (r349195) @@ -310,13 +310,13 @@ g_part_apm_dumpconf(struct g_part_table *table, struct strncpy(u.name, entry->ent.ent_name, APM_ENT_NAMELEN); u.name[APM_ENT_NAMELEN] = '\0'; sbuf_printf(sb, "%s\n"); + g_conf_cat_escaped(sb, u.name); + sbuf_cat(sb, "\n"); strncpy(u.type, entry->ent.ent_type, APM_ENT_TYPELEN); u.type[APM_ENT_TYPELEN] = '\0'; sbuf_printf(sb, "%s", indent); - g_conf_printf_escaped(sb, "%s", u.type); - sbuf_printf(sb, "\n"); + g_conf_cat_escaped(sb, u.type); + sbuf_cat(sb, "\n"); } else { /* confxml: scheme information */ } Modified: head/sys/geom/part/g_part_bsd64.c ============================================================================== --- head/sys/geom/part/g_part_bsd64.c Wed Jun 19 15:26:52 2019 (r349194) +++ head/sys/geom/part/g_part_bsd64.c Wed Jun 19 15:36:02 2019 (r349195) @@ -386,11 +386,11 @@ g_part_bsd64_dumpconf(struct g_part_table *basetable, if (!EQUUID(&bsd64_uuid_unused, &entry->type_uuid)) { sbuf_printf(sb, "%s", indent); sbuf_printf_uuid(sb, &entry->type_uuid); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); } sbuf_printf(sb, "%s", indent); sbuf_printf_uuid(sb, &entry->stor_uuid); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); } else { /* confxml: scheme information */ table = (struct g_part_bsd64_table *)basetable; @@ -401,12 +401,12 @@ g_part_bsd64_dumpconf(struct g_part_table *basetable, indent, (uintmax_t)table->d_abase); sbuf_printf(sb, "%s", indent); sbuf_printf_uuid(sb, &table->d_stor_uuid); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s\n"); + g_conf_cat_escaped(sb, buf); + sbuf_cat(sb, "\n"); } } Modified: head/sys/geom/part/g_part_gpt.c ============================================================================== --- head/sys/geom/part/g_part_gpt.c Wed Jun 19 15:26:52 2019 (r349194) +++ head/sys/geom/part/g_part_gpt.c Wed Jun 19 15:36:02 2019 (r349195) @@ -713,14 +713,14 @@ g_part_gpt_dumpconf(struct g_part_table *table, struct entry = (struct g_part_gpt_entry *)baseentry; if (indent == NULL) { /* conftxt: libdisk compatibility */ - sbuf_printf(sb, " xs GPT xt "); + sbuf_cat(sb, " xs GPT xt "); sbuf_printf_uuid(sb, &entry->ent.ent_type); } else if (entry != NULL) { /* confxml: partition entry information */ sbuf_printf(sb, "%s\n"); + sbuf_cat(sb, "\n"); if (entry->ent.ent_attr & GPT_ENT_ATTR_BOOTME) sbuf_printf(sb, "%sbootme\n", indent); if (entry->ent.ent_attr & GPT_ENT_ATTR_BOOTONCE) { @@ -733,16 +733,16 @@ g_part_gpt_dumpconf(struct g_part_table *table, struct } sbuf_printf(sb, "%s", indent); sbuf_printf_uuid(sb, &entry->ent.ent_type); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s", indent); sbuf_printf_uuid(sb, &entry->ent.ent_uuid); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s", indent); sbuf_printf(sb, "HD(%d,GPT,", entry->base.gpe_index); sbuf_printf_uuid(sb, &entry->ent.ent_uuid); sbuf_printf(sb, ",%#jx,%#jx)", (intmax_t)entry->base.gpe_start, (intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 1)); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); } else { /* confxml: scheme information */ } Modified: head/sys/geom/part/g_part_mbr.c ============================================================================== --- head/sys/geom/part/g_part_mbr.c Wed Jun 19 15:26:52 2019 (r349194) +++ head/sys/geom/part/g_part_mbr.c Wed Jun 19 15:36:02 2019 (r349195) @@ -330,7 +330,7 @@ g_part_mbr_dumpconf(struct g_part_table *basetable, st sbuf_printf(sb, "%sHD(%d,MBR,%#08x,%#jx,%#jx)", indent, entry->base.gpe_index, dsn, (intmax_t)entry->base.gpe_start, (intmax_t)(entry->base.gpe_end - entry->base.gpe_start + 1)); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); } else { /* confxml: scheme information */ } Modified: head/sys/geom/raid/g_raid.c ============================================================================== --- head/sys/geom/raid/g_raid.c Wed Jun 19 15:26:52 2019 (r349194) +++ head/sys/geom/raid/g_raid.c Wed Jun 19 15:36:02 2019 (r349195) @@ -2372,7 +2372,7 @@ g_raid_dumpconf(struct sbuf *sb, const char *indent, s sbuf_printf(sb, "%s ", g_raid_get_diskname(sd->sd_disk)); } else { - sbuf_printf(sb, "NONE "); + sbuf_cat(sb, "NONE "); } sbuf_printf(sb, "(%s", g_raid_subdisk_state2str(sd->sd_state)); @@ -2382,11 +2382,11 @@ g_raid_dumpconf(struct sbuf *sb, const char *indent, s (int)(sd->sd_rebuild_pos * 100 / sd->sd_size)); } - sbuf_printf(sb, ")"); + sbuf_cat(sb, ")"); if (i + 1 < vol->v_disks_count) - sbuf_printf(sb, ", "); + sbuf_cat(sb, ", "); } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sx_xunlock(&sc->sc_lock); g_topology_lock(); } else if (cp != NULL) { @@ -2398,7 +2398,7 @@ g_raid_dumpconf(struct sbuf *sb, const char *indent, s sbuf_printf(sb, "%s%s", indent, g_raid_disk_state2str(disk->d_state)); if (!TAILQ_EMPTY(&disk->d_subdisks)) { - sbuf_printf(sb, " ("); + sbuf_cat(sb, " ("); TAILQ_FOREACH(sd, &disk->d_subdisks, sd_next) { sbuf_printf(sb, "%s", g_raid_subdisk_state2str(sd->sd_state)); @@ -2409,11 +2409,11 @@ g_raid_dumpconf(struct sbuf *sb, const char *indent, s sd->sd_size)); } if (TAILQ_NEXT(sd, sd_next)) - sbuf_printf(sb, ", "); + sbuf_cat(sb, ", "); } - sbuf_printf(sb, ")"); + sbuf_cat(sb, ")"); } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s", indent); TAILQ_FOREACH(sd, &disk->d_subdisks, sd_next) { sbuf_printf(sb, "r%d(%s):%d@%ju", @@ -2421,9 +2421,9 @@ g_raid_dumpconf(struct sbuf *sb, const char *indent, s sd->sd_volume->v_name, sd->sd_pos, (uintmax_t)sd->sd_offset); if (TAILQ_NEXT(sd, sd_next)) - sbuf_printf(sb, ", "); + sbuf_cat(sb, ", "); } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s%d\n", indent, disk->d_read_errs); sx_xunlock(&sc->sc_lock); Modified: head/sys/geom/raid3/g_raid3.c ============================================================================== --- head/sys/geom/raid3/g_raid3.c Wed Jun 19 15:26:52 2019 (r349194) +++ head/sys/geom/raid3/g_raid3.c Wed Jun 19 15:36:02 2019 (r349195) @@ -3424,22 +3424,22 @@ g_raid3_dumpconf(struct sbuf *sb, const char *indent, sx_xlock(&sc->sc_lock); sbuf_printf(sb, "%s", indent); if (disk->d_no == sc->sc_ndisks - 1) - sbuf_printf(sb, "PARITY"); + sbuf_cat(sb, "PARITY"); else - sbuf_printf(sb, "DATA"); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "DATA"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s%u\n", indent, (u_int)disk->d_no); if (disk->d_state == G_RAID3_DISK_STATE_SYNCHRONIZING) { sbuf_printf(sb, "%s", indent); if (disk->d_sync.ds_offset == 0) - sbuf_printf(sb, "0%%"); + sbuf_cat(sb, "0%"); else { sbuf_printf(sb, "%u%%", (u_int)((disk->d_sync.ds_offset * 100) / (sc->sc_mediasize / (sc->sc_ndisks - 1)))); } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); if (disk->d_sync.ds_offset > 0) { sbuf_printf(sb, "%s%jd" "\n", indent, @@ -3451,17 +3451,17 @@ g_raid3_dumpconf(struct sbuf *sb, const char *indent, sbuf_printf(sb, "%s%u\n", indent, disk->d_genid); sbuf_printf(sb, "%s", indent); if (disk->d_flags == 0) - sbuf_printf(sb, "NONE"); + sbuf_cat(sb, "NONE"); else { int first = 1; #define ADD_FLAG(flag, name) do { \ if ((disk->d_flags & (flag)) != 0) { \ if (!first) \ - sbuf_printf(sb, ", "); \ + sbuf_cat(sb, ", "); \ else \ first = 0; \ - sbuf_printf(sb, name); \ + sbuf_cat(sb, name); \ } \ } while (0) ADD_FLAG(G_RAID3_DISK_FLAG_DIRTY, "DIRTY"); @@ -3472,7 +3472,7 @@ g_raid3_dumpconf(struct sbuf *sb, const char *indent, ADD_FLAG(G_RAID3_DISK_FLAG_BROKEN, "BROKEN"); #undef ADD_FLAG } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s%s\n", indent, g_raid3_disk_state2str(disk->d_state)); sx_xunlock(&sc->sc_lock); @@ -3505,17 +3505,17 @@ g_raid3_dumpconf(struct sbuf *sb, const char *indent, sbuf_printf(sb, "%s%u\n", indent, sc->sc_genid); sbuf_printf(sb, "%s", indent); if (sc->sc_flags == 0) - sbuf_printf(sb, "NONE"); + sbuf_cat(sb, "NONE"); else { int first = 1; #define ADD_FLAG(flag, name) do { \ if ((sc->sc_flags & (flag)) != 0) { \ if (!first) \ - sbuf_printf(sb, ", "); \ + sbuf_cat(sb, ", "); \ else \ first = 0; \ - sbuf_printf(sb, name); \ + sbuf_cat(sb, name); \ } \ } while (0) ADD_FLAG(G_RAID3_DEVICE_FLAG_NOFAILSYNC, "NOFAILSYNC"); @@ -3525,7 +3525,7 @@ g_raid3_dumpconf(struct sbuf *sb, const char *indent, ADD_FLAG(G_RAID3_DEVICE_FLAG_VERIFY, "VERIFY"); #undef ADD_FLAG } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%s%u\n", indent, sc->sc_ndisks); sbuf_printf(sb, "%s%s\n", indent, Modified: head/sys/geom/stripe/g_stripe.c ============================================================================== --- head/sys/geom/stripe/g_stripe.c Wed Jun 19 15:26:52 2019 (r349194) +++ head/sys/geom/stripe/g_stripe.c Wed Jun 19 15:36:02 2019 (r349195) @@ -1249,24 +1249,24 @@ g_stripe_dumpconf(struct sbuf *sb, const char *indent, sbuf_printf(sb, "%s", indent); switch (sc->sc_type) { case G_STRIPE_TYPE_AUTOMATIC: - sbuf_printf(sb, "AUTOMATIC"); + sbuf_cat(sb, "AUTOMATIC"); break; case G_STRIPE_TYPE_MANUAL: - sbuf_printf(sb, "MANUAL"); + sbuf_cat(sb, "MANUAL"); break; default: - sbuf_printf(sb, "UNKNOWN"); + sbuf_cat(sb, "UNKNOWN"); break; } - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "\n"); sbuf_printf(sb, "%sTotal=%u, Online=%u\n", indent, sc->sc_ndisks, g_stripe_nvalid(sc)); sbuf_printf(sb, "%s", indent); if (sc->sc_provider != NULL && sc->sc_provider->error == 0) - sbuf_printf(sb, "UP"); + sbuf_cat(sb, "UP"); else - sbuf_printf(sb, "DOWN"); - sbuf_printf(sb, "\n"); + sbuf_cat(sb, "DOWN"); + sbuf_cat(sb, "\n"); } } Modified: head/sys/kern/kern_uuid.c ============================================================================== --- head/sys/kern/kern_uuid.c Wed Jun 19 15:26:52 2019 (r349194) +++ head/sys/kern/kern_uuid.c Wed Jun 19 15:36:02 2019 (r349195) @@ -297,7 +297,7 @@ sbuf_printf_uuid(struct sbuf *sb, struct uuid *uuid) char buf[38]; snprintf_uuid(buf, sizeof(buf), uuid); - return (sbuf_printf(sb, "%s", buf)); + return (sbuf_cat(sb, buf)); } /*