From patchwork Thu Feb 6 00:34:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13962083 Received: from mail5.g24.pair.com (mail5.g24.pair.com [66.39.139.36]) (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 5F66AF4ED for ; Thu, 6 Feb 2025 00:41:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.39.139.36 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738802479; cv=none; b=lE9/kkFZ879Gr/A2nzdIdWjkkMNRvhc/G/JTNV5I60Dc5vWOcFVvHcb8gIm4fYg2FFyT1sJT6KETM5W+ok6h1VkBxUm4ph8jXtWVSyI4b1xBrAfcIdVxChZj/L3rPzbZg6ZJpL/6Q4tOSy11v79QDQefrpB2BU0Bd0UjpnxKneU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738802479; c=relaxed/simple; bh=VPUL13pmlLMuij4gvaURQQYUkMaElvTNvVR40lgp4PQ=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J5YxOkQufxSupu3NZpzIybuiMqEPyIF3rBKV1YtS3rmSjWnaj1eXt/k8lFB9csXaf7kjcbulpwKgozxYi2G43LpFCaoqn1a9Qx0xmiQ/HqD98Gz6cRBIKXa2+MU4ike8Un8xml/dKzO+c2c3WOjis0JTWGnUfflhk1a9jzdtj94= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com; spf=pass smtp.mailfrom=nuovations.com; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b=gDp8fPcV; arc=none smtp.client-ip=66.39.139.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nuovations.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b="gDp8fPcV" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 021EF164A67 for ; Wed, 5 Feb 2025 19:34:49 -0500 (EST) Received: from localhost.localdomain (c-24-6-12-99.hsd1.ca.comcast.net [24.6.12.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail5.g24.pair.com (Postfix) with ESMTPSA id A3C90125168 for ; Wed, 5 Feb 2025 19:34:48 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH 1/5] provisiondb: Const-qualify '__get_string'. Date: Wed, 5 Feb 2025 16:34:42 -0800 Message-ID: <3d9fa4cd278a96af3fbf47480e63ccc175868d2b.1738800116.git.gerickson@nuovations.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuovations.com; h=from:to:subject:date:message-id:in-reply-to:references:mime-version:content-transfer-encoding; s=pair-202401062137; bh=Yp1i/DyJLdm0irVvOCCzVjLrlwJ0+3o/O9ZknMhEwf0=; b=gDp8fPcV0aVvkRG9gH9ufL1jhZLKY4GRlSr+9+uBg9kppSPmjRh4RRBIE+eCXFfRgfaOWOqPaKYRuczJ3vc8aOAtAkBJuCW/xyxzs0a8I8Fa4zVGOOm6CsLZQGd8TNYHnlGRgJoIZq4c56MEBBdDs256sGGFcuYcWqPA5kbLblT8jiHgG3KtnVdHCBYbysxTTWFHLsOz2MSb/foKw0/Y5Osa+tupRj+oQWBxaHP0+QpsElecDdbbDpYrra4+pWUSNi+qQPbp/mKxWcfKOBdncsNNPVxwoBJ5mjFPB8BcTpBD8aEFTiV7Vbvvv38FuQd+bbTcn+4n5eBgrfRVsERddQ== X-Scanned-By: mailmunge 3.10 on 66.39.139.36 Const-qualify the pdb argument of '__get_string' to make it clear to the compiler, static analyzers, and human readers that the function is strictly a getter with no pdb argument mutation side effects. --- src/provisiondb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/provisiondb.c b/src/provisiondb.c index 6a913d8d1540..8a71978b8afe 100644 --- a/src/provisiondb.c +++ b/src/provisiondb.c @@ -204,7 +204,7 @@ static struct provision_data *__get_provision_data(struct node *node) return ((void *) node) + sizeof(struct node); } -static int __get_string(struct provision_db *pdb, uint64_t offset, +static int __get_string(struct provision_db const *pdb, uint64_t offset, const char **out_str) { if (!offset) { From patchwork Thu Feb 6 00:34:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13962084 Received: from mail5.g24.pair.com (mail5.g24.pair.com [66.39.139.36]) (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 A206A101F2 for ; Thu, 6 Feb 2025 00:41:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.39.139.36 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738802479; cv=none; b=j8vNTqn/yKM/JMKliHizbhBOxs4zPsfHf53YsnvElT4OwgFYv6+bmNzQNZnuhGk0vXQpOeD5pOk0f4pVp7zgvNUMnZHdKKDGS3teZV7bcCsdZlwI/BIW7Vd/6PdKMbr7J0xiwLnW1dQuSSo30gdNi0+9XKDvU+Uw8GcP0uuZXng= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738802479; c=relaxed/simple; bh=hUPIzLaesVuNABycQm3Zmfb73HbxNKOiuNb7q2nGx0I=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eXr9dJRqW/7qnITd7PI88tVPDf6Zc6yRk2dzi1WunQxbpdrKVz0b4uez//HeLla8is5Br7HPHbBfCEOgdjwpUKCvk8c55J5ytuMWOEt+AY6vsOxqTXY1wo8M3sFcvjbL5vqNOLGN2loYC1TxuPQahgDSONKdjSle2krLtO58nU8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com; spf=pass smtp.mailfrom=nuovations.com; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b=g80aLd1J; arc=none smtp.client-ip=66.39.139.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nuovations.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b="g80aLd1J" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 77D46164A75 for ; Wed, 5 Feb 2025 19:34:49 -0500 (EST) Received: from localhost.localdomain (c-24-6-12-99.hsd1.ca.comcast.net [24.6.12.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail5.g24.pair.com (Postfix) with ESMTPSA id 2536212636E for ; Wed, 5 Feb 2025 19:34:49 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH 2/5] provisiondb: Const-qualify '__get_contexts'. Date: Wed, 5 Feb 2025 16:34:43 -0800 Message-ID: <01ee6574eb0a05aaabbe757d452e562237ee1add.1738800116.git.gerickson@nuovations.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuovations.com; h=from:to:subject:date:message-id:in-reply-to:references:mime-version:content-transfer-encoding; s=pair-202401062137; bh=d5Xwi+3S78CcJnGP7P7FYnX1pyjp3SaYFpy6ibXRFF4=; b=g80aLd1JnY0bkclQNbt6pgV5E5d/RrWlgJEp7tBbRNpGx3JugqiZSpFaHciJ5JKtLweW+7n/jewDhP7Azbahy6CjT0j0PwNVP6vKiRLrTeeHuB8CKi5TZp2LhzA7g5nNcy9gPs7bPS+3hYva85GVx6ELzDqIrjAlHXRIxRuRe6+0qDvOH153dBaXdBGtUhShPIKBQmJY+0RFUB+qUNqolaT0E1Q9xkemllMOuKxt2sb0v48bDRAIQsGHMDkOaGA+5cjYVPMuuBe1VQD9nyCuTvUBRn//cY5UfMfuvqfp9MbQnGu8ShvvIBtJVtlKnyn5Ea57W8HmwVnSJvFQ2VZNdw== X-Scanned-By: mailmunge 3.10 on 66.39.139.36 Const-qualify the pdb argument of '__get_contexts' to make it clear to the compiler, static analyzers, and human readers that the function is strictly a getter with no pdb argument mutation side effects. --- src/provisiondb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/provisiondb.c b/src/provisiondb.c index 8a71978b8afe..4a7f1bb6ef6e 100644 --- a/src/provisiondb.c +++ b/src/provisiondb.c @@ -236,7 +236,7 @@ static bool tags_match(char **tags_filter, const char *tags) return false; } -static int __get_contexts(struct provision_db *pdb, uint64_t offset, +static int __get_contexts(struct provision_db const *pdb, uint64_t offset, char **tags_filter, struct provision_db_entry **contexts, size_t *n_contexts) From patchwork Thu Feb 6 00:34:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13962085 Received: from mail5.g24.pair.com (mail5.g24.pair.com [66.39.139.36]) (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 A2029F9F8 for ; Thu, 6 Feb 2025 00:41:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.39.139.36 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738802479; cv=none; b=qsi0nn4fbX2hQCiZ2jeLAby/CrZgZ7bBPOQbTvVBHm3C5FsxYaqCBILBO2cuy0iOpWsJLPViE2qa59qKxgNWmfNAPaZqqrfabIsXSxN8Zg+5IuVOnreJlTmgWDH11FwaY5zve6fbxf9xZ6NhaoqJp1Uo1REMOXz/A7Q07k9r1rE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738802479; c=relaxed/simple; bh=1kwlqT9UPSJWM8JIiiEpRoisZrhKgOe91mfLBcjgoqI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qRMQ54ZnL1jf6V/7oJ+NRwJrmwlECKfXXRnlZmcYAd3FFVtqsuRBVXe1uYNya0ijohMFn5geOgIU+bVz4NFGyyGA9GnwUJa0SHBE6WEBxY+Kf9sSz6Ep9uul+vd6CDHby4dPO2660F4QQMU7cutQSgd7f1ILjOP3Rw27eWYdxyM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com; spf=pass smtp.mailfrom=nuovations.com; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b=MgE4gCNM; arc=none smtp.client-ip=66.39.139.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nuovations.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b="MgE4gCNM" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id E3A0F164A7D for ; Wed, 5 Feb 2025 19:34:49 -0500 (EST) Received: from localhost.localdomain (c-24-6-12-99.hsd1.ca.comcast.net [24.6.12.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail5.g24.pair.com (Postfix) with ESMTPSA id 9A62712636E for ; Wed, 5 Feb 2025 19:34:49 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH 3/5] provisiondb: Correct the precondition return conditions of 'tags_match'. Date: Wed, 5 Feb 2025 16:34:44 -0800 Message-ID: X-Mailer: git-send-email 2.45.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuovations.com; h=from:to:subject:date:message-id:in-reply-to:references:mime-version:content-transfer-encoding; s=pair-202401062137; bh=L8ZesYZgPffNhwUrxdGUESlbH3Zk2RV1/UX9qyjSK5U=; b=MgE4gCNMA2YZ740K3r43HVaV/hR2hxljzi1MqKdg0iA6btcovmNwwUDeAm38Kg2k4xBvhYJHpTdYTjzq9FjDS63MszwY5nKeCGsvqK9iCCMog1IY7OvpJGDM4nqpqY2y9MQLDeu+ciT23vcZb8IU3yImGK6+6SaqW9lULkjuZttdjgujMi9NUJujdmxMjhq0mDQuiqovt7CKInU60o36VCrjOtV7K7nV+QPy1eqR2+30qgrfBd3S3odSDPH//iPbX6jeK0K8PoeJXA1FxSg/wgqa2GPOO/zcu7gTAl33zokh45HudLWALpLEZ8NU8Td/Du3nBq7K+3LSScKF7AUHHw== X-Scanned-By: mailmunge 3.10 on 66.39.139.36 Prior to this change, specifying 'TagsFilter' in ${sysconfdir}/ofono/main.conf resulted in returning APNs which have no tags plus APNs that match a tag in 'TagsFilter'. In addition to seemingly violating the rule of least astonishment, this did not do what was desired, which was to downselect more than one APN to one (or more) matching a specific tag. With this change, specifying 'TagsFilter' now follows the rule of least astonishment and matches expectations, returning only those APNs which match a tag in 'TagsFilter', period. One specific tag: # ./lookup-apn -t "kore-m2m-public" 311 480 Opening database in default location Searching for info for network: 311480, spn: Name: 4G LTE Contract (Public) APN: vzwinternet Type: 1 Proto: 2 Tags: kore-m2m-public As desired / expected. Another specific tag: # ./lookup-apn -t "kore-m2m-private" 311 480 Opening database in default location Searching for info for network: 311480, spn: Name: 4G LTE Contract (Private) APN: wyleslte.gw7.vzwentp Type: 1 Proto: 2 Tags: kore-m2m-private As desired / expected. Two specific tags: # ./lookup-apn -t "kore-m2m-private,kore-m2m-public" 311 480 Opening database in default location Searching for info for network: 311480, spn: Name: 4G LTE Contract (Public) APN: vzwinternet Type: 1 Proto: 2 Tags: kore-m2m-public Name: 4G LTE Contract (Private) APN: wyleslte.gw7.vzwentp Type: 1 Proto: 2 Tags: kore-m2m-private As desired / expected. No tags: # ./lookup-apn 311 480 Opening database in default location Searching for info for network: 311480, spn: Name: 4G LTE Contract APN: vzwims Type: 28 Proto: 2 Tags: (null) Name: 4G LTE Contract (Public) APN: vzwinternet Type: 1 Proto: 2 Tags: kore-m2m-public Name: 4G LTE Contract (Private) APN: wyleslte.gw7.vzwentp Type: 1 Proto: 2 Tags: kore-m2m-private Name: 4G LTE Contract APN: vzwapp Type: 4 Proto: 2 Tags: (null) As desired / expected. --- src/provisiondb.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/provisiondb.c b/src/provisiondb.c index 4a7f1bb6ef6e..753d7725103a 100644 --- a/src/provisiondb.c +++ b/src/provisiondb.c @@ -224,9 +224,22 @@ static bool tags_match(char **tags_filter, const char *tags) _auto_(l_strv_free) char **split_tags = 0; unsigned int i; - if (!tags_filter || !tags) + /* + * If tags_filter was not specified, then the caller does not want + * to match on tags, so just return true. + */ + if (!tags_filter) return true; + /* + * If tags_filter was specified, then the caller does want to + * match on tags. Consequently, if there are no tags to match + * against, then we must return false since such an entry cannot + * match. + */ + if (tags_filter && !tags) + return false; + split_tags = l_strsplit(tags, ','); for (i = 0; tags_filter[i]; i++) From patchwork Thu Feb 6 00:34:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13962087 Received: from mail5.g24.pair.com (mail5.g24.pair.com [66.39.139.36]) (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 5F630B672 for ; Thu, 6 Feb 2025 00:41:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.39.139.36 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738802480; cv=none; b=Lw2Al4YcnsZTJ8l6khdemFiq24phy42BNRszQecoWcgtBcRE88bwrAVDlhZ0227z0fo7SXfJSHxtCtbwRdTvCfyEdnhL9ifcbFfFfdCLmXapehS90ZvV34+5xl5T1TdiREC2Dq4DxYe6XBR6UA5BZsPTCDmfGnwkVL2EGd281ms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738802480; c=relaxed/simple; bh=d335SvY3+hTRfi5tYIoX41gsAp35lpN7sOuAEUWvpFw=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Mes4ayybFBhM0cpyLBU9Ie+MzINHyrVbLqlEY526DQarZLcyakRYM1FL6fTJ95mPpW7cYWe2TRmkYyPXgpjTuiZA/9IjrdvUk3fGLApAIOq+V1C0CSidcB4v9iHeWr3TOjCsyNkRwg9dvpoINRHdZesA3MZVhb5eREXK7hZSZYU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com; spf=pass smtp.mailfrom=nuovations.com; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b=QhP6YTkm; arc=none smtp.client-ip=66.39.139.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nuovations.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b="QhP6YTkm" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id 5BE2A164A92 for ; Wed, 5 Feb 2025 19:34:50 -0500 (EST) Received: from localhost.localdomain (c-24-6-12-99.hsd1.ca.comcast.net [24.6.12.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail5.g24.pair.com (Postfix) with ESMTPSA id 129BF126377 for ; Wed, 5 Feb 2025 19:34:50 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH 4/5] provisiondb: Document 'tags_match'. Date: Wed, 5 Feb 2025 16:34:45 -0800 Message-ID: <4815b6ef97f75f94685ea30c5d859f2e85422fbd.1738800116.git.gerickson@nuovations.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuovations.com; h=from:to:subject:date:message-id:in-reply-to:references:mime-version:content-transfer-encoding; s=pair-202401062137; bh=D+m6lEBzeuyfbK/jzgOAwmq9xYSYXqkKniZWM5nV8gY=; b=QhP6YTkmPP6T78C8J8kjZxhkh8yvuLeYnDnS77Xirg7xviJeNrrV2IBskDgQ7PKkTyhZT1qWVIo9CDfVQOQzvrnl5ERN4pihKe+pMPg34paOwZolXyWLALRLaWKGgcok46C9BElzqabmyaehSLIEtMc5yE5FNX8zlwT0azVnxZC1SmYqYkkWWr1e+6QQgG6Qb8I5AHxTQKnasjyM3H0xUx72/Fobuz1DbPe22t4csdrVuIKrqGfYqs533r2KyOUxBHl2Uo9MvDjjmYObJuZF9XRhLyKsmc/l/1N5yUpFmWz+kOos8JxmDe491y8Y6zHpMd+xYQxND9OUocyyloDLBA== X-Scanned-By: mailmunge 3.10 on 66.39.139.36 Adds documentation to the 'tags_match' function. --- src/provisiondb.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/provisiondb.c b/src/provisiondb.c index 753d7725103a..c7d35e4ada8f 100644 --- a/src/provisiondb.c +++ b/src/provisiondb.c @@ -219,6 +219,26 @@ static int __get_string(struct provision_db const *pdb, uint64_t offset, return 0; } +/** + * @brief + * Return whether one of the tags in the specified tags array + * matches one of the tags in the specified comma-separated tags + * list. + * + * @param[in] tags_filter An optional pointer to a string array of + * tags to match. + * @param[in] tags An optional pointer to an immutable C + * string containing a comma-separated + * list of tags for @a tags_filter to + * match against. + * + * @returns + * True if @a tags_filter is non-null and one of its tags matches a + * tag in @a tags; otherwise, false. + * + * @private + * + */ static bool tags_match(char **tags_filter, const char *tags) { _auto_(l_strv_free) char **split_tags = 0; From patchwork Thu Feb 6 00:34:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Erickson X-Patchwork-Id: 13962078 Received: from mail5.g24.pair.com (mail5.g24.pair.com [66.39.139.36]) (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 51BFA2F4A for ; Thu, 6 Feb 2025 00:34:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.39.139.36 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738802099; cv=none; b=GpM7whWn39lOPXhjM4exuKZd9l9uSoGMOwm/riJeBV/c7Dw25ATUjBBpPy44BpGB054sdI7XYjBtWOtQFu6WatIbm5wNbcb93ZgEiIS6j5jbvfGSxpILJ3TTpcAX7T0WVZBmDiB6HuEUw0x/Ru+YTFsxSPOJ7o9CUIgilryO3kQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738802099; c=relaxed/simple; bh=joaTwBn02dmmkjAKhIwkPEcrVnIZdpz5oBmf8Hono3c=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sdvl/eojLBYHdMQ9ziOZQ1kLm67dEBI1R//eO+yfRZ1MPCOmc/ehx9uw4X8MALzvaLgxcxIkYhuFzwYradblUTqoNjyqtXgdXC48sxjjQmM/UprQJT4BYatY5xZ/gq05eGveP+wUV4juDfOzMApoHlAGLOFKNgGnpa7WTGxaPZE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com; spf=pass smtp.mailfrom=nuovations.com; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b=RqMOy9Ug; arc=none smtp.client-ip=66.39.139.36 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nuovations.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nuovations.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nuovations.com header.i=@nuovations.com header.b="RqMOy9Ug" Received: from mail5.g24.pair.com (localhost [127.0.0.1]) by mail5.g24.pair.com (Postfix) with ESMTP id CC442164A93 for ; Wed, 5 Feb 2025 19:34:50 -0500 (EST) Received: from localhost.localdomain (c-24-6-12-99.hsd1.ca.comcast.net [24.6.12.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail5.g24.pair.com (Postfix) with ESMTPSA id 82011125168 for ; Wed, 5 Feb 2025 19:34:50 -0500 (EST) From: Grant Erickson To: ofono@lists.linux.dev Subject: [PATCH 5/5] provisiondb: Document '__get_contexts'. Date: Wed, 5 Feb 2025 16:34:46 -0800 Message-ID: X-Mailer: git-send-email 2.45.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: ofono@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuovations.com; h=from:to:subject:date:message-id:in-reply-to:references:mime-version:content-transfer-encoding; s=pair-202401062137; bh=+BOQAv0qxrwY1uKf1jjJrtdq2MG4ZbQ/yigaD+DVcF0=; b=RqMOy9UgSbOuOu4ndZBdOTCW/OBI0H192SxyI4Xypjo8ytg30temkqKxn0E88ZWZ1IN61/nhvSqyZL9T099iv+pfdUoEK+8br2ogc72WPFjgQPvDQq8UIcWJChDZuLXi/to33cBKliFBXjQ9ichjW6pFxw16cshtJ8n5uCpmU+5818VnfBvKupkXICNFvMf7656aGtIJOrIJYl8vxxdwazE3FHAaPPMSR1l/mGFm39rUarV4HuZCvH1hUTL8pceHm+zuTDIta9lXAOsXYd24jB49Y/3DNo0CBJicXbTkwZwM70+TtnMazfCj4fby46h0WrrZ7IqEjbmqN+Q0GgwfcA== X-Scanned-By: mailmunge 3.10 on 66.39.139.36 Adds documentation to the '__get_contexts' function. --- src/provisiondb.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/provisiondb.c b/src/provisiondb.c index c7d35e4ada8f..2d7b29fdab45 100644 --- a/src/provisiondb.c +++ b/src/provisiondb.c @@ -269,6 +269,31 @@ static bool tags_match(char **tags_filter, const char *tags) return false; } +/** + * @brief + * Get contexts from the provisioning database at the specified + * offset, potentially matching the optionally-specified tags. + * + * @param[in] pdb A pointer to the immutable + * provisioning database from which to + * return contexts. + * @param[in] offset The offset in @a pdb from which to + * return contexts. + * @param[in] tags_filter An optional pointer to a string array + * of tags to match against candidate + * contexts. + * @param[out] contexts A pointer to mutable storage for a + * an array of retrieved contexts. + * @param[out] n_contexts A pointer to mutable storage for the + * number of contexts pointed to by @a + * contexts. + * + * @retval 0 If successful. + * @retval -EPROTO If @a offset results in an overrun of @a pdb. + * + * @private + * + */ static int __get_contexts(struct provision_db const *pdb, uint64_t offset, char **tags_filter, struct provision_db_entry **contexts,