diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2025-01-17 22:45:03 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2025-01-23 14:54:07 +0100 |
commit | 06503dd0dfda6348b60dee4cf16054d84a25577a (patch) | |
tree | a1b66c47a15ea0704b549221ec9be6d13cfe7189 /src/basic/fileio.h | |
parent | fileio: make write_string_file_at() accept O_PATH fd and an empty filename (diff) | |
download | systemd-06503dd0dfda6348b60dee4cf16054d84a25577a.tar.xz systemd-06503dd0dfda6348b60dee4cf16054d84a25577a.zip |
fileio: make read_virtual_file_at() accept O_PATH file descriptor
Then, merge read_virtual_file_at() and read_virtual_file_fd(), and make
the latter inline.
Diffstat (limited to '')
-rw-r--r-- | src/basic/fileio.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/basic/fileio.h b/src/basic/fileio.h index 9139c03df4..49da9a677c 100644 --- a/src/basic/fileio.h +++ b/src/basic/fileio.h @@ -78,8 +78,10 @@ static inline int read_full_file(const char *filename, char **ret_contents, size return read_full_file_full(AT_FDCWD, filename, UINT64_MAX, SIZE_MAX, 0, NULL, ret_contents, ret_size); } -int read_virtual_file_fd(int fd, size_t max_size, char **ret_contents, size_t *ret_size); int read_virtual_file_at(int dir_fd, const char *filename, size_t max_size, char **ret_contents, size_t *ret_size); +static inline int read_virtual_file_fd(int fd, size_t max_size, char **ret_contents, size_t *ret_size) { + return read_virtual_file_at(fd, NULL, max_size, ret_contents, ret_size); +} static inline int read_virtual_file(const char *filename, size_t max_size, char **ret_contents, size_t *ret_size) { return read_virtual_file_at(AT_FDCWD, filename, max_size, ret_contents, ret_size); } |