diff options
author | Benjamin Barenblat <bbaren@mit.edu> | 2016-02-21 20:14:05 -0500 |
---|---|---|
committer | Benjamin Barenblat <bbaren@mit.edu> | 2016-02-21 20:38:12 -0500 |
commit | 90c61f66909affa269dfb396f0e5cc67f4e4de44 (patch) | |
tree | cce220e2b634edac84352ec6a104dc03cb8a0a35 /src/posix_extras.h | |
parent | 273ed4f9042fbdb8fc4f8335638b09058bb5def0 (diff) |
Implement mkdir/rmdir
Diffstat (limited to 'src/posix_extras.h')
-rw-r--r-- | src/posix_extras.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/posix_extras.h b/src/posix_extras.h index f92bff7..41117f2 100644 --- a/src/posix_extras.h +++ b/src/posix_extras.h @@ -69,8 +69,12 @@ class File { // indeed be relative (i.e., it must not start with '/'). struct stat LinkStatAt(const char* path) const; - // Creates a file or directory at the path relative to the file descriptor. - // The path must indeed be relative (i.e., it must not start with '/'). + // Creates a directory at the path relative to the file descriptor. The path + // must indeed be relative (i.e., it must not start with '/'). + void MkDir(const char* path, mode_t mode) const; + + // Creates a file at the path relative to the file descriptor. The path must + // indeed be relative (i.e., it must not start with '/'). void MkNod(const char* path, mode_t mode, dev_t dev) const; // Calls openat(2) on the path relative to the file descriptor. The path must @@ -85,6 +89,10 @@ class File { // fewer bytes are returned. std::vector<std::uint8_t> Read(off_t, size_t) const; + // Removes the directory at the path relative to the file descriptor. The + // path must indeed be relative (i.e., it must not start with '/'). + void RmDirAt(const char* path) const; + // Removes the file at the path relative to the file descriptor. The path // must indeed be relative (i.e., it must not start with '/'). void UnlinkAt(const char* path) const; |