From nobody Sat Jun 01 15:18:14 2024 X-Original-To: dev-commits-src-all@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 4Vs3XR025Hz5N2x1; Sat, 01 Jun 2024 15:18:15 +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 4Vs3XQ6N6zz4LMS; Sat, 1 Jun 2024 15:18:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1717255094; 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=FJhzyeAFfG9VNZQhKhwrefKK1b7d4CR3MusGQBzfXkE=; b=xK6icVv2hjxrSe6QHxjqwFAF/ltQM1AuRix4aBMKwbbGEow2wLynpbFNqhKWtjfmAMsAIN Lso2ozCsCUKUGUDadnLPTdB55d+Q1GxPYAxxThX2pa4On1X8a/c50XYGImKGZRMyvwbr2J n8ptrLcJEA4NwUsPccbiNwB7UAImQRhqjEQITj2HvPTi+fZKrrlLgM4BlZ0vnR0+aKGGB5 YHd44SA3Mje9CXSgAipSnqZIvCIiFWr8H0+R0R3wao5aAgLhFQ/o194uzkTakBs5Cip9Xp hofALNJHJTj4BbP28/uvIIbYC2XZAlO2Cc6LGcwz+9JXkC92m5mPN76COjBgMw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1717255094; a=rsa-sha256; cv=none; b=sLOf1HvYPOwOWBc7MMt8wtBxeBiMczsS1QbDoUxPPFdWJaWO+iQRa4KeIzNr+7Gd8yTMcY hTsgsNI6mdE9tOXbWSCSoVjbkNWcGYo8tye5G6l8xEJ3N7zkDmRcEjlyURNAQEU6lRNalT Y09LFGLLxCbU7/X9SBA91Rva3ONCTrW6wnrcs5ew9am1dfpBGf+5Km7g4ZYYhUt1V36oUX vAZlxdVhjU82Wz9yICjEEKuQ5FUkEXOg43QybT4ADwm4ze86HWTxwH8eHegQReuSleR7kZ qVr2LCG4syneGjK4kbkmx/+jwD1bN+fMuj4C8ugCGzoShEPq5Z65zfQbpSXIZA== 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=1717255094; 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=FJhzyeAFfG9VNZQhKhwrefKK1b7d4CR3MusGQBzfXkE=; b=A/1GEMgLZiDWYxGmQIVhWTArLqJuMnmVOWfUPQ53Fdl/yKSot82iv/oe2SA0yl/KmMbz6z OW8TLveixJubRJA8y4Qfm8mnXa1j44ZY95/0SE/qdRqVjtzGYLXbNrngIdoJqJgylAPyE5 RQvRVvtqS8L5tOcjAsI5BChBIgI0Oa2C9Fs+QSl9qvrdOETOse8kqtGkL/MSJ02Vl3AHVA g6aEdJGQhSZxqwXdww8ksLBHCYZeOjIYe4beAM6bz9zvGgvCw/8F++34Iggzjvuf8yKfI3 nfjiKFa0H20HVjRw92TJb8vpowvTkw8OYrTH2wh9PZwrGntceJBlbz9jhqoqPA== 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 4Vs3XQ5zj9z1CGM; Sat, 1 Jun 2024 15:18:14 +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 451FIEHT063016; Sat, 1 Jun 2024 15:18:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 451FIEeY063013; Sat, 1 Jun 2024 15:18:14 GMT (envelope-from git) Date: Sat, 1 Jun 2024 15:18:14 GMT Message-Id: <202406011518.451FIEeY063013@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: be2f92a96b96 - main - makefs/zfs: Add a helper function for adding ZAP entries List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/main X-Git-Reftype: branch X-Git-Commit: be2f92a96b96149fccb4ec9e9f9c42ee29b455e6 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=be2f92a96b96149fccb4ec9e9f9c42ee29b455e6 commit be2f92a96b96149fccb4ec9e9f9c42ee29b455e6 Author: Mark Johnston AuthorDate: 2024-06-01 15:16:18 +0000 Commit: Mark Johnston CommitDate: 2024-06-01 15:16:18 +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 --- 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 *);