From patchwork Mon Sep 7 08:37:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Gray X-Patchwork-Id: 1358664 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=EiN+6E7w; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BlMB13TSWz9sSn for ; Mon, 7 Sep 2020 18:38:17 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7DB3786655; Mon, 7 Sep 2020 08:38:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kbETkOoCOXdr; Mon, 7 Sep 2020 08:38:10 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 1C694856ED; Mon, 7 Sep 2020 08:38:10 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id F29E0C0052; Mon, 7 Sep 2020 08:38:09 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 21820C0051 for ; Mon, 7 Sep 2020 08:38:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 1108D20446 for ; Mon, 7 Sep 2020 08:38:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id guXZFqtuixvH for ; Mon, 7 Sep 2020 08:38:07 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by silver.osuosl.org (Postfix) with ESMTPS id BF3C920000 for ; Mon, 7 Sep 2020 08:38:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599467885; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h9OlixHTedRBLcW+UOC5gVKZ3CH8Hs6sWA7bO4nhxNA=; b=EiN+6E7wX7Jcw/FP6O5xkJ0itruZoUxTLlXQpbh0LWA/0q/7wUAWa+0wPoWRFNM1Abooq3 BVHimPaEJcTh8qlhfr5jo1+lkkm0jD90sy0973XDmNRW/0zHoRqCXPT+kmIG6uxFZtZQy7 N6Z0SCap2ZRCPLhPQi7icEodicFfGTY= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-552-hWRs6wyCP660vKeNT2tUQg-1; Mon, 07 Sep 2020 04:38:03 -0400 X-MC-Unique: hWRs6wyCP660vKeNT2tUQg-1 Received: by mail-wr1-f71.google.com with SMTP id l17so5414537wrw.11 for ; Mon, 07 Sep 2020 01:38:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=h9OlixHTedRBLcW+UOC5gVKZ3CH8Hs6sWA7bO4nhxNA=; b=N0rmznDmdaOPncpQdhmApM4oIgBHJmSM04kmxbP6aonosbzVcpu3b8p6B7MY7F+Y44 SRZLYzv4QuBTxg47feXRD4eJ8HKAMTgwjih5SUCKUIZk+2ZMvRWNG/qxUVfSM+iPsu3q 6Dv4KuNorpomVRHM8lixGz3d07deGRclq4jz5B1/kpGZI7917AJlFOR4b4pfCVGdJkwG 8TuWygfXxv/zFkry/1dQOJdQvuH41GYTUAabvCw4sldxDFKX5LH8Tt2d/TG05QklLqGL 6qBwNo6RMRJgVXDjHZ/NXwNYKwzUZryZhNd6F5BEsOsw1pUDshewaxJ4aaSY1D9A7tAA ZIjw== X-Gm-Message-State: AOAM5324u/KJZIeJZivHpThreik2TaIJVLhr424oJujwuOS1l5eep/rt Aov+r+K/pBlZdxTq6hTXtuBGe8TsH3mFUazudWoma3LoTo6PAkL0eW1L+KYG0+fRbT/91iCo7kd yp1ww9yaBGCvw4QoMRA== X-Received: by 2002:a1c:a9c2:: with SMTP id s185mr20130792wme.100.1599467881883; Mon, 07 Sep 2020 01:38:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpco06DP3rusGgkY4rYxcqAgYYD2R4KgujedYsoqnAnrh/ifrlixrPAmcVuPFhG64R6PebdQ== X-Received: by 2002:a1c:a9c2:: with SMTP id s185mr20130781wme.100.1599467881705; Mon, 07 Sep 2020 01:38:01 -0700 (PDT) Received: from magray.users.ipa.redhat.com ([64.43.158.76]) by smtp.gmail.com with ESMTPSA id b194sm28374589wmd.42.2020.09.07.01.38.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2020 01:38:01 -0700 (PDT) From: Mark Gray To: ovs-dev@openvswitch.org Date: Mon, 7 Sep 2020 09:37:54 +0100 Message-Id: <20200907083755.11549-2-mark.d.gray@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200907083755.11549-1-mark.d.gray@redhat.com> References: <20200907083755.11549-1-mark.d.gray@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mark.d.gray@redhat.com X-Mimecast-Spam-Score: 0.0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v6 1/2] id-pool: Add interface to check if id has been allocated X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Signed-off-by: Mark Gray --- lib/id-pool.c | 10 ++++++++++ lib/id-pool.h | 1 + 2 files changed, 11 insertions(+) diff --git a/lib/id-pool.c b/lib/id-pool.c index 69910ad08..bef822f6b 100644 --- a/lib/id-pool.c +++ b/lib/id-pool.c @@ -93,6 +93,16 @@ id_pool_find(struct id_pool *pool, uint32_t id) return NULL; } +bool +id_pool_has_id(struct id_pool *pool, uint32_t id) +{ + if (!id_pool_find(pool, id)) { + return false; + } + + return true; +} + void id_pool_add(struct id_pool *pool, uint32_t id) { diff --git a/lib/id-pool.h b/lib/id-pool.h index 8721f8793..62876e2a5 100644 --- a/lib/id-pool.h +++ b/lib/id-pool.h @@ -29,6 +29,7 @@ void id_pool_destroy(struct id_pool *); bool id_pool_alloc_id(struct id_pool *, uint32_t *id); void id_pool_free_id(struct id_pool *, uint32_t id); void id_pool_add(struct id_pool *, uint32_t id); +bool id_pool_has_id(struct id_pool *, uint32_t id); /* * ID pool.