Changes in uspace/srv/bd/rd/rd.c [1558d85:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/rd/rd.c
r1558d85 rb7fd2a0 48 48 #include <stdbool.h> 49 49 #include <errno.h> 50 #include <str_error.h> 50 51 #include <async.h> 51 52 #include <fibril_synch.h> … … 66 67 static const size_t block_size = 512; 67 68 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 *);69 static errno_t rd_open(bd_srvs_t *, bd_srv_t *); 70 static errno_t rd_close(bd_srv_t *); 71 static errno_t rd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t); 72 static errno_t rd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t); 73 static errno_t rd_get_block_size(bd_srv_t *, size_t *); 74 static errno_t rd_get_num_blocks(bd_srv_t *, aoff64_t *); 74 75 75 76 /** This rwlock protects the ramdisk's data. … … 99 100 100 101 /** Open device. */ 101 static int rd_open(bd_srvs_t *bds, bd_srv_t *bd)102 static errno_t rd_open(bd_srvs_t *bds, bd_srv_t *bd) 102 103 { 103 104 return EOK; … … 105 106 106 107 /** Close device. */ 107 static int rd_close(bd_srv_t *bd)108 static errno_t rd_close(bd_srv_t *bd) 108 109 { 109 110 return EOK; … … 111 112 112 113 /** Read blocks from the device. */ 113 static int rd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, void *buf,114 static errno_t rd_read_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, void *buf, 114 115 size_t size) 115 116 { … … 127 128 128 129 /** Write blocks to the device. */ 129 static int rd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt,130 static errno_t rd_write_blocks(bd_srv_t *bd, aoff64_t ba, size_t cnt, 130 131 const void *buf, size_t size) 131 132 { … … 146 147 { 147 148 sysarg_t size; 148 int ret = sysinfo_get_value("rd.size", &size);149 errno_t ret = sysinfo_get_value("rd.size", &size); 149 150 if ((ret != EOK) || (size == 0)) { 150 151 printf("%s: No RAM disk found\n", NAME); … … 179 180 ret = loc_server_register(NAME); 180 181 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)); 182 183 return false; 183 184 } … … 196 197 197 198 /** Get device block size. */ 198 static int rd_get_block_size(bd_srv_t *bd, size_t *rsize)199 static errno_t rd_get_block_size(bd_srv_t *bd, size_t *rsize) 199 200 { 200 201 *rsize = block_size; … … 203 204 204 205 /** Get number of blocks on device. */ 205 static int rd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)206 static errno_t rd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb) 206 207 { 207 208 *rnb = rd_size / block_size;
Note:
See TracChangeset
for help on using the changeset viewer.