Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2376990rdb; Mon, 12 Feb 2024 02:53:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUgQv5gnEvgiakHiGm5jlUZP4qlJBkuugI7Ip+JekGfHbDUo6zMZ9cS+QT3FKJOJe0PgCgj1+o7kJx0EUzhgjmTwYg5yN6S83rFfA8Zxw== X-Google-Smtp-Source: AGHT+IE6uGn//o2vAE3hD4Ill4W04a2VJ2gPJ06J696HDEOsP/2deT17glRLlSHuOuqpiTax4n+N X-Received: by 2002:aa7:c457:0:b0:561:55d1:371a with SMTP id n23-20020aa7c457000000b0056155d1371amr3695897edr.41.1707735238255; Mon, 12 Feb 2024 02:53:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707735238; cv=pass; d=google.com; s=arc-20160816; b=v8kML8N8IYY+6inI/SF7Ic2LTW01pMtvLl+UCOHUQ8hXq5qFlOTHZ2GqnToIcHxKAK u87atZhPtCnBByIynNgNRRCqQkv5dcvP2ZwTixg8Qll2yqTjlHWPmG52EPVl+ZYDBDiw D4f0xH6BjKq2vkLsANWZGoWnRxYl3bkFzu1inPg221bPZwSj7z4h/KTOjRuODROmEZlC SvUllJ9ogsDAn2PX/cTMcF3Jv4/LfscAL9EHF/69tdd8/ZotXnljj5Wgb59i56+wcGPz wxuKfhGbk+9McczZqg7g+3HGEvxWfWooyb6sS19uU5cednc4DwkE0pVaT6+AznPriUPH V+Sw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=lWfuXt/WdGe0CJmN8CWe6iB5E3yINDFiaIw6zs0UJFc=; fh=G9rSYZqLZLqMtHxvErdmIYY5DmCJgc7ZfVJVDVBPcWQ=; b=DhExN29H5bPHejPw5L/7hQbPDamICxqgpuK8VXyxNdfOGpZiqPruVICAoNTKXxcCXe Ap6TfnKd59ln2ar5v8hlR2qn34QuDSmdSAW4BN7GZY4nH6ezeFu3Hfhvzivo6g63Xx2O KAqEEKJj2mmzB+rVRCnSYkLeL4IUp9akrkXFDuAnqVdjuFC92Mnw2CRkeAr7pMH0/HpL MEKdErc4mm7nWJ2TVn29Ubon3CrYs2AzOylMQvrAqGABVnOaphwd4iWtLfnco2H1KEON XKMUVD64Gdet20Ssm7XCKKA67QN8kuCBn+gWHZCc4AgWpH82KQUe+/w3Osiscau2UNqU 3w9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=D2eyExow; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-bluetooth+bounces-1755-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1755-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXnZ+V46DJHAiiR4GA8oDa6K2fjaVOTWLrVyYmiU0yrAH0JiULd4KG7XpOzYty32TY8xFV3vZ8QmRHkfgc0WD3LC7vyKZ94x+TspL60Tg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id e25-20020a50a699000000b005619efb14cesi1318204edc.480.2024.02.12.02.53.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 02:53:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-1755-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=D2eyExow; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-bluetooth+bounces-1755-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1755-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 070681F21251 for ; Mon, 12 Feb 2024 10:53:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 133A53AC10; Mon, 12 Feb 2024 10:50:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="D2eyExow" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 D411E3AC0C for ; Mon, 12 Feb 2024 10:50:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707735031; cv=none; b=lBMkHpakxegGWP3FBN14reQ5m8Em1R7pJwMDO2m1Yjaoh0KwPKxc4jV7R9CFGywchEcTdHWKuzOs0h2q64iSSxVu8FKvRO8edBZrVXxtDc3g9boqD3Szu02B3jP0lqqlXhjnOn+6czK7/EcDWfYbR3drCjTBhZNQ1SwEUdvw0ok= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707735031; c=relaxed/simple; bh=ZPhiTtmHA5Wz+bP/VwMzuP5GMayeXXPL5w4/3O/na9w=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=NEw/CvIla2MqkmIVd4xU8z2Oi0epdyUzVMtqXA3NQ9wQxaCtonqD07Oe4NlUUNQv261Ljy1762r3Gu6caPw63Sgs8s3lC86FXTciSUBDxMDgdP9K8q8ypxxiB5zXRLeYeRy3Dn/fsVwdM+MirxQsGXeOSOt0/3Xk12lyD9mUFm4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=D2eyExow; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707735029; x=1739271029; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ZPhiTtmHA5Wz+bP/VwMzuP5GMayeXXPL5w4/3O/na9w=; b=D2eyExowth2Fm3DWKv/fvxjqB7wMlfDWb5WEYiBOWmmlvoXuLCEs0vVA jBfKlPEfSQAR4hPpX/G79GT7QOi5yoEOMZeyX1yBaTRaVktqUzWG6olBO 5opugKkBEryv5Gitl7srEJ3ZLRnjIK2KoXXfwf0oo/hTQd3iT31S6y7Yn +gX/ZGbFcHz3eOOivOTF4vTNNxkocT9bgq/ibs/tbd/R6Tc7hS6CsepnU 4jr470SLPzEX/+Qjpd1qGvjJg5CkDgJZhDzuYDQebrDibSoQ9XFt4f6W6 eIfqTJJYMU/FmBHSrTLdNH23jz/6mXJcS3O/f09AiUDaV5IzGu7TU76/N Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10981"; a="1609237" X-IronPort-AV: E=Sophos;i="6.05,263,1701158400"; d="scan'208";a="1609237" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Feb 2024 02:50:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,263,1701158400"; d="scan'208";a="33347542" Received: from weba0535.iind.intel.com ([10.224.186.30]) by orviesa002.jf.intel.com with ESMTP; 12 Feb 2024 02:50:28 -0800 From: Ajay KV To: linux-bluetooth@vger.kernel.org Cc: ravishankar.sriv@intel.com, kiran.k@intel.com, Ajay KV Subject: [PATCH BlueZ 1/3] lib/uuid: Add support to compare 16bit uuids Date: Mon, 12 Feb 2024 18:17:24 +0200 Message-Id: <20240212161726.3097145-1-ajay.k.v@intel.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit --- lib/uuid.c | 9 +++++++++ lib/uuid.h | 1 + 2 files changed, 10 insertions(+) diff --git a/lib/uuid.c b/lib/uuid.c index 1d2e1f7328b8..3ef45db5408c 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -120,6 +120,15 @@ int bt_uuid_cmp(const bt_uuid_t *uuid1, const bt_uuid_t *uuid2) return bt_uuid128_cmp(&u1, &u2); } +int bt_uuid16_cmp(const bt_uuid_t *uuid1, uint16_t uuid2) +{ + + if (!uuid1 || (uuid1->type != BT_UUID16)) + return 0; + + return (uuid1->value.u16 == uuid2); +} + /* * convert the UUID to string, copying a maximum of n characters. */ diff --git a/lib/uuid.h b/lib/uuid.h index 8839dea08140..124e74985a80 100644 --- a/lib/uuid.h +++ b/lib/uuid.h @@ -242,6 +242,7 @@ int bt_uuid32_create(bt_uuid_t *btuuid, uint32_t value); int bt_uuid128_create(bt_uuid_t *btuuid, uint128_t value); int bt_uuid_cmp(const bt_uuid_t *uuid1, const bt_uuid_t *uuid2); +int bt_uuid16_cmp(const bt_uuid_t *uuid1, uint16_t uuid2); void bt_uuid_to_uuid128(const bt_uuid_t *src, bt_uuid_t *dst); #define MAX_LEN_UUID_STR 37 -- 2.34.1