Refer to https://en.wikipedia.org/wiki/Universal_Disk_Format.
}
status_t Mount(const std::string& source, const std::string& target,
- int ownerUid, int ownerGid ) {
- int rc;
+ int ownerUid, int ownerGid, const char* type) {
unsigned long flags;
char mountData[256];
snprintf(mountData, sizeof(mountData),
"utf8,uid=%d,gid=%d", ownerUid, ownerGid);
- rc = mount(c_source, c_target, "iso9660", flags, mountData);
- if (rc != 0) {
- rc = mount(c_source, c_target, "udf", flags, mountData);
- }
-
- return rc;
+ return mount(c_source, c_target, type, flags, mountData);
}
} // namespace iso9660
bool IsSupported();
status_t Mount(const std::string& source, const std::string& target,
- int ownerUid, int ownerGid );
+ int ownerUid, int ownerGid, const char* type);
} // namespace iso9660
} // namespace vold
std::string fsType, unused;
if (ReadMetadataUntrusted(mDevPath, &fsType, &unused, &unused) == OK) {
- if (fsType == "iso9660") {
- LOG(INFO) << "Detect iso9660";
+ if (fsType == "iso9660" || fsType == "udf") {
+ LOG(INFO) << "Detect " << fsType;
createPublicVolume(mDevice);
res = OK;
}
}
switch (type) {
+ case 0x00: // ISO9660
case 0x06: // FAT16
case 0x07: // HPFS/NTFS/exFAT
case 0x0b: // W95 FAT32 (LBA)
status_t res = ReadMetadataUntrusted(mDevPath, &mFsType, &mFsUuid, &mFsLabel);
// iso9660 has no UUID, we use label as UUID
- if (mFsType == "iso9660" && mFsUuid.empty() && !mFsLabel.empty()) {
+ if ((mFsType == "iso9660" || mFsType == "udf") && mFsUuid.empty() && !mFsLabel.empty()) {
std::replace(mFsLabel.begin(), mFsLabel.end(), ' ', '_');
mFsUuid = mFsLabel;
}
ret = ntfs::Check(mDevPath);
} else if (mFsType == "vfat") {
ret = vfat::Check(mDevPath);
- } else if (mFsType != "iso9660") {
+ } else if (mFsType != "iso9660" && mFsType != "udf") {
LOG(WARNING) << getId() << " unsupported filesystem check, skipping";
}
if (ret) {
false, true);
} else if (mFsType == "f2fs") {
ret = f2fs::Mount(mDevPath, mRawPath, mMntOpts, false, true);
- } else if (mFsType == "iso9660") {
- ret = iso9660::Mount(mDevPath, mRawPath, AID_MEDIA_RW, AID_MEDIA_RW);
+ } else if (mFsType == "iso9660" || mFsType == "udf") {
+ ret = iso9660::Mount(mDevPath, mRawPath,
+ AID_MEDIA_RW, AID_MEDIA_RW, mFsType.c_str());
} else if (mFsType == "ntfs") {
ret = ntfs::Mount(mDevPath, mRawPath, AID_MEDIA_RW, AID_MEDIA_RW, 0007);
} else if (mFsType == "vfat") {