修訂 | f42ee2b4667f2410627d929e7b900b0bd797cb2d (tree) |
---|---|
時間 | 2022-03-14 05:42:11 |
作者 | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Mauro Rossi |
vold3: auto mount CDROM
Luo Chunbo's ISO9660 support (commit 133632d5) is not complete. Still
need to handle block devices with major number of CDROM.
@@ -104,6 +104,7 @@ static const std::string kEmptyString(""); | ||
104 | 104 | /* 512MiB is large enough for testing purposes */ |
105 | 105 | static const unsigned int kSizeVirtualDisk = 536870912; |
106 | 106 | |
107 | +static const unsigned int kMajorBlockCdrom = 11; | |
107 | 108 | static const unsigned int kMajorBlockMmc = 179; |
108 | 109 | |
109 | 110 | using ScanProcCallback = bool(*)(uid_t uid, pid_t pid, int nsFd, const char* name, void* params); |
@@ -236,6 +237,8 @@ void VolumeManager::handleBlockEvent(NetlinkEvent* evt) { | ||
236 | 237 | int flags = source->getFlags(); |
237 | 238 | if (major == kMajorBlockMmc || IsVirtioBlkDevice(major)) { |
238 | 239 | flags |= android::vold::Disk::Flags::kSd; |
240 | + } else if (major == kMajorBlockCdrom) { | |
241 | + flags |= android::vold::Disk::Flags::kCdrom; | |
239 | 242 | } else { |
240 | 243 | flags |= android::vold::Disk::Flags::kUsb; |
241 | 244 | } |
@@ -75,6 +75,7 @@ static const unsigned int kMajorBlockScsiP = 135; | ||
75 | 75 | static const unsigned int kMajorBlockMmc = 179; |
76 | 76 | static const unsigned int kMajorBlockDynamicMin = 234; |
77 | 77 | static const unsigned int kMajorBlockDynamicMax = 512; |
78 | +static const unsigned int kMajorBlockCdrom = 11; | |
78 | 79 | |
79 | 80 | static const char* kGptBasicData = "EBD0A0A2-B9E5-4433-87C0-68B6B72699C7"; |
80 | 81 | static const char* kGptAndroidMeta = "19A710A2-B3CA-11E4-B026-10604B889DCF"; |
@@ -250,6 +251,9 @@ status_t Disk::readMetadata() { | ||
250 | 251 | mLabel = "Virtual"; |
251 | 252 | break; |
252 | 253 | } |
254 | + case kMajorBlockCdrom: | |
255 | + LOG(DEBUG) << "Found a CDROM: " << mSysPath; | |
256 | + FALLTHROUGH_INTENDED; | |
253 | 257 | // clang-format off |
254 | 258 | case kMajorBlockScsiA: case kMajorBlockScsiB: case kMajorBlockScsiC: |
255 | 259 | case kMajorBlockScsiD: case kMajorBlockScsiE: case kMajorBlockScsiF: |
@@ -338,7 +342,7 @@ status_t Disk::readPartitions() { | ||
338 | 342 | cmd.push_back(mDevPath); |
339 | 343 | |
340 | 344 | std::vector<std::string> output; |
341 | - status_t res = ForkExecvp(cmd, &output); | |
345 | + status_t res = maxMinors ? ForkExecvp(cmd, &output) : ENODEV; | |
342 | 346 | if (res != OK) { |
343 | 347 | LOG(WARNING) << "sgdisk failed to scan " << mDevPath; |
344 | 348 |
@@ -599,6 +603,9 @@ int Disk::getMaxMinors() { | ||
599 | 603 | // Per Documentation/devices.txt this is static |
600 | 604 | return 15; |
601 | 605 | } |
606 | + case kMajorBlockCdrom: { | |
607 | + return 0; | |
608 | + } | |
602 | 609 | case kMajorBlockMmc: { |
603 | 610 | // Per Documentation/devices.txt this is dynamic |
604 | 611 | std::string tmp; |
@@ -58,6 +58,8 @@ class Disk { | ||
58 | 58 | kStub = 1 << 5, |
59 | 59 | /* Flag that disk is non-removable */ |
60 | 60 | kNonRemovable = 1 << 6, |
61 | + /* Flag that disk is CDROM */ | |
62 | + kCdrom = 1 << 7, | |
61 | 63 | }; |
62 | 64 | |
63 | 65 | const std::string& getId() const { return mId; } |
@@ -154,7 +154,7 @@ status_t PublicVolume::doMount() { | ||
154 | 154 | ret = ntfs::Check(mDevPath); |
155 | 155 | } else if (mFsType == "vfat") { |
156 | 156 | ret = vfat::Check(mDevPath); |
157 | - } else { | |
157 | + } else if (mFsType != "iso9660") { | |
158 | 158 | LOG(WARNING) << getId() << " unsupported filesystem check, skipping"; |
159 | 159 | } |
160 | 160 | if (ret) { |