diff mbox series

[BlueZ,v1,1/2] shared/ad: Add bt_ad_length

Message ID 20240515161250.1714375-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit 263d6f7da564f5bf6c89a2beb3cc0b950252f059
Headers show
Series [BlueZ,v1,1/2] shared/ad: Add bt_ad_length | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Luiz Augusto von Dentz May 15, 2024, 4:12 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds bt_ad_length which can be used to return the current size of
the bt_ad data.
---
 src/shared/ad.c | 11 ++++++++---
 src/shared/ad.h |  2 ++
 2 files changed, 10 insertions(+), 3 deletions(-)

Comments

patchwork-bot+bluetooth@kernel.org May 15, 2024, 5:40 p.m. UTC | #1
Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Wed, 15 May 2024 12:12:49 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This adds bt_ad_length which can be used to return the current size of
> the bt_ad data.
> ---
>  src/shared/ad.c | 11 ++++++++---
>  src/shared/ad.h |  2 ++
>  2 files changed, 10 insertions(+), 3 deletions(-)

Here is the summary with links:
  - [BlueZ,v1,1/2] shared/ad: Add bt_ad_length
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=263d6f7da564
  - [BlueZ,v1,2/2] advertising: Detect when EA needs to be used
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=ea242fbf8602

You are awesome, thank you!
bluez.test.bot@gmail.com May 15, 2024, 6:07 p.m. UTC | #2
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=853469

---Test result---

Test Summary:
CheckPatch                    PASS      0.76 seconds
GitLint                       PASS      0.53 seconds
BuildEll                      PASS      26.76 seconds
BluezMake                     PASS      1686.82 seconds
MakeCheck                     PASS      12.91 seconds
MakeDistcheck                 PASS      178.64 seconds
CheckValgrind                 PASS      247.58 seconds
CheckSmatch                   PASS      350.63 seconds
bluezmakeextell               PASS      118.55 seconds
IncrementalBuild              PASS      2981.30 seconds
ScanBuild                     PASS      982.69 seconds



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/src/shared/ad.c b/src/shared/ad.c
index f3fb428e25c6..d08ce7af9b85 100644
--- a/src/shared/ad.c
+++ b/src/shared/ad.c
@@ -520,9 +520,14 @@  static size_t data_length(struct queue *queue)
 	return length;
 }
 
-static size_t calculate_length(struct bt_ad *ad)
+size_t bt_ad_length(struct bt_ad *ad)
 {
-	size_t length = 0;
+	size_t length;
+
+	if (!ad)
+		return 0;
+
+	length = 0;
 
 	length += uuid_list_length(ad->service_uuids);
 
@@ -698,7 +703,7 @@  uint8_t *bt_ad_generate(struct bt_ad *ad, size_t *length)
 	if (!ad)
 		return NULL;
 
-	*length = calculate_length(ad);
+	*length = bt_ad_length(ad);
 
 	if (*length > ad->max_len)
 		return NULL;
diff --git a/src/shared/ad.h b/src/shared/ad.h
index 11900706f9ed..90cc82de9d63 100644
--- a/src/shared/ad.h
+++ b/src/shared/ad.h
@@ -108,6 +108,8 @@  struct bt_ad *bt_ad_ref(struct bt_ad *ad);
 
 void bt_ad_unref(struct bt_ad *ad);
 
+size_t bt_ad_length(struct bt_ad *ad);
+
 uint8_t *bt_ad_generate(struct bt_ad *ad, size_t *length);
 
 bool bt_ad_is_empty(struct bt_ad *ad);