From 90c61f66909affa269dfb396f0e5cc67f4e4de44 Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Sun, 21 Feb 2016 20:14:05 -0500 Subject: Implement mkdir/rmdir --- src/posix_extras.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/posix_extras.h') 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 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; -- cgit v1.2.3