Changes in uspace/lib/bithenge/src/file.c [f77c1c9:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/bithenge/src/file.c
rf77c1c9 rb7fd2a0 63 63 } 64 64 65 static int file_size(bithenge_blob_t *base, aoff64_t *size)65 static errno_t file_size(bithenge_blob_t *base, aoff64_t *size) 66 66 { 67 67 file_blob_t *blob = blob_as_file(base); … … 70 70 } 71 71 72 static int file_read(bithenge_blob_t *base, aoff64_t offset, char *buffer,72 static errno_t file_read(bithenge_blob_t *base, aoff64_t offset, char *buffer, 73 73 aoff64_t *size) 74 74 { … … 78 78 79 79 size_t amount_read; 80 int rc = vfs_read(blob->fd, &offset, buffer, *size, &amount_read);80 errno_t rc = vfs_read(blob->fd, &offset, buffer, *size, &amount_read); 81 81 if (rc != EOK) 82 82 return errno; … … 98 98 }; 99 99 100 static int new_file_blob(bithenge_node_t **out, int fd, bool needs_close)100 static errno_t new_file_blob(bithenge_node_t **out, int fd, bool needs_close) 101 101 { 102 102 assert(out); 103 103 104 104 struct stat stat; 105 int rc = vfs_stat(fd, &stat);105 errno_t rc = vfs_stat(fd, &stat); 106 106 if (rc != EOK) { 107 107 if (needs_close) … … 141 141 * @param filename The name of the file. 142 142 * @return EOK on success or an error code from errno.h. */ 143 int bithenge_new_file_blob(bithenge_node_t **out, const char *filename)143 errno_t bithenge_new_file_blob(bithenge_node_t **out, const char *filename) 144 144 { 145 145 assert(filename); 146 146 147 147 int fd; 148 int rc = vfs_lookup_open(filename, WALK_REGULAR, MODE_READ, &fd);148 errno_t rc = vfs_lookup_open(filename, WALK_REGULAR, MODE_READ, &fd); 149 149 if (rc != EOK) 150 150 return rc; … … 158 158 * @param fd The file descriptor. 159 159 * @return EOK on success or an error code from errno.h. */ 160 int bithenge_new_file_blob_from_fd(bithenge_node_t **out, int fd)160 errno_t bithenge_new_file_blob_from_fd(bithenge_node_t **out, int fd) 161 161 { 162 162 return new_file_blob(out, fd, false); … … 168 168 * @param file The file pointer. 169 169 * @return EOK on success or an error code from errno.h. */ 170 int bithenge_new_file_blob_from_file(bithenge_node_t **out, FILE *file)170 errno_t bithenge_new_file_blob_from_file(bithenge_node_t **out, FILE *file) 171 171 { 172 172 int fd = fileno(file);
Note:
See TracChangeset
for help on using the changeset viewer.