Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/bithenge/src/file.c

    r8e3498b r39330200  
    6363}
    6464
    65 static int file_size(bithenge_blob_t *base, aoff64_t *size)
     65static errno_t file_size(bithenge_blob_t *base, aoff64_t *size)
    6666{
    6767        file_blob_t *blob = blob_as_file(base);
     
    7070}
    7171
    72 static int file_read(bithenge_blob_t *base, aoff64_t offset, char *buffer,
     72static errno_t file_read(bithenge_blob_t *base, aoff64_t offset, char *buffer,
    7373    aoff64_t *size)
    7474{
     
    7878
    7979        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);
    8181        if (rc != EOK)
    8282                return errno;
     
    9898};
    9999
    100 static int new_file_blob(bithenge_node_t **out, int fd, bool needs_close)
     100static errno_t new_file_blob(bithenge_node_t **out, int fd, bool needs_close)
    101101{
    102102        assert(out);
    103103
    104         struct stat stat;
    105         int rc = vfs_stat(fd, &stat);
     104        vfs_stat_t stat;
     105        errno_t rc = vfs_stat(fd, &stat);
    106106        if (rc != EOK) {
    107107                if (needs_close)
     
    141141 * @param filename The name of the file.
    142142 * @return EOK on success or an error code from errno.h. */
    143 int bithenge_new_file_blob(bithenge_node_t **out, const char *filename)
     143errno_t bithenge_new_file_blob(bithenge_node_t **out, const char *filename)
    144144{
    145145        assert(filename);
    146146
    147         int fd = vfs_lookup_open(filename, WALK_REGULAR, MODE_READ);
    148         if (fd < 0)
    149                 return errno;
     147        int fd;
     148        errno_t rc = vfs_lookup_open(filename, WALK_REGULAR, MODE_READ, &fd);
     149        if (rc != EOK)
     150                return rc;
    150151
    151152        return new_file_blob(out, fd, true);
     
    157158 * @param fd The file descriptor.
    158159 * @return EOK on success or an error code from errno.h. */
    159 int bithenge_new_file_blob_from_fd(bithenge_node_t **out, int fd)
     160errno_t bithenge_new_file_blob_from_fd(bithenge_node_t **out, int fd)
    160161{
    161162        return new_file_blob(out, fd, false);
     
    167168 * @param file The file pointer.
    168169 * @return EOK on success or an error code from errno.h. */
    169 int bithenge_new_file_blob_from_file(bithenge_node_t **out, FILE *file)
     170errno_t bithenge_new_file_blob_from_file(bithenge_node_t **out, FILE *file)
    170171{
    171172        int fd = fileno(file);
Note: See TracChangeset for help on using the changeset viewer.