From nobody Sun Jun 09 14:12:17 2024 X-Original-To: dev-commits-src-branches@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 4Vxxhg4DZhz5MCHh; Sun, 09 Jun 2024 14:12:19 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vxxhg1Sklz4DcX; Sun, 9 Jun 2024 14:12:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717942339; 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=h/5/QomqfBWoMbfRJCi60DWrxjcdrd14ub0+uERk/A4=; b=xv9nePyTo0qbbtaCxhSWlagOJOuey/Q+GWXFlmCIfTGC1sp2gu+a2Ktx/1ZqUvls6b+WFK XJQVv6if7c2O7k9fJjvxXZJEvKMEjn1ujPtj0c+DhSpfAnEO9OmmP+a3jh0sb/8jv6UggG pCH3XbmYuVt4qHUi48/a2ezYZpcAfFY+utYopKJBGEBMHA/ulLnRaDcsoyJlsaKJRQhsNo gDmfZOlfCgYSxkKvQEHRymW8We/aZReyHw78CXDhCndAfWSH7icBV47ROuozA8W3CU3dOQ ajOW4ZpVObSaczFNqfPzthHG+65HC4IfjzqbJpfKiDPHiCQ6I0al3rqR+KApFw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717942339; a=rsa-sha256; cv=none; b=wk84Vp9bMphGif+QHQrHO6dNJjPPy0a+ER79Avr6BN3hB3eDS77tMWB4L0Q28dGrK10yGG HbEmdQpQ178aBncTby8ejMm22/x8Wn/jNdc19rLeow4h/tobW8OO2FrCnH9mJJqeX41aO4 nGgpDNEHPeqYgNg30qs5/HUFfub+qiW12xf81WoU97r7jAP6qPGqQlpqZWXhiQoYlttsvu AcDy6n7tOliToehKCQ2dgbP5PWTprND9L3OjKFUW3xI0rXPlwNjHQlVnSbBeXuUKWm8JKO 11G6xM5jWMMMXiojXhlexd0mtPva1dMk6eojpGmRHVOjf9mf2sKgwq/gpsZAaA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717942339; 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=h/5/QomqfBWoMbfRJCi60DWrxjcdrd14ub0+uERk/A4=; b=QBtbUEngcMnGKgG94LqN4fhXWYHA7K1ljHZdckO5GgiNop3QaJl2Cwf4I8MtvQOt2pX+l0 UClKjHnusBur7ZPdOonbioSgH3R+dy6fTXXnh/NAubR3iwDal+yHPKStmQgLo1r1M7Ta5v l8xi+5S51SalXk28/nuVrxy+RFWVIzDM1iK1O7rExU/Fv5sC+JKclUVwhIYqQeL48AmmSX kV2WGOJ9am/Xczqm/DQRwhcpN/iDdz2wxWBUfu7aFNM8ia7i3fsC+mH+137/YzoKnmV/6E Skx00zyWqCUCnExx2jPsAgkBKYXbJW4X69FEPYv5TntqGUmuaSNfc/du2ox9Wg== 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 4Vxxhd1FzMzm36; Sun, 9 Jun 2024 14:12:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 459ECHWn086052; Sun, 9 Jun 2024 14:12:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 459ECH1s086049; Sun, 9 Jun 2024 14:12:17 GMT (envelope-from git) Date: Sun, 9 Jun 2024 14:12:17 GMT Message-Id: <202406091412.459ECH1s086049@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 6e345bea25d4 - stable/14 - makefs/zfs: Add a helper function for adding ZAP entries List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 6e345bea25d476baf6de7fb3b60127d39b464837 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6e345bea25d476baf6de7fb3b60127d39b464837 commit 6e345bea25d476baf6de7fb3b60127d39b464837 Author: Mark Johnston AuthorDate: 2024-06-01 15:16:18 +0000 Commit: Mark Johnston CommitDate: 2024-06-09 13:47:59 +0000 makefs/zfs: Add a helper function for adding ZAP entries Some ZAPs are used to represent sets, in which keys and values are the same. Add a helper function for this case. No functional change intended. MFC after: 1 week (cherry picked from commit be2f92a96b96149fccb4ec9e9f9c42ee29b455e6) --- usr.sbin/makefs/zfs/dsl.c | 4 +--- usr.sbin/makefs/zfs/zap.c | 9 +++++++++ usr.sbin/makefs/zfs/zfs.h | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/usr.sbin/makefs/zfs/dsl.c b/usr.sbin/makefs/zfs/dsl.c index 93083f286e81..f7264b9d2ca7 100644 --- a/usr.sbin/makefs/zfs/dsl.c +++ b/usr.sbin/makefs/zfs/dsl.c @@ -490,7 +490,6 @@ dsl_dir_finalize_props(zfs_dsl_dir_t *dir) static void dsl_dir_finalize(zfs_opt_t *zfs, zfs_dsl_dir_t *dir, void *arg __unused) { - char key[32]; zfs_dsl_dir_t *cdir; dnode_phys_t *snapnames; zfs_dsl_dataset_t *headds; @@ -519,8 +518,7 @@ dsl_dir_finalize(zfs_opt_t *zfs, zfs_dsl_dir_t *dir, void *arg __unused) objset_root_blkptr_copy(os, &headds->phys->ds_bp); zfs->snapds->phys->ds_num_children++; - snprintf(key, sizeof(key), "%jx", (uintmax_t)headds->dsid); - zap_add_uint64(zfs->cloneszap, key, headds->dsid); + zap_add_uint64_self(zfs->cloneszap, headds->dsid); bytes = objset_space(os); headds->phys->ds_used_bytes = bytes; diff --git a/usr.sbin/makefs/zfs/zap.c b/usr.sbin/makefs/zfs/zap.c index 2437ee3bfd1e..d01f7527adf9 100644 --- a/usr.sbin/makefs/zfs/zap.c +++ b/usr.sbin/makefs/zfs/zap.c @@ -166,6 +166,15 @@ zap_add_uint64(zfs_zap_t *zap, const char *name, uint64_t val) zap_add(zap, name, sizeof(uint64_t), 1, (uint8_t *)&val); } +void +zap_add_uint64_self(zfs_zap_t *zap, uint64_t val) +{ + char name[32]; + + snprintf(name, sizeof(name), "%jx", (uintmax_t)val); + zap_add(zap, name, sizeof(uint64_t), 1, (uint8_t *)&val); +} + void zap_add_string(zfs_zap_t *zap, const char *name, const char *val) { diff --git a/usr.sbin/makefs/zfs/zfs.h b/usr.sbin/makefs/zfs/zfs.h index 9af090b14912..ff94c270bbf6 100644 --- a/usr.sbin/makefs/zfs/zfs.h +++ b/usr.sbin/makefs/zfs/zfs.h @@ -159,6 +159,7 @@ void vdev_fini(zfs_opt_t *zfs); zfs_zap_t *zap_alloc(zfs_objset_t *, dnode_phys_t *); void zap_add(zfs_zap_t *, const char *, size_t, size_t, const uint8_t *); void zap_add_uint64(zfs_zap_t *, const char *, uint64_t); +void zap_add_uint64_self(zfs_zap_t *, uint64_t); void zap_add_string(zfs_zap_t *, const char *, const char *); bool zap_entry_exists(zfs_zap_t *, const char *); void zap_write(zfs_opt_t *, zfs_zap_t *);