fs-util: introduce open_parent() helper
We often open the parent directory of a path. Let's add a common helper for that, that shortens our code a bit and adds some extra safety checks, for example it will fail if used on the root directory (which doesn't really have a parent). The helper is actually generalized from a function in btrfs-util.[ch] which already existed for this purpose.
This commit is contained in:
@@ -103,3 +103,5 @@ void unlink_tempfilep(char (*p)[]);
|
||||
int unlinkat_deallocate(int fd, const char *name, int flags);
|
||||
|
||||
int fsync_directory_of_file(int fd);
|
||||
|
||||
int open_parent(const char *path, int flags, mode_t mode);
|
||||
|
||||
Reference in New Issue
Block a user