public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: MengshiWu-mengshiw <noreply@github.com>
To: linux-bluetooth@vger.kernel.org
Subject: [bluez/bluez] 023e57: shared/util: Add MIN/MAX implementations
Date: Wed, 01 Apr 2026 08:05:13 -0700	[thread overview]
Message-ID: <bluez/bluez/push/refs/heads/master/f99562-0fd01e@github.com> (raw)

  Branch: refs/heads/master
  Home:   https://github.com/bluez/bluez
  Commit: 023e57342a0791b586e336fecce627ecb6a2e46f
      https://github.com/bluez/bluez/commit/023e57342a0791b586e336fecce627ecb6a2e46f
  Author: Bastien Nocera <hadess@hadess.net>
  Date:   2026-04-01 (Wed, 01 Apr 2026)

  Changed paths:
    M src/sdpd-request.c
    M src/shared/util.h

  Log Message:
  -----------
  shared/util: Add MIN/MAX implementations

And remove it from src/sdpd-request.c to avoid a redefinition warning
at compile-time.


  Commit: dbbfffe2c32338b96fb16def680852c3db62d2c9
      https://github.com/bluez/bluez/commit/dbbfffe2c32338b96fb16def680852c3db62d2c9
  Author: Bastien Nocera <hadess@hadess.net>
  Date:   2026-04-01 (Wed, 01 Apr 2026)

  Changed paths:
    M emulator/btdev.c

  Log Message:
  -----------
  emulator: Remove compile-time header only glib dep

btvirt relied on a glib header macro to use MIN/MAX, but didn't link
against it, meaning that it was dependent on other programs in the
project using glib to compile correctly.

Remove the include and use our own implementation instead.


  Commit: 0fd01e98cf94616a5c1c39749314cdd4a1654687
      https://github.com/bluez/bluez/commit/0fd01e98cf94616a5c1c39749314cdd4a1654687
  Author: Mengshi Wu <mengshi.wu@oss.qualcomm.com>
  Date:   2026-04-01 (Wed, 01 Apr 2026)

  Changed paths:
    M src/device.c

  Log Message:
  -----------
  src/device: Fix stored gatt cache DB Hash value not update

There is an asymmetry in behavior: when services are added during
the same connection (via Service Changed indication), the persistent
storage (disk) is not updated with the new DB hash, but when services
are removed, it is updated.

During the same connection, We check DB hash value stored at
/var/lib/bluetooth/<adaptor addr>/cache/<remote addr>.
When established connection, the stored DB Hash value is A.Then we
add new services, the stored DB Hash value is still A which should
change to B. However, if we remove the existing services, the stored
DB Hash value changed to C.

When performing addition, it goes like this:

discover_primary_cb()
  └─> gatt_db_insert_service()      ← NEW service inserted into db
        └─> gatt_service_added()    ← callback fires immediately
              └─> store_gatt_db()   ← SAVED TO DISK (hash still OLD)
  ...
  └─> discovery_op_complete(success=true)
        └─> read_db_hash(op)             ← sends ATT Read By Type
              └─> [ATT response arrives]
                    └─> db_hash_read_cb()
                          ├─> gatt_db_attribute_write(op->hash, ...)
                          │     └─> hash UPDATED IN MEMORY
                          └─> discovery_op_complete(true, 0)
                                ├─> [no services to remove, no
                                │    store_gatt_db called]
                                └─> service_changed_complete()

Whereas removal perform like this:
discovery_op_complete(success=true)  [1st call]
  └─> read_db_hash(op)
      └─> op->hash is NULL → sends ATT request → early return
...
[ATT response arrives]
db_hash_read_cb()
  └─> gatt_db_attribute_write(op->hash, ) ← hash UPDATED IN MEMORY
  └─> discovery_op_complete(true, 0)          [2nd call]
      └─> read_db_hash(op)  → op->hash already set → returns false
      └─> gatt_db_remove_service()
          └─> gatt_service_removed()
              └─> store_gatt_db() ← SAVED TO DISK (hash is NEW)

There is a timing issue to update DB Hash value.

The gatt_client_service_changed() callback in src/device.c is called
from service_changed_complete() in gatt-client.c, which is invoked
after db_hash_read_cb() has already updated the hash. Adding
store_gatt_db(device) here guarantees the db is persisted with the
correct, up-to-date hash for both the addition and removal cases.


Compare: https://github.com/bluez/bluez/compare/f99562ebea58...0fd01e98cf94

To unsubscribe from these emails, change your notification settings at https://github.com/bluez/bluez/settings/notifications

                 reply	other threads:[~2026-04-01 15:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bluez/bluez/push/refs/heads/master/f99562-0fd01e@github.com \
    --to=noreply@github.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox