Skip to content

Commit a0a7a71

Browse files
committed
common: tools: enhance fs platform interface with set user quota
This patch enhances the platform filesystem interface by adding a method to set user quota. Signed-off-by: Mykhailo Lohvynenko <[email protected]>
1 parent 9b33062 commit a0a7a71

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

include/aos/common/tools/fs.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ class FSPlatformItf {
6868
* @return RetWithError<size_t>.
6969
*/
7070
virtual RetWithError<size_t> GetAvailableSize(const String& dir) const = 0;
71+
72+
/**
73+
* Sets user quota for the given path.
74+
*
75+
* @param path path to set quota for.
76+
* @param quota quota size in bytes.
77+
* @param uid user ID.
78+
* @param gid group ID.
79+
* @return Error.
80+
*/
81+
virtual Error SetUserQuota(const String& path, size_t quota, size_t uid, size_t gid) const = 0;
7182
};
7283

7384
/**

tests/include/mocks/filesystemmock.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class FSPlatformMock : public fs::FSPlatformItf {
1818
MOCK_METHOD(RetWithError<size_t>, GetTotalSize, (const String& dir), (const, override));
1919
MOCK_METHOD(RetWithError<size_t>, GetDirSize, (const String& dir), (const, override));
2020
MOCK_METHOD(RetWithError<size_t>, GetAvailableSize, (const String& dir), (const, override));
21+
MOCK_METHOD(Error, SetUserQuota, (const String& path, size_t quota, size_t uid, size_t gid), (const, override));
2122
};
2223
} // namespace aos
2324

0 commit comments

Comments
 (0)