Changes in uspace/srv/bd/rd/rd.c [1558d85:b7fd2a0] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/bd/rd/rd.c

    r1558d85 rb7fd2a0  
    4848#include <stdbool.h>
    4949#include <errno.h>
     50#include <str_error.h>
    5051#include <async.h>
    5152#include <fibril_synch.h>
     
    6667static const size_t block_size = 512;
    6768
    68 static int rd_open(bd_srvs_t *, bd_srv_t *);
    69 static int rd_close(bd_srv_t *);
    70 static int rd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
    71 static int rd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
    72 static int rd_get_block_size(bd_srv_t *, size_t *);
    73 static int rd_get_num_blocks(bd_srv_t *, aoff64_t *);
     69static errno_t rd_open(bd_srvs_t *, bd_srv_t *);
     70static errno_t rd_close(bd_srv_t *);
     71static errno_t rd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
     72static errno_t rd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
     73static errno_t rd_get_block_size(bd_srv_t *, size_t *);
     74static errno_t rd_get_num_blocks(bd_srv_t *, aoff64_t *);
    7475
    7576/** This rwlock protects the ramdisk's data.
     
    99100
    100101/** Open device. */
    101 static int rd_open(bd_srvs_t *bds, bd_srv_t *bd)
     102static errno_t rd_open(bd_srvs_t *bds, bd_srv_t *bd)
    102103{
    103104        return EOK;
     
    105106
    106107/** Close device. */
    107 static int rd_close(bd_srv_t *bd)
     108static errno_t rd_close(bd_srv_t *bd)
    108109{
    109110        return EOK;
     
    111112
    112113/** Read blocks from the device. */
    113 static int rd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, void *buf,
     114static errno_t rd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, void *buf,
    114115    size_t size)
    115116{
     
    127128
    128129/** Write blocks to the device. */
    129 static int rd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
     130static errno_t rd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,
    130131    const void *buf, size_t size)
    131132{
     
    146147{
    147148        sysarg_t size;
    148         int ret = sysinfo_get_value("rd.size", &size);
     149        errno_t ret = sysinfo_get_value("rd.size", &size);
    149150        if ((ret != EOK) || (size == 0)) {
    150151                printf("%s: No RAM disk found\n", NAME);
     
    179180        ret = loc_server_register(NAME);
    180181        if (ret != EOK) {
    181                 printf("%s: Unable to register driver (%d)\n", NAME, ret);
     182                printf("%s: Unable to register driver: %s\n", NAME, str_error(ret));
    182183                return false;
    183184        }
     
    196197
    197198/** Get device block size. */
    198 static int rd_get_block_size(bd_srv_t *bd, size_t *rsize)
     199static errno_t rd_get_block_size(bd_srv_t *bd, size_t *rsize)
    199200{
    200201        *rsize = block_size;
     
    203204
    204205/** Get number of blocks on device. */
    205 static int rd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
     206static errno_t rd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
    206207{
    207208        *rnb = rd_size / block_size;
Note: See TracChangeset for help on using the changeset viewer.