blob: 61f86515e332a475c5d48bd4ccc0dd3eddbe944a [file] [log] [blame]
Orion Hodsonf96c9162021-04-07 10:43:01 +01001/*
2 * Copyright (C) 2021 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#ifndef ART_ODREFRESH_ODR_FS_UTILS_H_
18#define ART_ODREFRESH_ODR_FS_UTILS_H_
19
20#include <cstdint>
21#include <iosfwd>
22
23#include <android-base/macros.h>
24
25namespace art {
26namespace odrefresh {
27
Alan Stokes2c966732021-07-02 12:04:15 +010028// Removes the directory at `dir_path`, first removing all files and sub-directories in it.
Orion Hodsonf96c9162021-04-07 10:43:01 +010029// Returns true on success, false otherwise.
Alan Stokes2c966732021-07-02 12:04:15 +010030WARN_UNUSED bool RemoveDirectory(const std::string& dir_path);
Orion Hodsonf96c9162021-04-07 10:43:01 +010031
32// Create all directories on `absolute_dir_path`.
33// Returns true on success, false otherwise.
34WARN_UNUSED bool EnsureDirectoryExists(const std::string& absolute_dir_path);
35
36// Get free space for filesystem containing `path`.
37// Returns true on success, false otherwise.
38WARN_UNUSED bool GetFreeSpace(const std::string& path, uint64_t* bytes);
39
40// Gets space used under directory `dir_path`.
41// Returns true on success, false otherwise.
42WARN_UNUSED bool GetUsedSpace(const std::string& dir_path, uint64_t* bytes);
43
44} // namespace odrefresh
45} // namespace art
46
47#endif // ART_ODREFRESH_ODR_FS_UTILS_H_