Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/test/chardev-test/main.c

    r57914494 rb7fd2a0  
    2929#include <async.h>
    3030#include <errno.h>
     31#include <str_error.h>
    3132#include <io/chardev_srv.h>
    3233#include <ipc/services.h>
     
    3839#define NAME  "chardev-test"
    3940
    40 static int smallx_open(chardev_srvs_t *, chardev_srv_t *);
    41 static int smallx_close(chardev_srv_t *);
    42 static int smallx_write(chardev_srv_t *, const void *, size_t, size_t *);
    43 static int smallx_read(chardev_srv_t *, void *, size_t, size_t *);
    44 
    45 static int largex_open(chardev_srvs_t *, chardev_srv_t *);
    46 static int largex_close(chardev_srv_t *);
    47 static int largex_write(chardev_srv_t *, const void *, size_t, size_t *);
    48 static int largex_read(chardev_srv_t *, void *, size_t, size_t *);
    49 
    50 static int partialx_open(chardev_srvs_t *, chardev_srv_t *);
    51 static int partialx_close(chardev_srv_t *);
    52 static int partialx_write(chardev_srv_t *, const void *, size_t, size_t *);
    53 static int partialx_read(chardev_srv_t *, void *, size_t, size_t *);
     41static errno_t smallx_open(chardev_srvs_t *, chardev_srv_t *);
     42static errno_t smallx_close(chardev_srv_t *);
     43static errno_t smallx_write(chardev_srv_t *, const void *, size_t, size_t *);
     44static errno_t smallx_read(chardev_srv_t *, void *, size_t, size_t *);
     45
     46static errno_t largex_open(chardev_srvs_t *, chardev_srv_t *);
     47static errno_t largex_close(chardev_srv_t *);
     48static errno_t largex_write(chardev_srv_t *, const void *, size_t, size_t *);
     49static errno_t largex_read(chardev_srv_t *, void *, size_t, size_t *);
     50
     51static errno_t partialx_open(chardev_srvs_t *, chardev_srv_t *);
     52static errno_t partialx_close(chardev_srv_t *);
     53static errno_t partialx_write(chardev_srv_t *, const void *, size_t, size_t *);
     54static errno_t partialx_read(chardev_srv_t *, void *, size_t, size_t *);
    5455
    5556static service_id_t smallx_svc_id;
     
    105106int main(int argc, char *argv[])
    106107{
    107         int rc;
     108        errno_t rc;
    108109
    109110        printf("%s: Character device test service\n", NAME);
     
    112113        rc = loc_server_register(NAME);
    113114        if (rc != EOK) {
    114                 printf("%s: Failed registering server. (%d)\n", NAME, rc);
     115                printf("%s: Failed registering server.: %s\n", NAME, str_error(rc));
    115116                return rc;
    116117        }
     
    130131        rc = loc_service_register(SERVICE_NAME_CHARDEV_TEST_SMALLX, &smallx_svc_id);
    131132        if (rc != EOK) {
    132                 printf("%s: Failed registering service. (%d)\n", NAME, rc);
     133                printf("%s: Failed registering service.: %s\n", NAME, str_error(rc));
    133134                return rc;
    134135        }
     
    136137        rc = loc_service_register(SERVICE_NAME_CHARDEV_TEST_LARGEX, &largex_svc_id);
    137138        if (rc != EOK) {
    138                 printf("%s: Failed registering service. (%d)\n", NAME, rc);
     139                printf("%s: Failed registering service.: %s\n", NAME, str_error(rc));
    139140                return rc;
    140141        }
     
    142143        rc = loc_service_register(SERVICE_NAME_CHARDEV_TEST_PARTIALX, &partialx_svc_id);
    143144        if (rc != EOK) {
    144                 printf("%s: Failed registering service. (%d)\n", NAME, rc);
     145                printf("%s: Failed registering service.: %s\n", NAME, str_error(rc));
    145146                return rc;
    146147        }
     
    155156}
    156157
    157 static int smallx_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
    158 {
    159         return EOK;
    160 }
    161 
    162 static int smallx_close(chardev_srv_t *srv)
    163 {
    164         return EOK;
    165 }
    166 
    167 static int smallx_write(chardev_srv_t *srv, const void *data, size_t size,
     158static errno_t smallx_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
     159{
     160        return EOK;
     161}
     162
     163static errno_t smallx_close(chardev_srv_t *srv)
     164{
     165        return EOK;
     166}
     167
     168static errno_t smallx_write(chardev_srv_t *srv, const void *data, size_t size,
    168169    size_t *nwritten)
    169170{
     
    177178}
    178179
    179 static int smallx_read(chardev_srv_t *srv, void *buf, size_t size,
     180static errno_t smallx_read(chardev_srv_t *srv, void *buf, size_t size,
    180181    size_t *nread)
    181182{
     
    190191}
    191192
    192 static int largex_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
    193 {
    194         return EOK;
    195 }
    196 
    197 static int largex_close(chardev_srv_t *srv)
    198 {
    199         return EOK;
    200 }
    201 
    202 static int largex_write(chardev_srv_t *srv, const void *data, size_t size,
     193static errno_t largex_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
     194{
     195        return EOK;
     196}
     197
     198static errno_t largex_close(chardev_srv_t *srv)
     199{
     200        return EOK;
     201}
     202
     203static errno_t largex_write(chardev_srv_t *srv, const void *data, size_t size,
    203204    size_t *nwritten)
    204205{
     
    212213}
    213214
    214 static int largex_read(chardev_srv_t *srv, void *buf, size_t size,
     215static errno_t largex_read(chardev_srv_t *srv, void *buf, size_t size,
    215216    size_t *nread)
    216217{
     
    225226}
    226227
    227 static int partialx_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
    228 {
    229         return EOK;
    230 }
    231 
    232 static int partialx_close(chardev_srv_t *srv)
    233 {
    234         return EOK;
    235 }
    236 
    237 static int partialx_write(chardev_srv_t *srv, const void *data, size_t size,
     228static errno_t partialx_open(chardev_srvs_t *srvs, chardev_srv_t *srv)
     229{
     230        return EOK;
     231}
     232
     233static errno_t partialx_close(chardev_srv_t *srv)
     234{
     235        return EOK;
     236}
     237
     238static errno_t partialx_write(chardev_srv_t *srv, const void *data, size_t size,
    238239    size_t *nwritten)
    239240{
     
    247248}
    248249
    249 static int partialx_read(chardev_srv_t *srv, void *buf, size_t size,
     250static errno_t partialx_read(chardev_srv_t *srv, void *buf, size_t size,
    250251    size_t *nread)
    251252{
Note: See TracChangeset for help on using the changeset viewer.