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

Commit ddf03be2 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "fs_config: add product and product_services to the scanning."

parents a64e9e84 757658c7
Loading
Loading
Loading
Loading
+20 −8
Original line number Diff line number Diff line
@@ -108,7 +108,9 @@ static const char sys_conf_file[] = "/system/etc/fs_config_files";
// although the developer is advised to restrict the scope to the /vendor or
// oem/ file-system since the intent is to provide support for customized
// portions of a separate vendor.img or oem.img.  Has to remain open so that
// customization can also land on /system/vendor, /system/oem or /system/odm.
// customization can also land on /system/vendor, /system/oem, /system/odm,
// /system/product or /system/product_services.
//
// We expect build-time checking or filtering when constructing the associated
// fs_config_* files (see build/tools/fs_config/fs_config_generate.c)
static const char ven_conf_dir[] = "/vendor/etc/fs_config_dirs";
@@ -117,11 +119,17 @@ static const char oem_conf_dir[] = "/oem/etc/fs_config_dirs";
static const char oem_conf_file[] = "/oem/etc/fs_config_files";
static const char odm_conf_dir[] = "/odm/etc/fs_config_dirs";
static const char odm_conf_file[] = "/odm/etc/fs_config_files";
static const char product_conf_dir[] = "/product/etc/fs_config_dirs";
static const char product_conf_file[] = "/product/etc/fs_config_files";
static const char product_services_conf_dir[] = "/product_services/etc/fs_config_dirs";
static const char product_services_conf_file[] = "/product_services/etc/fs_config_files";
static const char* conf[][2] = {
        {sys_conf_file, sys_conf_dir},
        {ven_conf_file, ven_conf_dir},
        {oem_conf_file, oem_conf_dir},
        {odm_conf_file, odm_conf_dir},
        {product_conf_file, product_conf_dir},
        {product_services_conf_file, product_services_conf_dir},
};

// Do not use android_files to grant Linux capabilities.  Use ambient capabilities in their
@@ -150,7 +158,11 @@ static const struct fs_path_config android_files[] = {
    { 00444, AID_ROOT,      AID_ROOT,      0, oem_conf_dir + 1 },
    { 00444, AID_ROOT,      AID_ROOT,      0, oem_conf_file + 1 },
    { 00600, AID_ROOT,      AID_ROOT,      0, "product/build.prop" },
    { 00444, AID_ROOT,      AID_ROOT,      0, product_conf_dir + 1 },
    { 00444, AID_ROOT,      AID_ROOT,      0, product_conf_file + 1 },
    { 00600, AID_ROOT,      AID_ROOT,      0, "product_services/build.prop" },
    { 00444, AID_ROOT,      AID_ROOT,      0, product_services_conf_dir + 1 },
    { 00444, AID_ROOT,      AID_ROOT,      0, product_services_conf_file + 1 },
    { 00750, AID_ROOT,      AID_SHELL,     0, "sbin/fs_mgr" },
    { 00755, AID_ROOT,      AID_SHELL,     0, "system/bin/crash_dump32" },
    { 00755, AID_ROOT,      AID_SHELL,     0, "system/bin/crash_dump64" },
@@ -236,10 +248,10 @@ static int fs_config_open(int dir, int which, const char* target_out_path) {
    return fd;
}

// if path is "odm/<stuff>", "oem/<stuff>", "product/<stuff>" or
// "vendor/<stuff>"
// if path is "odm/<stuff>", "oem/<stuff>", "product/<stuff>",
// "product_services/<stuff>" or "vendor/<stuff>"
static bool is_partition(const char* path, size_t len) {
    static const char* partitions[] = {"odm/", "oem/", "product/", "vendor/"};
    static const char* partitions[] = {"odm/", "oem/", "product/", "product_services/", "vendor/"};
    for (size_t i = 0; i < (sizeof(partitions) / sizeof(partitions[0])); ++i) {
        size_t plen = strlen(partitions[i]);
        if (len <= plen) continue;