Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49c21c29 authored by William Escande's avatar William Escande
Browse files

Move semaphore to osi scope only

There are no longer any direct usage of semaphore in the stack.
Demoting its visibility to be only available for osi.

Test: atest net_test_osi
Change-Id: If92f119d330d0d3bc25f1a02c7ba9322b098dff7
parent ceab092a
Loading
Loading
Loading
Loading
+22 −2
Original line number Diff line number Diff line
@@ -59,6 +59,12 @@ cc_library_static {
        "//packages/apps/Test/connectivity/sl4n",
        "//packages/modules/Bluetooth:__subpackages__",
    ],
    export_include_dirs: [
        "include",
    ],
    local_include_dirs: [
        "include_internal",
    ],
    defaults: ["fluoride_osi_defaults", "fluoride_basic_defaults"],
    // TODO(mcchou): Remove socket_utils sources after platform specific
    // dependencies are abstracted.
@@ -79,13 +85,15 @@ cc_library_static {
        "src/properties.cc",
        "src/reactor.cc",
        "src/ringbuffer.cc",
        "src/semaphore.cc",
        "src/socket.cc",
        "src/socket_utils/socket_local_client.cc",
        "src/socket_utils/socket_local_server.cc",
        "src/thread.cc",
        "src/thread_scheduler.cc",
        "src/wakelock.cc",

        // internal source that should not be used outside of libosi
        "src/internal/semaphore.cc",
    ],
    host_supported: true,
    // TODO(armansito): Setting _GNU_SOURCE isn't very platform-independent but
@@ -99,6 +107,9 @@ cc_library_static {
            ],
        },
    },
    cflags: [
        "-DLIB_OSI_INTERNAL",
    ],
    min_sdk_version: "Tiramisu",
    apex_available: [
        "com.android.btservices",
@@ -130,9 +141,11 @@ cc_test {
        "test/rand_test.cc",
        "test/reactor_test.cc",
        "test/ringbuffer_test.cc",
        "test/semaphore_test.cc",
        "test/thread_test.cc",
        "test/wakelock_test.cc",

        // test internal sources only used inside the libosi
        "test/internal/semaphore_test.cc",
    ],
    shared_libs: [
        "android.hardware.bluetooth@1.0",
@@ -143,6 +156,10 @@ cc_test {
        "libcutils",
        "libcrypto",
    ],
    local_include_dirs: [
        "include_internal",
        "test",
    ],
    static_libs: [
        "libbt-common",
        "libbt-protos-lite",
@@ -155,6 +172,9 @@ cc_test {
            cflags: ["-DOS_GENERIC"],
        },
    },
    cflags: [
        "-DLIB_OSI_INTERNAL",
    ],
    sanitize: {
        cfi: false,
    },
+17 −3
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ static_library("osi") {
    "src/properties.cc",
    "src/reactor.cc",
    "src/ringbuffer.cc",
    "src/semaphore.cc",
    "src/socket.cc",

    # TODO(mcchou): Remove these sources after platform specific
@@ -41,14 +40,22 @@ static_library("osi") {
    "src/socket_utils/socket_local_server.cc",
    "src/thread.cc",
    "src/wakelock.cc",

    # internal dependencies to not be used outside
    "src/internal/semaphore.cc",
  ]

  include_dirs = [
    "//bt/system/",
    "//bt/system/linux_include",
    "//bt/system/internal_include",
    "//bt/system/utils/include",
    "//bt/system/linux_include",
    "//bt/system/osi/include_internal",
    "//bt/system/stack/include",
    "//bt/system/utils/include",
  ]

  cflags = [
    "-DLIB_OSI_INTERNAL",
  ]

  deps = [
@@ -79,13 +86,20 @@ if (use.test) {
      "test/reactor_test.cc",
      "test/ringbuffer_test.cc",
      "test/thread_test.cc",

      "test/internal/semaphore_test.cc",
    ]

    include_dirs = [
      "//bt/system/",
      "//bt/system/osi/include_internal",
      "//bt/system/osi/test",
    ]

    cflags = [
      "-DLIB_OSI_INTERNAL",
    ]

    deps = [
      "//bt/system/osi",
    ]
+4 −0
Original line number Diff line number Diff line
@@ -18,6 +18,10 @@

#pragma once

#ifndef LIB_OSI_INTERNAL
#error "Please do not include this outside of osi."
#endif

#include <stdbool.h>

struct semaphore_t;
+1 −1
Original line number Diff line number Diff line
@@ -43,9 +43,9 @@
#include "osi/include/list.h"
#include "osi/include/log.h"
#include "osi/include/osi.h"
#include "osi/include/semaphore.h"
#include "osi/include/thread.h"
#include "osi/include/wakelock.h"
#include "osi/semaphore.h"
#include "stack/include/btu.h"

using base::Bind;
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@
#include "osi/include/list.h"
#include "osi/include/osi.h"
#include "osi/include/reactor.h"
#include "osi/include/semaphore.h"
#include "osi/semaphore.h"

typedef struct fixed_queue_t {
  list_t* list;
Loading