diff options
author | Emmanuel Berthier <emmanuel.berthier@intel.com> | 2015-04-27 13:50:09 +0200 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2015-05-12 15:01:02 -0700 |
commit | 30cc3d72498326c77b75cdf02992211d31396b33 (patch) | |
tree | 40ce415f4fde96feea4aa55589a8afa8029d2c14 /init/builtins.cpp | |
parent | 4fba28671b7213010dbfe6ad88e9891cc4080c75 (diff) | |
download | core-30cc3d72498326c77b75cdf02992211d31396b33.tar.gz core-30cc3d72498326c77b75cdf02992211d31396b33.tar.bz2 core-30cc3d72498326c77b75cdf02992211d31396b33.zip |
Enable property expansion for insmod
Useful for dynamic kernel module location.
This permits to use init rule like:
insmod ${persist.modules.location}/<module_name>
Change-Id: If7479bdcb4e69ea7666f52a0075c785be025c2e9
Signed-off-by: Emmanuel Berthier <emmanuel.berthier@intel.com>
(cherry picked from commit ac41230cbc10bae95a049282238adb03605579c2)
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r-- | init/builtins.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index 4567b04b4..f59d1fe4f 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -58,7 +58,16 @@ extern "C" int init_module(void *, unsigned long, const char *); static int insmod(const char *filename, char *options) { std::string module; - if (!read_file(filename, &module)) { + char filename_val[PROP_VALUE_MAX]; + int ret; + + ret = expand_props(filename_val, filename, sizeof(filename_val)); + if (ret) { + ERROR("insmod: cannot expand '%s'\n", filename); + return -EINVAL; + } + + if (!read_file(filename_val, &module)) { return -1; } |