Skip to content

Commit

Permalink
fs_mgr: support reading fstab file from /odm or /vendor partition
Browse files Browse the repository at this point in the history
fstab contains device- and soc- specific content that should reside in
/odm or /vendor partition. This change searches the fstab.${ro.hardware}
file from /odm/etc, /vendor/etc and /, then use the first one found.

Bug: 35811655
Test: boot sailfish
Change-Id: I82f89b41a849faedb64072a7cfc52d7424e1aaa1
  • Loading branch information
bowgotsai committed Mar 9, 2017
1 parent 47d3427 commit 46c6dc1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 8 additions & 3 deletions fs_mgr/fs_mgr_fstab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,16 +636,21 @@ struct fstab *fs_mgr_read_fstab_with_dt(const char *fstab_path)
return in_place_merge(fstab_dt, fstab);
}

/* combines fstab entries passed in from device tree with
* the ones found in /fstab.<hardware>
/*
* tries to load default fstab.<hardware> file from /odm/etc, /vendor/etc
* or /. loads the first one found and also combines fstab entries passed
* in from device tree.
*/
struct fstab *fs_mgr_read_fstab_default()
{
std::string hw;
std::string default_fstab;

if (fs_mgr_get_boot_config("hardware", &hw)) {
default_fstab = FSTAB_PREFIX + hw;
for (const char *prefix : {"/odm/etc/fstab.","/vendor/etc/fstab.", "/fstab."}) {
default_fstab = prefix + hw;
if (access(default_fstab.c_str(), F_OK) == 0) break;
}
} else {
LWARNING << __FUNCTION__ << "(): failed to find device hardware name";
}
Expand Down
2 changes: 0 additions & 2 deletions fs_mgr/fs_mgr_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
#define PWARNING PLOG(WARNING) << FS_MGR_TAG
#define PERROR PLOG(ERROR) << FS_MGR_TAG

const std::string FSTAB_PREFIX("/fstab.");

__BEGIN_DECLS

#define CRYPTO_TMPFS_OPTIONS "size=256m,mode=0771,uid=1000,gid=1000"
Expand Down

0 comments on commit 46c6dc1

Please sign in to comment.