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

Commit 567c88ee authored by Yi-Yo Chiang's avatar Yi-Yo Chiang Committed by Automerger Merge Worker
Browse files

Merge changes Ib70a8498,I06f7450c into main am: d53c1a7b am: 974ed357 am:...

Merge changes Ib70a8498,I06f7450c into main am: d53c1a7b am: 974ed357 am: a26f48a7 am: f62cc296

Original change: https://android-review.googlesource.com/c/platform/system/core/+/2671361



Change-Id: Ic9003d5e8eea7dfc611d62413472915d39eaf353
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 381ab3a2 f62cc296
Loading
Loading
Loading
Loading
+0 −44
Original line number Original line Diff line number Diff line
@@ -60,7 +60,6 @@ cc_defaults {
    defaults: ["fs_mgr_defaults"],
    defaults: ["fs_mgr_defaults"],
    export_include_dirs: ["include"],
    export_include_dirs: ["include"],
    local_include_dirs: ["include/"],
    local_include_dirs: ["include/"],
    include_dirs: ["system/vold"],
    cflags: [
    cflags: [
        "-D_FILE_OFFSET_BITS=64",
        "-D_FILE_OFFSET_BITS=64",
    ],
    ],
@@ -90,8 +89,6 @@ cc_defaults {
    static_libs: [
    static_libs: [
        "libavb",
        "libavb",
        "libfs_avb",
        "libfs_avb",
        "libfstab",
        "libdm",
        "libgsi",
        "libgsi",
    ],
    ],
    export_static_lib_headers: [
    export_static_lib_headers: [
@@ -174,47 +171,6 @@ cc_library {
    ],
    ],
}
}


cc_library_static {
    // Do not ever make this a shared library as long as it is vendor_available.
    // It does not have a stable interface.
    name: "libfstab",
    vendor_available: true,
    ramdisk_available: true,
    vendor_ramdisk_available: true,
    recovery_available: true,
    apex_available: [
        "//apex_available:anyapex",
        "//apex_available:platform",
    ],
    host_supported: true,
    defaults: ["fs_mgr_defaults"],
    local_include_dirs: ["include/"],
    srcs: [
        "fs_mgr_fstab.cpp",
        "fs_mgr_boot_config.cpp",
        "fs_mgr_slotselect.cpp",
    ],
    target: {
        darwin: {
            enabled: false,
        },
        vendor: {
            cflags: [
                // Skipping entries in fstab should only be done in a system
                // process as the config file is in /system_ext.
                // Remove the op from the vendor variant.
                "-DNO_SKIP_MOUNT",
            ],
        },
    },
    export_include_dirs: ["include_fstab"],
    header_libs: [
        "libbase_headers",
        "libgsi_headers",
    ],
    min_sdk_version: "31",
}

cc_binary {
cc_binary {
    name: "remount",
    name: "remount",
    defaults: ["fs_mgr_defaults"],
    defaults: ["fs_mgr_defaults"],
+1 −13
Original line number Original line Diff line number Diff line
@@ -23,15 +23,7 @@
#include <fs_mgr.h>
#include <fs_mgr.h>
#include <fstab/fstab.h>
#include <fstab/fstab.h>


#include "fs_mgr_priv_boot_config.h"
#include "libfstab/fstab_priv.h"

/* The CHECK() in logging.h will use program invocation name as the tag.
 * Thus, the log will have prefix "init: " when libfs_mgr is statically
 * linked in the init process. This might be opaque when debugging.
 * Appends "in libfs_mgr" at the end of the abort message to explicitly
 * indicate the check happens in fs_mgr.
 */
#define FS_MGR_CHECK(x) CHECK(x) << "in libfs_mgr "


#define FS_MGR_TAG "[libfs_mgr] "
#define FS_MGR_TAG "[libfs_mgr] "


@@ -89,10 +81,7 @@
using namespace std::chrono_literals;
using namespace std::chrono_literals;


bool fs_mgr_set_blk_ro(const std::string& blockdev, bool readonly = true);
bool fs_mgr_set_blk_ro(const std::string& blockdev, bool readonly = true);
bool fs_mgr_update_for_slotselect(android::fs_mgr::Fstab* fstab);
bool fs_mgr_is_device_unlocked();
bool fs_mgr_is_device_unlocked();
const std::string& get_android_dt_dir();
bool is_dt_compatible();


bool fs_mgr_is_ext4(const std::string& blk_device);
bool fs_mgr_is_ext4(const std::string& blk_device);
bool fs_mgr_is_f2fs(const std::string& blk_device);
bool fs_mgr_is_f2fs(const std::string& blk_device);
@@ -104,7 +93,6 @@ namespace android {
namespace fs_mgr {
namespace fs_mgr {


bool UnmapDevice(const std::string& name);
bool UnmapDevice(const std::string& name);
bool InRecovery();


struct OverlayfsCheckResult {
struct OverlayfsCheckResult {
    bool supported;
    bool supported;

fs_mgr/include_fstab

0 → 120000
+1 −0
Original line number Original line Diff line number Diff line
libfstab/include
 No newline at end of file
+62 −0
Original line number Original line Diff line number Diff line
//
// Copyright (C) 2023 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

package {
    default_applicable_licenses: [
        "Android-Apache-2.0",
        "system_core_fs_mgr_license",
    ],
}

cc_library_static {
    // Do not ever make this a shared library as long as it is vendor_available.
    // It does not have a stable interface.
    name: "libfstab",
    vendor_available: true,
    ramdisk_available: true,
    vendor_ramdisk_available: true,
    recovery_available: true,
    host_supported: true,
    defaults: ["fs_mgr_defaults"],
    export_include_dirs: ["include"],
    header_libs: [
        "libbase_headers",
        "libgsi_headers",
    ],
    srcs: [
        "fstab.cpp",
        "boot_config.cpp",
        "slotselect.cpp",
    ],
    target: {
        darwin: {
            enabled: false,
        },
        vendor: {
            cflags: [
                // Skipping entries in fstab should only be done in a system
                // process as the config file is in /system_ext.
                // Remove the op from the vendor variant.
                "-DNO_SKIP_MOUNT",
            ],
        },
    },
    apex_available: [
        "//apex_available:anyapex",
        "//apex_available:platform",
    ],
    min_sdk_version: "31",
}
+6 −5
Original line number Original line Diff line number Diff line
@@ -20,11 +20,12 @@
#include <vector>
#include <vector>


#include <android-base/file.h>
#include <android-base/file.h>
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include <android-base/strings.h>
#include <android-base/properties.h>


#include "fs_mgr_priv.h"
#include "fstab_priv.h"
#include "logging_macros.h"


std::vector<std::pair<std::string, std::string>> fs_mgr_parse_cmdline(const std::string& cmdline) {
std::vector<std::pair<std::string, std::string>> fs_mgr_parse_cmdline(const std::string& cmdline) {
    static constexpr char quote = '"';
    static constexpr char quote = '"';
@@ -84,7 +85,7 @@ std::vector<std::pair<std::string, std::string>> fs_mgr_parse_proc_bootconfig(


bool fs_mgr_get_boot_config_from_bootconfig(const std::string& bootconfig,
bool fs_mgr_get_boot_config_from_bootconfig(const std::string& bootconfig,
                                            const std::string& android_key, std::string* out_val) {
                                            const std::string& android_key, std::string* out_val) {
    FS_MGR_CHECK(out_val != nullptr);
    FSTAB_CHECK(out_val != nullptr);


    const std::string bootconfig_key("androidboot." + android_key);
    const std::string bootconfig_key("androidboot." + android_key);
    for (const auto& [key, value] : fs_mgr_parse_proc_bootconfig(bootconfig)) {
    for (const auto& [key, value] : fs_mgr_parse_proc_bootconfig(bootconfig)) {
@@ -100,7 +101,7 @@ bool fs_mgr_get_boot_config_from_bootconfig(const std::string& bootconfig,


bool fs_mgr_get_boot_config_from_kernel(const std::string& cmdline, const std::string& android_key,
bool fs_mgr_get_boot_config_from_kernel(const std::string& cmdline, const std::string& android_key,
                                        std::string* out_val) {
                                        std::string* out_val) {
    FS_MGR_CHECK(out_val != nullptr);
    FSTAB_CHECK(out_val != nullptr);


    const std::string cmdline_key("androidboot." + android_key);
    const std::string cmdline_key("androidboot." + android_key);
    for (const auto& [key, value] : fs_mgr_parse_cmdline(cmdline)) {
    for (const auto& [key, value] : fs_mgr_parse_cmdline(cmdline)) {
@@ -140,7 +141,7 @@ bool fs_mgr_get_boot_config_from_kernel_cmdline(const std::string& key, std::str
// kernel cmdline (in that order).  Returns 'true' if successfully
// kernel cmdline (in that order).  Returns 'true' if successfully
// found, 'false' otherwise.
// found, 'false' otherwise.
bool fs_mgr_get_boot_config(const std::string& key, std::string* out_val) {
bool fs_mgr_get_boot_config(const std::string& key, std::string* out_val) {
    FS_MGR_CHECK(out_val != nullptr);
    FSTAB_CHECK(out_val != nullptr);


    // firstly, check the device tree
    // firstly, check the device tree
    if (is_dt_compatible()) {
    if (is_dt_compatible()) {
Loading