From patchwork Mon May 13 08:18:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13663175 Received: from wfhigh5-smtp.messagingengine.com (wfhigh5-smtp.messagingengine.com [64.147.123.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD2C0146D5D for ; Mon, 13 May 2024 08:18:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.156 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715588310; cv=none; b=WiEWVVQzBExJw1e3VQ2fEuh2xWpKRqXppejOpF3qGa+l2NDPTHa/le13cDwfjutqaMhEPe+rYMihLPAEGDZLUR28pundYdC1IlEeDwCfAA7GBjHutO1T0LLqrjQUZleOSNbvQzUfbhD1gU1pLGXRJ+/BjG/bVxZhGKrrKDxhW5E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715588310; c=relaxed/simple; bh=0nwwyIrkFFvFbP0oeO2sHsl45gaByKAmmBCvKlDsgFI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eOp9zkYrwUljdFjRjPVaHlqjq+2lv8t4uEHd8NWH0SvE0ayFe358DrpiXV7Wm/MTIEtarVuGuYgrZoLxoQmY86l+TVoWa7UQmOHcyXIxPB8DhEhJYqEAjBcTOtmJgJJIIcnl5UqhF3+USs2C6aribCs1rsKXH2jJuEpTKS1SpkU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=H1UlPiCv; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=NfCw4Ww/; arc=none smtp.client-ip=64.147.123.156 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="H1UlPiCv"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="NfCw4Ww/" Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfhigh.west.internal (Postfix) with ESMTP id 018021800082; Mon, 13 May 2024 04:18:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 13 May 2024 04:18:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1715588307; x=1715674707; bh=2KSA/rGdWb e7fOkX/TDtw+s0EfN9c/dQ9NUvzIyNLI8=; b=H1UlPiCvTqXP/zHiWB6jEungK1 bdYnG6UwP87bGWHhLaEBB950Fhww3B5/LkmAe4PoG/NFnq8yvAAsZOzzIb3+nPeZ RUqPpQvFujfY3+H7ojgNG/P8Bz+KyNOEvkPC5hNZ4+sTXFl2gvTSz8hOZSh72lH4 L3OPMcir9e+u7vpqSwu+TPBX+QPpycoUhzwcNT4T7yh14zgSDoKUm7WdtUa81yxJ WqeXCfw23Du7e0GTU0tXJkkNkG3x5uWLw1QsY/Y+L+dXX1kcHhRNgwmm+RmkjWg+ GuqyKb9H/k2Mehe2PwZ3VcX3meMRdHU2b0LqUdw/KqsRx5YwMrGiG8WeKMTg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1715588307; x=1715674707; bh=2KSA/rGdWbe7fOkX/TDtw+s0EfN9 c/dQ9NUvzIyNLI8=; b=NfCw4Ww/J0pwOrZrTvzFnoxQXFq1WaLo3DU7fMNZIdeR LiRafLOitgk9sF4K2P1Cmt/eahZ4N83gPt36t+DaSPaLQI18yNKLzKiriGPb2dwK nuo/1d81L9NCXEt22IBZBRYLbr00QeYnkAK7LpfRSywtl4mC+DJO4pinJiD/xqvF obmHKv0dZZSc3SR7aUJGIETPevI5oSnSR4ExrJYjnGSTxCYKM9gfyqEiB9NWc11e l+LsipsmFxmOXnDe2BMQKyXaVv0z0p2BFEc5qc7WtgtvcjgXpahlpXzs0XA8IQTw NY3OgSR29cf/nBWDegd2qBDr3jXCVLvinnMXsa3+ZQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdeggedgtddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomheprfgrthhr ihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvg hrnhepueektdevtdffveeljeetgfehheeigeekleduvdeffeeghefgledttdehjeelffet necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphhsse hpkhhsrdhimh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 13 May 2024 04:18:26 -0400 (EDT) Received: by localhost (OpenSMTPD) with ESMTPSA id 8475065c (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 13 May 2024 08:18:07 +0000 (UTC) Date: Mon, 13 May 2024 10:18:23 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Karthik Nayak , Justin Tobler , Junio C Hamano Subject: [PATCH v3 07/11] reftable: use `uint16_t` to track restart interval Message-ID: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: The restart interval can at most be `UINT16_MAX` as specified in the technical documentation of the reftable format. Furthermore, it cannot ever be negative. Regardless of that we use an `int` to track the restart interval. Change the type to use an `uint16_t` instead. Signed-off-by: Patrick Steinhardt --- reftable/block.h | 2 +- reftable/reftable-writer.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/reftable/block.h b/reftable/block.h index e91f3d2790..1c8f25ee6e 100644 --- a/reftable/block.h +++ b/reftable/block.h @@ -29,7 +29,7 @@ struct block_writer { uint32_t header_off; /* How often to restart keys. */ - int restart_interval; + uint16_t restart_interval; int hash_size; /* Offset of next uint8_t to write. */ diff --git a/reftable/reftable-writer.h b/reftable/reftable-writer.h index 03df3a4963..94804eaa68 100644 --- a/reftable/reftable-writer.h +++ b/reftable/reftable-writer.h @@ -28,7 +28,7 @@ struct reftable_write_options { unsigned skip_index_objects : 1; /* how often to write complete keys in each block. */ - int restart_interval; + uint16_t restart_interval; /* 4-byte identifier ("sha1", "s256") of the hash. * Defaults to SHA1 if unset