Loading services/incremental/BinderIncrementalService.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -255,13 +255,12 @@ binder::Status BinderIncrementalService::unlink(int32_t storageId, const std::st binder::Status BinderIncrementalService::isFileFullyLoaded(int32_t storageId, const std::string& path, int32_t* _aidl_return) { *_aidl_return = mImpl.isFileFullyLoaded(storageId, path); *_aidl_return = (int)mImpl.isFileFullyLoaded(storageId, path); return ok(); } binder::Status BinderIncrementalService::isFullyLoaded(int32_t storageId, int32_t* _aidl_return) { *_aidl_return = mImpl.getLoadingProgress(storageId, /*stopOnFirstIncomplete=*/true) .blocksRemainingOrError(); *_aidl_return = (int)mImpl.isMountFullyLoaded(storageId); return ok(); } Loading services/incremental/IncrementalService.cpp +11 −16 Original line number Diff line number Diff line Loading @@ -1980,35 +1980,30 @@ int IncrementalService::setFileContent(const IfsMountPtr& ifs, const incfs::File return 0; } int IncrementalService::isFileFullyLoaded(StorageId storage, std::string_view filePath) const { incfs::LoadingState IncrementalService::isFileFullyLoaded(StorageId storage, std::string_view filePath) const { std::unique_lock l(mLock); const auto ifs = getIfsLocked(storage); if (!ifs) { LOG(ERROR) << "isFileFullyLoaded failed, invalid storageId: " << storage; return -EINVAL; return incfs::LoadingState(-EINVAL); } const auto storageInfo = ifs->storages.find(storage); if (storageInfo == ifs->storages.end()) { LOG(ERROR) << "isFileFullyLoaded failed, no storage: " << storage; return -EINVAL; return incfs::LoadingState(-EINVAL); } l.unlock(); return isFileFullyLoadedFromPath(*ifs, filePath); return mIncFs->isFileFullyLoaded(ifs->control, filePath); } int IncrementalService::isFileFullyLoadedFromPath(const IncFsMount& ifs, std::string_view filePath) const { const auto [filledBlocks, totalBlocks] = mIncFs->countFilledBlocks(ifs.control, filePath); if (filledBlocks < 0) { LOG(ERROR) << "isFileFullyLoadedFromPath failed to get filled blocks count for: " << filePath << " errno: " << filledBlocks; return filledBlocks; } if (totalBlocks < filledBlocks) { LOG(ERROR) << "isFileFullyLoadedFromPath failed to get total num of blocks"; return -EINVAL; incfs::LoadingState IncrementalService::isMountFullyLoaded(StorageId storage) const { const auto ifs = getIfs(storage); if (!ifs) { LOG(ERROR) << "isMountFullyLoaded failed, invalid storageId: " << storage; return incfs::LoadingState(-EINVAL); } return totalBlocks - filledBlocks; return mIncFs->isEverythingFullyLoaded(ifs->control); } IncrementalService::LoadingProgress IncrementalService::getLoadingProgress( Loading services/incremental/IncrementalService.h +2 −2 Original line number Diff line number Diff line Loading @@ -164,7 +164,8 @@ public: std::string_view newPath); int unlink(StorageId storage, std::string_view path); int isFileFullyLoaded(StorageId storage, std::string_view filePath) const; incfs::LoadingState isFileFullyLoaded(StorageId storage, std::string_view filePath) const; incfs::LoadingState isMountFullyLoaded(StorageId storage) const; LoadingProgress getLoadingProgress(StorageId storage, bool stopOnFirstIncomplete) const; Loading Loading @@ -412,7 +413,6 @@ private: int setStorageParams(IncFsMount& ifs, StorageId storageId, bool enableReadLogs); binder::Status applyStorageParams(IncFsMount& ifs, bool enableReadLogs); int isFileFullyLoadedFromPath(const IncFsMount& ifs, std::string_view filePath) const; LoadingProgress getLoadingProgressFromPath(const IncFsMount& ifs, std::string_view path, bool stopOnFirstIncomplete) const; Loading services/incremental/ServiceWrappers.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,13 @@ public: } return {filledBlockCount, totalBlocksCount}; } incfs::LoadingState isFileFullyLoaded(const Control& control, std::string_view path) const final { return incfs::isFullyLoaded(control, path); } incfs::LoadingState isEverythingFullyLoaded(const Control& control) const final { return incfs::isEverythingFullyLoaded(control); } ErrorCode link(const Control& control, std::string_view from, std::string_view to) const final { return incfs::link(control, from, to); } Loading services/incremental/ServiceWrappers.h +3 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,9 @@ public: virtual std::string toString(FileId fileId) const = 0; virtual std::pair<IncFsBlockIndex, IncFsBlockIndex> countFilledBlocks( const Control& control, std::string_view path) const = 0; virtual incfs::LoadingState isFileFullyLoaded(const Control& control, std::string_view path) const = 0; virtual incfs::LoadingState isEverythingFullyLoaded(const Control& control) const = 0; virtual ErrorCode link(const Control& control, std::string_view from, std::string_view to) const = 0; virtual ErrorCode unlink(const Control& control, std::string_view path) const = 0; Loading Loading
services/incremental/BinderIncrementalService.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -255,13 +255,12 @@ binder::Status BinderIncrementalService::unlink(int32_t storageId, const std::st binder::Status BinderIncrementalService::isFileFullyLoaded(int32_t storageId, const std::string& path, int32_t* _aidl_return) { *_aidl_return = mImpl.isFileFullyLoaded(storageId, path); *_aidl_return = (int)mImpl.isFileFullyLoaded(storageId, path); return ok(); } binder::Status BinderIncrementalService::isFullyLoaded(int32_t storageId, int32_t* _aidl_return) { *_aidl_return = mImpl.getLoadingProgress(storageId, /*stopOnFirstIncomplete=*/true) .blocksRemainingOrError(); *_aidl_return = (int)mImpl.isMountFullyLoaded(storageId); return ok(); } Loading
services/incremental/IncrementalService.cpp +11 −16 Original line number Diff line number Diff line Loading @@ -1980,35 +1980,30 @@ int IncrementalService::setFileContent(const IfsMountPtr& ifs, const incfs::File return 0; } int IncrementalService::isFileFullyLoaded(StorageId storage, std::string_view filePath) const { incfs::LoadingState IncrementalService::isFileFullyLoaded(StorageId storage, std::string_view filePath) const { std::unique_lock l(mLock); const auto ifs = getIfsLocked(storage); if (!ifs) { LOG(ERROR) << "isFileFullyLoaded failed, invalid storageId: " << storage; return -EINVAL; return incfs::LoadingState(-EINVAL); } const auto storageInfo = ifs->storages.find(storage); if (storageInfo == ifs->storages.end()) { LOG(ERROR) << "isFileFullyLoaded failed, no storage: " << storage; return -EINVAL; return incfs::LoadingState(-EINVAL); } l.unlock(); return isFileFullyLoadedFromPath(*ifs, filePath); return mIncFs->isFileFullyLoaded(ifs->control, filePath); } int IncrementalService::isFileFullyLoadedFromPath(const IncFsMount& ifs, std::string_view filePath) const { const auto [filledBlocks, totalBlocks] = mIncFs->countFilledBlocks(ifs.control, filePath); if (filledBlocks < 0) { LOG(ERROR) << "isFileFullyLoadedFromPath failed to get filled blocks count for: " << filePath << " errno: " << filledBlocks; return filledBlocks; } if (totalBlocks < filledBlocks) { LOG(ERROR) << "isFileFullyLoadedFromPath failed to get total num of blocks"; return -EINVAL; incfs::LoadingState IncrementalService::isMountFullyLoaded(StorageId storage) const { const auto ifs = getIfs(storage); if (!ifs) { LOG(ERROR) << "isMountFullyLoaded failed, invalid storageId: " << storage; return incfs::LoadingState(-EINVAL); } return totalBlocks - filledBlocks; return mIncFs->isEverythingFullyLoaded(ifs->control); } IncrementalService::LoadingProgress IncrementalService::getLoadingProgress( Loading
services/incremental/IncrementalService.h +2 −2 Original line number Diff line number Diff line Loading @@ -164,7 +164,8 @@ public: std::string_view newPath); int unlink(StorageId storage, std::string_view path); int isFileFullyLoaded(StorageId storage, std::string_view filePath) const; incfs::LoadingState isFileFullyLoaded(StorageId storage, std::string_view filePath) const; incfs::LoadingState isMountFullyLoaded(StorageId storage) const; LoadingProgress getLoadingProgress(StorageId storage, bool stopOnFirstIncomplete) const; Loading Loading @@ -412,7 +413,6 @@ private: int setStorageParams(IncFsMount& ifs, StorageId storageId, bool enableReadLogs); binder::Status applyStorageParams(IncFsMount& ifs, bool enableReadLogs); int isFileFullyLoadedFromPath(const IncFsMount& ifs, std::string_view filePath) const; LoadingProgress getLoadingProgressFromPath(const IncFsMount& ifs, std::string_view path, bool stopOnFirstIncomplete) const; Loading
services/incremental/ServiceWrappers.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,13 @@ public: } return {filledBlockCount, totalBlocksCount}; } incfs::LoadingState isFileFullyLoaded(const Control& control, std::string_view path) const final { return incfs::isFullyLoaded(control, path); } incfs::LoadingState isEverythingFullyLoaded(const Control& control) const final { return incfs::isEverythingFullyLoaded(control); } ErrorCode link(const Control& control, std::string_view from, std::string_view to) const final { return incfs::link(control, from, to); } Loading
services/incremental/ServiceWrappers.h +3 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,9 @@ public: virtual std::string toString(FileId fileId) const = 0; virtual std::pair<IncFsBlockIndex, IncFsBlockIndex> countFilledBlocks( const Control& control, std::string_view path) const = 0; virtual incfs::LoadingState isFileFullyLoaded(const Control& control, std::string_view path) const = 0; virtual incfs::LoadingState isEverythingFullyLoaded(const Control& control) const = 0; virtual ErrorCode link(const Control& control, std::string_view from, std::string_view to) const = 0; virtual ErrorCode unlink(const Control& control, std::string_view path) const = 0; Loading