diff --git a/sys/geom/concat/g_concat.c b/sys/geom/concat/g_concat.c
index a0a95b85aba0..e686ffc51285 100644
--- a/sys/geom/concat/g_concat.c
+++ b/sys/geom/concat/g_concat.c
@@ -1004,24 +1004,24 @@ g_concat_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
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");
}
}
diff --git a/sys/geom/eli/g_eli.c b/sys/geom/eli/g_eli.c
index ef390f1612a3..938d6a00fd52 100644
--- a/sys/geom/eli/g_eli.c
+++ b/sys/geom/eli/g_eli.c
@@ -1328,17 +1328,17 @@ g_eli_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
(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, struct g_geom *gp,
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, struct g_geom *gp,
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",
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index f9499a41e89a..b13f007553ef 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -599,15 +599,15 @@ g_disk_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g
*/
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, struct g_geom *gp, struct g
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");
}
}
diff --git a/sys/geom/geom_dump.c b/sys/geom/geom_dump.c
index 0a4551c9fbfc..21a6e14b4960 100644
--- a/sys/geom/geom_dump.c
+++ b/sys/geom/geom_dump.c
@@ -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 level)
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,21 +156,12 @@ g_conftxt(void *p, int flag)
sbuf_finish(sb);
}
-
void
-g_conf_printf_escaped(struct sbuf *sb, const char *fmt, ...)
+g_conf_cat_escaped(struct sbuf *sb, const char *buf)
{
- struct sbuf *s;
const u_char *c;
- va_list ap;
- s = sbuf_new_auto();
- va_start(ap, fmt);
- sbuf_vprintf(s, fmt, ap);
- va_end(ap);
- sbuf_finish(s);
-
- for (c = sbuf_data(s); *c != '\0'; c++) {
+ for (c = buf; *c != '\0'; c++) {
if (*c == '&' || *c == '<' || *c == '>' ||
*c == '\'' || *c == '"' || *c > 0x7e)
sbuf_printf(sb, "%X;", *c);
@@ -179,6 +170,21 @@ g_conf_printf_escaped(struct sbuf *sb, const char *fmt, ...)
else
sbuf_putc(sb, '?');
}
+}
+
+void
+g_conf_printf_escaped(struct sbuf *sb, const char *fmt, ...)
+{
+ struct sbuf *s;
+ va_list ap;
+
+ s = sbuf_new_auto();
+ va_start(ap, fmt);
+ sbuf_vprintf(s, fmt, ap);
+ va_end(ap);
+ sbuf_finish(s);
+
+ 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 g_provider *pp, struct g_
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_provider *pp, struct g_
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, struct g_geom *gp, struct g_pr
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, struct g_geom *gp, struct g
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);
}
diff --git a/sys/geom/geom_int.h b/sys/geom/geom_int.h
index e04253cccb8e..1064a31da531 100644
--- a/sys/geom/geom_int.h
+++ b/sys/geom/geom_int.h
@@ -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);
diff --git a/sys/geom/journal/g_journal.c b/sys/geom/journal/g_journal.c
index bdfad253b67c..8ed8b8d69965 100644
--- a/sys/geom/journal/g_journal.c
+++ b/sys/geom/journal/g_journal.c
@@ -2623,15 +2623,15 @@ g_journal_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
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);
diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c
index 5ccb8362e19a..5cc1b4a0c365 100644
--- a/sys/geom/mirror/g_mirror.c
+++ b/sys/geom/mirror/g_mirror.c
@@ -3373,12 +3373,12 @@ g_mirror_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
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, struct g_geom *gp,
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, struct g_geom *gp,
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, struct g_geom *gp,
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, struct g_geom *gp,
sbuf_printf(sb, "%s", "COMPLETE");
else
sbuf_printf(sb, "%s", "DEGRADED");
- sbuf_printf(sb, "\n");
+ sbuf_cat(sb, "\n");
}
}
diff --git a/sys/geom/multipath/g_multipath.c b/sys/geom/multipath/g_multipath.c
index ba2a2d413b23..7dc42bc11561 100644
--- a/sys/geom/multipath/g_multipath.c
+++ b/sys/geom/multipath/g_multipath.c
@@ -1450,7 +1450,7 @@ g_multipath_ctl_getactive(struct gctl_req *req, struct g_class *mp)
} 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);
diff --git a/sys/geom/part/g_part_apm.c b/sys/geom/part/g_part_apm.c
index 250983ef7fe3..92019c7e4f16 100644
--- a/sys/geom/part/g_part_apm.c
+++ b/sys/geom/part/g_part_apm.c
@@ -310,13 +310,13 @@ g_part_apm_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry,
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 */
}
diff --git a/sys/geom/part/g_part_bsd64.c b/sys/geom/part/g_part_bsd64.c
index 6332a38096fd..4f73957ba1b3 100644
--- a/sys/geom/part/g_part_bsd64.c
+++ b/sys/geom/part/g_part_bsd64.c
@@ -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");
}
}
diff --git a/sys/geom/part/g_part_gpt.c b/sys/geom/part/g_part_gpt.c
index dca10c9534cb..f69cd84efab4 100644
--- a/sys/geom/part/g_part_gpt.c
+++ b/sys/geom/part/g_part_gpt.c
@@ -713,14 +713,14 @@ g_part_gpt_dumpconf(struct g_part_table *table, struct g_part_entry *baseentry,
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 g_part_entry *baseentry,
}
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 */
}
diff --git a/sys/geom/part/g_part_mbr.c b/sys/geom/part/g_part_mbr.c
index a442e25c94d0..013b2a934ccc 100644
--- a/sys/geom/part/g_part_mbr.c
+++ b/sys/geom/part/g_part_mbr.c
@@ -330,7 +330,7 @@ g_part_mbr_dumpconf(struct g_part_table *basetable, struct g_part_entry *baseent
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 */
}
diff --git a/sys/geom/raid/g_raid.c b/sys/geom/raid/g_raid.c
index bc8cd153456a..85e237f95b66 100644
--- a/sys/geom/raid/g_raid.c
+++ b/sys/geom/raid/g_raid.c
@@ -2372,7 +2372,7 @@ g_raid_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
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, struct g_geom *gp,
(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, struct g_geom *gp,
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, struct g_geom *gp,
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, struct g_geom *gp,
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);
diff --git a/sys/geom/raid3/g_raid3.c b/sys/geom/raid3/g_raid3.c
index 682272345244..02ec5b45c694 100644
--- a/sys/geom/raid3/g_raid3.c
+++ b/sys/geom/raid3/g_raid3.c
@@ -3424,22 +3424,22 @@ g_raid3_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
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, struct g_geom *gp,
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, struct g_geom *gp,
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, struct g_geom *gp,
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, struct g_geom *gp,
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,
diff --git a/sys/geom/stripe/g_stripe.c b/sys/geom/stripe/g_stripe.c
index 8dc32ee2c9f1..23873f778670 100644
--- a/sys/geom/stripe/g_stripe.c
+++ b/sys/geom/stripe/g_stripe.c
@@ -1249,24 +1249,24 @@ g_stripe_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
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");
}
}
diff --git a/sys/kern/kern_uuid.c b/sys/kern/kern_uuid.c
index 006558e9e50c..ea0877a0cde0 100644
--- a/sys/kern/kern_uuid.c
+++ b/sys/kern/kern_uuid.c
@@ -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));
}
/*