fs_mgr: Move libfiemap into libfs_mgr, and introduce libfs_mgr_binder.
This eliminates libfiemap as a standalone library and instead bundles it
into libfs_mgr. All consumers of libfiemap need libfs_mgr, and having
them tightly coupled reduces linkage complexity.
When to use libfs_mgr: In recovery, first-stage-init, or when libfiemap
or overlayfs is not used.
When to use libfs_mgr_binder: When not in recovery/first-stage init, and
overlayfs or libfiemap is needed. In this case, IImageManager will proxy
over binder to gsid.
Bug: 134949511
Test: builds, fiemap_writer/image_test passes.
Change-Id: I4c1a5698afdbf9b3bf87accec98254c1fb6f4e0e
diff --git a/fs_mgr/Android.bp b/fs_mgr/Android.bp
index eb737bb..34c64d2 100644
--- a/fs_mgr/Android.bp
+++ b/fs_mgr/Android.bp
@@ -26,14 +26,14 @@
],
}
-cc_library {
- // Do not ever allow this library to be vendor_available as a shared library.
- // It does not have a stable interface.
- name: "libfs_mgr",
+cc_defaults {
+ name: "libfs_mgr_defaults",
defaults: ["fs_mgr_defaults"],
- recovery_available: true,
export_include_dirs: ["include"],
include_dirs: ["system/vold"],
+ cflags: [
+ "-D_FILE_OFFSET_BITS=64",
+ ],
srcs: [
"file_wait.cpp",
"fs_mgr.cpp",
@@ -43,6 +43,7 @@
"fs_mgr_overlayfs.cpp",
"fs_mgr_roots.cpp",
"fs_mgr_vendor_overlay.cpp",
+ ":libfiemap_srcs",
],
shared_libs: [
"libbase",
@@ -88,6 +89,42 @@
],
},
},
+ header_libs: [
+ "libfiemap_headers",
+ ],
+ export_header_lib_headers: [
+ "libfiemap_headers",
+ ],
+}
+
+// Two variants of libfs_mgr are provided: libfs_mgr and libfs_mgr_binder.
+// Use libfs_mgr in recovery, first-stage-init, or when libfiemap or overlayfs
+// is not used.
+//
+// Use libfs_mgr_binder when not in recovery/first-stage init, or when overlayfs
+// or libfiemap is needed. In this case, libfiemap will proxy over binder to
+// gsid.
+cc_library {
+ // Do not ever allow this library to be vendor_available as a shared library.
+ // It does not have a stable interface.
+ name: "libfs_mgr",
+ recovery_available: true,
+ defaults: [
+ "libfs_mgr_defaults",
+ ],
+ srcs: [
+ ":libfiemap_passthrough_srcs",
+ ],
+}
+
+cc_library {
+ // Do not ever allow this library to be vendor_available as a shared library.
+ // It does not have a stable interface.
+ name: "libfs_mgr_binder",
+ defaults: [
+ "libfs_mgr_defaults",
+ "libfiemap_binder_defaults",
+ ],
}
cc_library_static {
diff --git a/fs_mgr/libfiemap/Android.bp b/fs_mgr/libfiemap/Android.bp
index 8dbbf4c..fdc1583 100644
--- a/fs_mgr/libfiemap/Android.bp
+++ b/fs_mgr/libfiemap/Android.bp
@@ -20,15 +20,8 @@
export_include_dirs: ["include"],
}
-cc_defaults {
- name: "libfiemap_defaults",
- defaults: ["fs_mgr_defaults"],
- cflags: [
- "-D_FILE_OFFSET_BITS=64",
- "-Wall",
- "-Werror",
- ],
-
+filegroup {
+ name: "libfiemap_srcs",
srcs: [
"fiemap_writer.cpp",
"image_manager.cpp",
@@ -36,55 +29,32 @@
"split_fiemap_writer.cpp",
"utility.cpp",
],
-
- static_libs: [
- "libdm",
- "libext2_uuid",
- "libext4_utils",
- "liblp",
- "libfs_mgr",
- ],
-
- shared_libs: [
- "libbase",
- ],
-
- header_libs: [
- "libfiemap_headers",
- "liblog_headers",
- ],
-
- export_shared_lib_headers: [
- "libbase",
- ],
-
- export_header_lib_headers: [
- "libfiemap_headers",
- ],
}
-// Open up a binder IImageManager interface.
-cc_library_static {
- name: "libfiemap_binder",
- defaults: ["libfiemap_defaults"],
+filegroup {
+ name: "libfiemap_binder_srcs",
srcs: [
"binder.cpp",
],
+}
+
+cc_defaults {
+ name: "libfiemap_binder_defaults",
+ srcs: [":libfiemap_binder_srcs"],
whole_static_libs: [
"gsi_aidl_interface-cpp",
"libgsi",
],
shared_libs: [
"libbinder",
+ "libutils",
],
}
// Open up a passthrough IImageManager interface. Use libfiemap_binder whenever
// possible. This should only be used when binder is not available.
-cc_library_static {
- name: "libfiemap_passthrough",
- defaults: ["libfiemap_defaults"],
- recovery_available: true,
+filegroup {
+ name: "libfiemap_passthrough_srcs",
srcs: [
"passthrough.cpp",
],
@@ -92,10 +62,10 @@
cc_test {
name: "fiemap_writer_test",
- defaults: ["libfiemap_defaults"],
static_libs: [
"libbase",
"libdm",
+ "libfs_mgr",
"liblog",
],
@@ -112,7 +82,6 @@
cc_test {
name: "fiemap_image_test",
- defaults: ["libfiemap_defaults"],
static_libs: [
"libdm",
"libext4_utils",
@@ -120,6 +89,7 @@
"liblp",
],
shared_libs: [
+ "libbase",
"libcrypto",
"libcrypto_utils",
"libcutils",
diff --git a/fs_mgr/libsnapshot/Android.bp b/fs_mgr/libsnapshot/Android.bp
index 30d01a6..eadcecc 100644
--- a/fs_mgr/libsnapshot/Android.bp
+++ b/fs_mgr/libsnapshot/Android.bp
@@ -30,7 +30,6 @@
static_libs: [
"libcutils",
"libdm",
- "libfs_mgr",
"libfstab",
"liblp",
"update_metadata-protos",
@@ -93,8 +92,8 @@
"libsnapshot_hal_deps",
],
srcs: [":libsnapshot_sources"],
- whole_static_libs: [
- "libfiemap_binder",
+ static_libs: [
+ "libfs_mgr_binder"
],
}
@@ -103,8 +102,8 @@
defaults: ["libsnapshot_defaults"],
srcs: [":libsnapshot_sources"],
recovery_available: true,
- whole_static_libs: [
- "libfiemap_passthrough",
+ static_libs: [
+ "libfs_mgr",
],
}
@@ -116,8 +115,8 @@
],
srcs: [":libsnapshot_sources"],
recovery_available: true,
- whole_static_libs: [
- "libfiemap_passthrough",
+ static_libs: [
+ "libfs_mgr",
],
}
@@ -144,6 +143,7 @@
"libstorage_literals_headers",
],
static_libs: [
+ "libfs_mgr",
"libgtest",
"libgmock",
],
@@ -170,6 +170,7 @@
"android.hardware.boot@1.1",
"libfs_mgr",
"libgmock",
+ "libgsi",
"liblp",
"libsnapshot",
"libsnapshot_test_helpers",
@@ -189,7 +190,6 @@
static_libs: [
"libdm",
"libext2_uuid",
- "libfiemap_binder",
"libfstab",
"libsnapshot",
],
@@ -200,7 +200,7 @@
"libbinder",
"libbinderthreadstate",
"libext4_utils",
- "libfs_mgr",
+ "libfs_mgr_binder",
"libhidlbase",
"liblog",
"liblp",