Lines Matching +full:- +full:- +full:base +full:- +full:directory
2 // Use of this source code is governed by a BSD-style license that can be
12 #include <base/files/file_path.h>
13 #include <base/files/scoped_file.h>
26 BRILLO_EXPORT bool TouchFile(const base::FilePath& path,
35 BRILLO_EXPORT bool TouchFile(const base::FilePath& path);
37 // Opens the absolute |path| to a regular file or directory ensuring that none
39 // relative, or contains any symbolic links, or points to a non-regular file or
40 // directory, an invalid FD is returned instead. |mode| is ignored unless
45 // path - An absolute path of the file to open
46 // flags - Flags to pass to open.
47 // mode - Mode to pass to open.
48 BRILLO_EXPORT base::ScopedFD OpenSafely(const base::FilePath& path,
52 // Opens the |path| relative to the |parent_fd| to a regular file or directory
54 // FD. If |path| contains any symbolic links, or points to a non-regular file or
55 // directory, an invalid FD is returned instead. |mode| is ignored unless
60 // parent_fd - The file descriptor of the parent directory
61 // path - An absolute path of the file to open
62 // flags - Flags to pass to open.
63 // mode - Mode to pass to open.
64 BRILLO_EXPORT base::ScopedFD OpenAtSafely(int parent_fd,
65 const base::FilePath& path,
71 // symbolic links, or points to a non-regular file or directory, an invalid FD
76 // path - An absolute path of the file to open
77 // flags - Flags to pass to open.
78 // mode - Mode to pass to open.
79 BRILLO_EXPORT base::ScopedFD OpenFifoSafely(const base::FilePath& path,
89 // full_path - An absolute path of the directory to create and open.
90 BRILLO_EXPORT base::ScopedFD MkdirRecursively(const base::FilePath& full_path,
98 // path - Path of the file to write
99 // blob/data - blob/string/array to populate from
100 // (size - array size)
101 BRILLO_EXPORT bool WriteStringToFile(const base::FilePath& path,
103 BRILLO_EXPORT bool WriteToFile(const base::FilePath& path,
107 BRILLO_EXPORT bool WriteBlobToFile(const base::FilePath& path, const T& blob) { in WriteBlobToFile()
112 // Calls fdatasync() on file if data_sync is true or fsync() on directory or
116 // path - File/directory to be sync'ed
117 // is_directory - True if |path| is a directory
118 // data_sync - True if |path| does not need metadata to be synced
119 BRILLO_EXPORT bool SyncFileOrDirectory(const base::FilePath& path,
131 // path - Path of the file to write
132 // blob/data - blob/array to populate from
133 // (size - array size)
134 // mode - File permission bit-pattern, eg. 0644 for rw-r--r--
135 BRILLO_EXPORT bool WriteToFileAtomic(const base::FilePath& path,
140 BRILLO_EXPORT bool WriteBlobToFileAtomic(const base::FilePath& path, in WriteBlobToFileAtomic()
147 // ComputeDirectoryDiskUsage() is similar to base::ComputeDirectorySize() in
149 // In another word, ComputeDirectoryDiskUsage() behaves like "du -s
150 // --apparent-size", and ComputeDirectorySize() behaves like "du -s". The
156 // - This function recursively processes directory down the tree, so disk space
158 // - Symbolic links will not be followed (the size of link itself is counted,
160 // - Hidden files are counted as well.
163 // - This function doesn't care about filesystem boundaries, so it'll cross
165 // directory.
166 // - Hard links will be treated like normal files, so they could be
167 // over-reported.
168 // - Directories that the current user doesn't have permission to list/stat will
170 // under-reported without error in the returned value.
171 // - Deduplication (should the filesystem support it) is ignored, and the result
172 // could be over-reported.
173 // - Doesn't check if |root_path| exists, a non-existent directory will results
175 // - There are no limit on the depth of file system tree, the program will crash
177 // - If the directory is modified during this function call, there's no
181 // - Non-POSIX system is not supported.
182 // - Disk space used by directory (and its subdirectories) itself is counted.
185 // root_path - The directory to compute the size for
187 ComputeDirectoryDiskUsage(const base::FilePath& root_path);