Merge "Workaround perdev_minors path change in Linux" am: d3870c5167 am: 5687befd86

am: 77e194d0b9

Change-Id: If0c043e387629312121dc7d4556c112dc5800201
This commit is contained in:
Pierre-Hugues Husson 2017-11-28 19:19:36 +00:00 committed by android-build-merger
commit 130a994f4f

View file

@ -51,7 +51,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;
@ -563,7 +564,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;
}