Merge "Workaround perdev_minors path change in Linux"

am: d3870c5167

Change-Id: Ia7ec03a566f8c122dff05bcc3d996c05cf2b7771
This commit is contained in:
Pierre-Hugues Husson 2017-11-28 18:59:56 +00:00 committed by android-build-merger
commit 5687befd86

View file

@ -50,7 +50,8 @@ static const char* kSgdiskPath = "/system/bin/sgdisk";
static const char* kSgdiskToken = " \t\n";
static const char* kSysfsLoopMaxMinors = "/sys/module/loop/parameters/max_part";
static const char* kSysfsMmcMaxMinors = "/sys/module/mmcblk/parameters/perdev_minors";
static const char* kSysfsMmcMaxMinorsDeprecated = "/sys/module/mmcblk/parameters/perdev_minors";
static const char* kSysfsMmcMaxMinors = "/sys/module/mmc_block/parameters/perdev_minors";
static const unsigned int kMajorBlockLoop = 7;
static const unsigned int kMajorBlockScsiA = 8;
@ -566,7 +567,8 @@ int Disk::getMaxMinors() {
case kMajorBlockMmc: {
// Per Documentation/devices.txt this is dynamic
std::string tmp;
if (!ReadFileToString(kSysfsMmcMaxMinors, &tmp)) {
if (!ReadFileToString(kSysfsMmcMaxMinors, &tmp) &&
!ReadFileToString(kSysfsMmcMaxMinorsDeprecated, &tmp)) {
LOG(ERROR) << "Failed to read max minors";
return -errno;
}