Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/cddl/osnet/dist Complete migrating to snprintf_blkptr
details: https://anonhg.NetBSD.org/src/rev/21abbef6765c
branches: trunk
changeset: 328149:21abbef6765c
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Fri Mar 28 03:46:56 2014 +0000
description:
Complete migrating to snprintf_blkptr
diffstat:
external/cddl/osnet/dist/cmd/zdb/zdb_il.c | 5 +++--
external/cddl/osnet/dist/uts/common/fs/zfs/spa_misc.c | 4 ++--
external/cddl/osnet/dist/uts/common/fs/zfs/sys/dbuf.h | 2 +-
external/cddl/osnet/dist/uts/common/fs/zfs/sys/spa.h | 6 +++---
4 files changed, 9 insertions(+), 8 deletions(-)
diffs (79 lines):
diff -r 6769c27c146d -r 21abbef6765c external/cddl/osnet/dist/cmd/zdb/zdb_il.c
--- a/external/cddl/osnet/dist/cmd/zdb/zdb_il.c Fri Mar 28 03:18:24 2014 +0000
+++ b/external/cddl/osnet/dist/cmd/zdb/zdb_il.c Fri Mar 28 03:46:56 2014 +0000
@@ -47,7 +47,7 @@
{
char blkbuf[BP_SPRINTF_LEN];
- sprintf_blkptr(blkbuf, bp);
+ snprintf_blkptr(blkbuf, sizeof(blkbuf), bp);
(void) printf("%s%s\n", prefix, blkbuf);
}
@@ -313,7 +313,8 @@
if (verbose >= 5) {
(void) strcpy(blkbuf, ", ");
- sprintf_blkptr(blkbuf + strlen(blkbuf), bp);
+ snprintf_blkptr(blkbuf + strlen(blkbuf),
+ sizeof(blkbuf) - strlen(blkbuf), bp);
} else {
blkbuf[0] = '\0';
}
diff -r 6769c27c146d -r 21abbef6765c external/cddl/osnet/dist/uts/common/fs/zfs/spa_misc.c
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/spa_misc.c Fri Mar 28 03:18:24 2014 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/spa_misc.c Fri Mar 28 03:46:56 2014 +0000
@@ -1136,13 +1136,13 @@
}
void
-sprintf_blkptr(char *buf, const blkptr_t *bp)
+snprintf_blkptr(char *buf, size_t buflen, const blkptr_t *bp)
{
char *type = dmu_ot[BP_GET_TYPE(bp)].ot_name;
char *checksum = zio_checksum_table[BP_GET_CHECKSUM(bp)].ci_name;
char *compress = zio_compress_table[BP_GET_COMPRESS(bp)].ci_name;
- SPRINTF_BLKPTR(snprintf, ' ', buf, bp, type, checksum, compress);
+ SNPRINTF_BLKPTR(snprintf, ' ', buf, buflen, bp, type, checksum, compress);
}
void
diff -r 6769c27c146d -r 21abbef6765c external/cddl/osnet/dist/uts/common/fs/zfs/sys/dbuf.h
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/sys/dbuf.h Fri Mar 28 03:18:24 2014 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/sys/dbuf.h Fri Mar 28 03:46:56 2014 +0000
@@ -326,7 +326,7 @@
#define dprintf_dbuf_bp(db, bp, fmt, ...) do { \
if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
char *__blkbuf = kmem_alloc(BP_SPRINTF_LEN, KM_SLEEP); \
- sprintf_blkptr(__blkbuf, bp); \
+ snprintf_blkptr(__blkbuf, BP_SPRINTF_LEN, bp); \
dprintf_dbuf(db, fmt " %s\n", __VA_ARGS__, __blkbuf); \
kmem_free(__blkbuf, BP_SPRINTF_LEN); \
} \
diff -r 6769c27c146d -r 21abbef6765c external/cddl/osnet/dist/uts/common/fs/zfs/sys/spa.h
--- a/external/cddl/osnet/dist/uts/common/fs/zfs/sys/spa.h Fri Mar 28 03:18:24 2014 +0000
+++ b/external/cddl/osnet/dist/uts/common/fs/zfs/sys/spa.h Fri Mar 28 03:46:56 2014 +0000
@@ -344,11 +344,11 @@
* 'func' is either snprintf() or mdb_snprintf().
* 'ws' (whitespace) can be ' ' for single-line format, '\n' for multi-line.
*/
-#define SPRINTF_BLKPTR(func, ws, buf, bp, type, checksum, compress) \
+#define SNPRINTF_BLKPTR(func, ws, buf, buflen, bp, type, checksum, compress) \
{ \
static const char *copyname[] = \
{ "zero", "single", "double", "triple" }; \
- int size = BP_SPRINTF_LEN; \
+ int size = buflen; \
int len = 0; \
int copies = 0; \
\
@@ -592,7 +592,7 @@
extern void spa_strfree(char *);
extern uint64_t spa_get_random(uint64_t range);
extern uint64_t spa_generate_guid(spa_t *spa);
-extern void snprintf_blkptr(char *buf, const blkptr_t *bp);
+extern void snprintf_blkptr(char *buf, size_t buflen, const blkptr_t *bp);
extern void spa_freeze(spa_t *spa);
extern void spa_upgrade(spa_t *spa, uint64_t version);
extern void spa_evict_all(void);
Home |
Main Index |
Thread Index |
Old Index