Risan | 8c9f332 | 2018-10-29 08:52:56 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "StubVolume.h" |
| 18 | |
| 19 | #include <android-base/logging.h> |
| 20 | #include <android-base/stringprintf.h> |
| 21 | |
| 22 | using android::base::StringPrintf; |
| 23 | |
| 24 | namespace android { |
| 25 | namespace vold { |
| 26 | |
| 27 | StubVolume::StubVolume(int id, const std::string& sourcePath, const std::string& mountPath, |
| 28 | const std::string& fsType, const std::string& fsUuid, |
| 29 | const std::string& fsLabel) |
| 30 | : VolumeBase(Type::kStub), |
| 31 | mSourcePath(sourcePath), |
| 32 | mMountPath(mountPath), |
| 33 | mFsType(fsType), |
| 34 | mFsUuid(fsUuid), |
| 35 | mFsLabel(fsLabel) { |
| 36 | setId(StringPrintf("stub:%d", id)); |
| 37 | } |
| 38 | |
| 39 | StubVolume::~StubVolume() {} |
| 40 | |
| 41 | status_t StubVolume::doCreate() { |
| 42 | return OK; |
| 43 | } |
| 44 | |
| 45 | status_t StubVolume::doDestroy() { |
| 46 | return OK; |
| 47 | } |
| 48 | |
| 49 | status_t StubVolume::doMount() { |
| 50 | auto listener = getListener(); |
| 51 | if (listener) listener->onVolumeMetadataChanged(getId(), mFsType, mFsUuid, mFsLabel); |
| 52 | setInternalPath(mSourcePath); |
| 53 | setPath(mMountPath); |
| 54 | return OK; |
| 55 | } |
| 56 | |
| 57 | status_t StubVolume::doUnmount() { |
| 58 | return OK; |
| 59 | } |
| 60 | |
| 61 | // TODO: return error instead. |
| 62 | status_t StubVolume::doFormat(const std::string& fsType) { |
| 63 | return OK; |
| 64 | } |
| 65 | |
| 66 | } // namespace vold |
| 67 | } // namespace android |