Merge "Pass stripe_width and stride parameters to mke2fs"
diff --git a/ext4_utils/Android.mk b/ext4_utils/Android.mk
index 6a5e75b..4287650 100644
--- a/ext4_utils/Android.mk
+++ b/ext4_utils/Android.mk
@@ -21,7 +21,7 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(libext4_utils_src_files)
-LOCAL_MODULE := libext4_utils_host
+LOCAL_MODULE := libext4_utils
# Various instances of dereferencing a type-punned pointer in extent.c
LOCAL_CFLAGS += -fno-strict-aliasing
LOCAL_C_INCLUDES := \
@@ -29,7 +29,7 @@
LOCAL_EXPORT_C_INCLUDE_DIRS := \
$(LOCAL_PATH)/include
LOCAL_STATIC_LIBRARIES := \
- libsparse_host
+ libsparse
LOCAL_STATIC_LIBRARIES_darwin += libselinux
LOCAL_STATIC_LIBRARIES_linux += libselinux
LOCAL_MODULE_HOST_OS := darwin linux windows
@@ -43,8 +43,8 @@
$(LOCAL_PATH)/include
LOCAL_SHARED_LIBRARIES += libcutils
LOCAL_STATIC_LIBRARIES += \
- libext4_utils_host \
- libsparse_host \
+ libext4_utils \
+ libsparse \
libz
LOCAL_LDLIBS_windows += -lws2_32
LOCAL_SHARED_LIBRARIES_darwin += libselinux
@@ -96,7 +96,7 @@
LOCAL_SRC_FILES := \
$(libext4_utils_src_files) \
ext4_crypt_init_extensions.cpp
-LOCAL_MODULE := libext4_utils_static
+LOCAL_MODULE := libext4_utils
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/include
# Various instances of dereferencing a type-punned pointer in extent.c
@@ -105,7 +105,7 @@
$(LOCAL_PATH)/include
LOCAL_STATIC_LIBRARIES := \
liblogwrap \
- libsparse_static \
+ libsparse \
libselinux \
libbase
include $(BUILD_STATIC_LIBRARY)
@@ -147,8 +147,8 @@
LOCAL_SRC_FILES := ext4fixup_main.c
LOCAL_MODULE := ext4fixup
LOCAL_STATIC_LIBRARIES += \
- libext4_utils_host \
- libsparse_host \
+ libext4_utils \
+ libsparse \
libz
include $(BUILD_HOST_EXECUTABLE)
diff --git a/f2fs_utils/Android.mk b/f2fs_utils/Android.mk
index 82c3ee0..f643ad2 100644
--- a/f2fs_utils/Android.mk
+++ b/f2fs_utils/Android.mk
@@ -8,7 +8,7 @@
LOCAL_MODULE := libf2fs_utils_host
LOCAL_SRC_FILES := f2fs_utils.c
LOCAL_STATIC_LIBRARIES := \
- libsparse_host \
+ libsparse \
libz
LOCAL_C_INCLUDES := external/f2fs-tools/include external/f2fs-tools/mkfs
LOCAL_CFLAGS := -Wno-unused-parameter
@@ -20,7 +20,7 @@
LOCAL_CFLAGS := -Wno-unused-parameter
LOCAL_STATIC_LIBRARIES := \
libselinux \
- libsparse_host \
+ libsparse \
libext2_uuid-host \
libz
LOCAL_MODULE := libf2fs_ioutils_host
@@ -44,7 +44,7 @@
LOCAL_STATIC_LIBRARIES := libf2fs_utils_host libf2fs_ioutils_host libf2fs_dlutils_host
LOCAL_REQUIRED_MODULES := libf2fs_fmt_host_dyn
LOCAL_STATIC_LIBRARIES += \
- libsparse_host \
+ libsparse \
libz
include $(BUILD_HOST_EXECUTABLE)
@@ -68,7 +68,7 @@
LOCAL_C_INCLUDES := external/f2fs-tools/include external/f2fs-tools/mkfs
LOCAL_CFLAGS := -Wno-unused-parameter
LOCAL_STATIC_LIBRARIES := \
- libsparse_static
+ libsparse
include $(BUILD_STATIC_LIBRARY)
endif
diff --git a/libfec/Android.mk b/libfec/Android.mk
index 0fbb778..47ac556 100644
--- a/libfec/Android.mk
+++ b/libfec/Android.mk
@@ -6,8 +6,7 @@
common_c_includes := \
$(LOCAL_PATH)/include \
- external/fec \
- system/extras/squashfs_utils
+ external/fec
common_src_files := \
fec_open.cpp \
@@ -16,10 +15,13 @@
fec_process.cpp
common_static_libraries := \
+ libext4_utils \
+ libfec_rs \
+ libsquashfs_utils \
libcrypto_utils \
libcrypto \
libcutils \
- libbase
+ libbase \
include $(CLEAR_VARS)
LOCAL_CFLAGS := $(common_cflags)
@@ -29,12 +31,7 @@
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_MODULE := libfec
LOCAL_SRC_FILES := $(common_src_files)
-LOCAL_STATIC_LIBRARIES := \
- libfec_rs \
- libext4_utils_static \
- libsquashfs_utils \
- libcutils \
- $(common_static_libraries)
+LOCAL_STATIC_LIBRARIES := $(common_static_libraries)
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
@@ -47,11 +44,7 @@
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_MODULE := libfec
LOCAL_SRC_FILES := $(common_src_files)
-LOCAL_STATIC_LIBRARIES := \
- libfec_rs_host \
- libext4_utils_host \
- libsquashfs_utils_host \
- $(common_static_libraries)
+LOCAL_STATIC_LIBRARIES := $(common_static_libraries)
include $(BUILD_HOST_STATIC_LIBRARY)
include $(LOCAL_PATH)/test/Android.mk
diff --git a/libfec/test/Android.mk b/libfec/test/Android.mk
index 4c87241..56a6978 100644
--- a/libfec/test/Android.mk
+++ b/libfec/test/Android.mk
@@ -10,11 +10,11 @@
LOCAL_MODULE_TAGS := optional
LOCAL_STATIC_LIBRARIES := \
libfec \
- libfec_rs_host \
+ libfec_rs \
libcrypto_utils \
libcrypto \
- libext4_utils_host \
- libsquashfs_utils_host \
+ libext4_utils \
+ libsquashfs_utils \
libbase
LOCAL_CFLAGS := -Wall -Werror -D_GNU_SOURCE
include $(BUILD_HOST_EXECUTABLE)
@@ -25,7 +25,7 @@
LOCAL_MODULE := fec_test_rs
LOCAL_SRC_FILES := test_rs.c
LOCAL_MODULE_TAGS := optional
-LOCAL_STATIC_LIBRARIES := libfec_rs_host
+LOCAL_STATIC_LIBRARIES := libfec_rs
LOCAL_CFLAGS := -Wall -Werror -D_GNU_SOURCE
LOCAL_C_INCLUDES += external/fec
include $(BUILD_HOST_EXECUTABLE)
diff --git a/memtrack/memtrack.cpp b/memtrack/memtrack.cpp
index f14e06d..8ff5c07 100644
--- a/memtrack/memtrack.cpp
+++ b/memtrack/memtrack.cpp
@@ -31,7 +31,7 @@
#include <algorithm>
#include <vector>
-#include <android/log.h>
+#include <log/log.h>
FileData::FileData(char *filename, char *buffer, size_t buffer_len)
: data_(buffer), max_(buffer_len), cur_idx_(0), len_(0),
diff --git a/simpleperf/cmd_record.cpp b/simpleperf/cmd_record.cpp
index eb968d7..b9dfff0 100644
--- a/simpleperf/cmd_record.cpp
+++ b/simpleperf/cmd_record.cpp
@@ -899,6 +899,7 @@
const std::vector<std::string>& args) {
// Read data section of perf.data to collect hit file information.
thread_tree_.ClearThreadAndMap();
+ Dso::ReadKernelSymbolsFromProc();
auto callback = [&](const Record* r) {
thread_tree_.Update(*r);
if (r->type() == PERF_RECORD_SAMPLE) {
diff --git a/simpleperf/cmd_record_test.cpp b/simpleperf/cmd_record_test.cpp
index 28e2e9b..35e871f 100644
--- a/simpleperf/cmd_record_test.cpp
+++ b/simpleperf/cmd_record_test.cpp
@@ -312,6 +312,32 @@
}
}
+TEST(record_cmd, dump_kernel_symbols) {
+ if (!IsRoot()) {
+ GTEST_LOG_(INFO) << "Test requires root privilege";
+ return;
+ }
+ system("echo 0 >/proc/sys/kernel/kptr_restrict");
+ TemporaryFile tmpfile;
+ ASSERT_TRUE(RunRecordCmd({"--dump-symbols", "-a", "-o", tmpfile.path, "sleep", "1"}));
+ std::unique_ptr<RecordFileReader> reader = RecordFileReader::CreateInstance(tmpfile.path);
+ ASSERT_TRUE(reader != nullptr);
+ std::map<int, SectionDesc> section_map = reader->FeatureSectionDescriptors();
+ ASSERT_NE(section_map.find(FEAT_FILE), section_map.end());
+ std::string file_path;
+ uint32_t file_type;
+ uint64_t min_vaddr;
+ std::vector<Symbol> symbols;
+ size_t read_pos = 0;
+ bool has_kernel_symbols = false;
+ while (reader->ReadFileFeature(read_pos, &file_path, &file_type, &min_vaddr, &symbols)) {
+ if (file_type == DSO_KERNEL && !symbols.empty()) {
+ has_kernel_symbols = true;
+ }
+ }
+ ASSERT_TRUE(has_kernel_symbols);
+}
+
TEST(record_cmd, group_option) {
ASSERT_TRUE(RunRecordCmd({"--group", "cpu-cycles,cpu-clock", "-m", "16"}));
ASSERT_TRUE(RunRecordCmd({"--group", "cpu-cycles,cpu-clock", "--group",
diff --git a/simpleperf/dso.cpp b/simpleperf/dso.cpp
index 9091584..351d88a 100644
--- a/simpleperf/dso.cpp
+++ b/simpleperf/dso.cpp
@@ -56,6 +56,7 @@
std::string Dso::symfs_dir_;
std::string Dso::vmlinux_;
std::string Dso::kallsyms_;
+bool Dso::read_kernel_symbols_from_proc_;
std::unordered_map<std::string, BuildId> Dso::build_id_map_;
size_t Dso::dso_count_;
uint32_t Dso::g_dump_id_;
@@ -175,6 +176,7 @@
symfs_dir_.clear();
vmlinux_.clear();
kallsyms_.clear();
+ read_kernel_symbols_from_proc_ = false;
build_id_map_.clear();
g_dump_id_ = 0;
}
@@ -362,18 +364,20 @@
symbols_.clear();
return false;
}
- } else if (!build_id.IsEmpty()) {
- // Try /proc/kallsyms only when build_id matches. Otherwise, it is likely to use
- // /proc/kallsyms on host for perf.data recorded on device.
- BuildId real_build_id;
- if (!GetKernelBuildId(&real_build_id)) {
- return false;
- }
- bool match = (build_id == real_build_id);
- if (!match) {
- LOG(WARNING) << "failed to read symbols from /proc/kallsyms: Build id "
- << "mismatch";
- return false;
+ } else if (read_kernel_symbols_from_proc_ || !build_id.IsEmpty()) {
+ // Try /proc/kallsyms only when asked to do so, or when build id matches.
+ // Otherwise, it is likely to use /proc/kallsyms on host for perf.data recorded on device.
+ if (!build_id.IsEmpty()) {
+ BuildId real_build_id;
+ if (!GetKernelBuildId(&real_build_id)) {
+ return false;
+ }
+ bool match = (build_id == real_build_id);
+ if (!match) {
+ LOG(WARNING) << "failed to read symbols from /proc/kallsyms: Build id "
+ << "mismatch";
+ return false;
+ }
}
std::string kallsyms;
diff --git a/simpleperf/dso.h b/simpleperf/dso.h
index 7102f0e..b742a9c 100644
--- a/simpleperf/dso.h
+++ b/simpleperf/dso.h
@@ -90,6 +90,9 @@
kallsyms_ = std::move(kallsyms);
}
}
+ static void ReadKernelSymbolsFromProc() {
+ read_kernel_symbols_from_proc_ = true;
+ }
static void SetBuildIds(
const std::vector<std::pair<std::string, BuildId>>& build_ids);
static BuildId FindExpectedBuildIdForPath(const std::string& path);
@@ -141,6 +144,7 @@
static std::string symfs_dir_;
static std::string vmlinux_;
static std::string kallsyms_;
+ static bool read_kernel_symbols_from_proc_;
static std::unordered_map<std::string, BuildId> build_id_map_;
static size_t dso_count_;
static uint32_t g_dump_id_;
diff --git a/squashfs_utils/Android.mk b/squashfs_utils/Android.mk
index d6f8edd..b80da09 100644
--- a/squashfs_utils/Android.mk
+++ b/squashfs_utils/Android.mk
@@ -6,6 +6,7 @@
LOCAL_SRC_FILES := squashfs_utils.c
LOCAL_STATIC_LIBRARIES := libcutils
LOCAL_C_INCLUDES := external/squashfs-tools/squashfs-tools
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
LOCAL_MODULE := libsquashfs_utils
include $(BUILD_STATIC_LIBRARY)
@@ -13,8 +14,9 @@
LOCAL_SRC_FILES := squashfs_utils.c
LOCAL_STATIC_LIBRARIES := libcutils
LOCAL_C_INCLUDES := external/squashfs-tools/squashfs-tools
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
LOCAL_CFLAGS := -Wall -Werror -D_GNU_SOURCE -DSQUASHFS_NO_KLOG
-LOCAL_MODULE := libsquashfs_utils_host
+LOCAL_MODULE := libsquashfs_utils
include $(BUILD_HOST_STATIC_LIBRARY)
include $(CLEAR_VARS)
diff --git a/tests/lib/testUtil/testUtil.c b/tests/lib/testUtil/testUtil.c
index 83dd946..791a2f7 100644
--- a/tests/lib/testUtil/testUtil.c
+++ b/tests/lib/testUtil/testUtil.c
@@ -29,7 +29,7 @@
#include <sys/wait.h>
#include <time.h>
-#include <android/log.h>
+#include <log/log.h>
#define ALEN(a) (sizeof(a) / sizeof((a)[0])) // Array length
typedef unsigned int bool_t;
diff --git a/verity/Android.mk b/verity/Android.mk
index c4a4d2c..c2ebd0f 100644
--- a/verity/Android.mk
+++ b/verity/Android.mk
@@ -47,12 +47,12 @@
LOCAL_SANITIZE := integer
LOCAL_STATIC_LIBRARIES := \
libfec \
- libfec_rs_host \
+ libfec_rs \
libcrypto_utils \
libcrypto \
- libext4_utils_host \
- libsparse_host \
- libsquashfs_utils_host \
+ libext4_utils \
+ libsparse \
+ libsquashfs_utils \
libbase \
libz
LOCAL_CFLAGS := -Wall -Werror
@@ -88,7 +88,7 @@
LOCAL_MODULE := build_verity_tree
LOCAL_SRC_FILES := build_verity_tree.cpp
LOCAL_MODULE_TAGS := optional
-LOCAL_STATIC_LIBRARIES := libsparse_host libz
+LOCAL_STATIC_LIBRARIES := libsparse libz
LOCAL_SHARED_LIBRARIES := libcrypto libbase
LOCAL_CFLAGS += -Wall -Werror
include $(BUILD_HOST_EXECUTABLE)
diff --git a/verity/fec/Android.mk b/verity/fec/Android.mk
index 7446971..8a35a7e 100644
--- a/verity/fec/Android.mk
+++ b/verity/fec/Android.mk
@@ -9,14 +9,14 @@
LOCAL_SRC_FILES := main.cpp image.cpp
LOCAL_MODULE_TAGS := optional
LOCAL_STATIC_LIBRARIES := \
- libsparse_host \
+ libsparse \
libz \
libcrypto_utils \
libcrypto \
libfec \
- libfec_rs_host \
- libext4_utils_host \
- libsquashfs_utils_host
+ libfec_rs \
+ libext4_utils \
+ libsquashfs_utils
LOCAL_SHARED_LIBRARIES := libbase
LOCAL_CFLAGS += -Wall -Werror -O3
LOCAL_C_INCLUDES += external/fec