1 #ifndef _WIMLIB_FILE_IO_H
2 #define _WIMLIB_FILE_IO_H
7 /* Wrapper around a file descriptor that keeps track of offset (including in
8 * pipes, which don't support lseek()) and a cached flag that tells whether the
9 * file descriptor is a pipe or not. */
12 unsigned int is_pipe : 1;
17 full_read(struct filedes *fd, void *buf, size_t n);
20 full_pread(struct filedes *fd, void *buf, size_t nbyte, off_t offset);
23 full_write(struct filedes *fd, const void *buf, size_t n);
26 full_pwrite(struct filedes *fd, const void *buf, size_t count, off_t offset);
29 raw_pread(struct filedes *fd, void *buf, size_t nbyte, off_t offset);
32 raw_pwrite(struct filedes *fd, const void *buf, size_t count, off_t offset);
44 full_writev(struct filedes *fd, struct iovec *iov, int iovcnt);
51 filedes_seek(struct filedes *fd, off_t offset);
54 filedes_is_seekable(struct filedes *fd);
56 static inline void filedes_init(struct filedes *fd, int raw_fd)
63 static inline void filedes_invalidate(struct filedes *fd)
68 static inline void filedes_copy(struct filedes *dst, const struct filedes *src)
73 #define filedes_close(f) close((f)->fd)
76 filedes_valid(const struct filedes *fd)
81 #endif /* _WIMLIB_FILE_IO_H */