From 757658c78da1cb7e23ee40e897f5ab6fb496f211 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Mon, 19 Nov 2018 11:17:35 -0800 Subject: [PATCH] fs_config: add product and product_services to the scanning. Test: compile Bug: 119310326 Change-Id: I67ba155e4a03731d402cdfcf06ca80ad0c4ab2ed --- libcutils/fs_config.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp index ee52f5e77..db59569f8 100644 --- a/libcutils/fs_config.cpp +++ b/libcutils/fs_config.cpp @@ -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}, + {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/", "oem/", "product/" or -// "vendor/" +// if path is "odm/", "oem/", "product/", +// "product_services/" or "vendor/" 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;