Changeset a19d7fc4 in mainline for uspace/lib/device/src/hr.c
- Timestamp:
- 2024-09-06T14:56:46Z (8 months ago)
- Children:
- 4a2a6b8b
- Parents:
- 09398589
- git-author:
- Miroslav Cimerman <mc@…> (2024-09-06 14:54:21)
- git-committer:
- Miroslav Cimerman <mc@…> (2024-09-06 14:56:46)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/device/src/hr.c
r09398589 ra19d7fc4 180 180 } 181 181 182 errno_t hr_stop(const char *devname) 183 { 184 hr_t *hr; 185 errno_t rc; 186 async_exch_t *exch; 187 service_id_t svc_id; 188 189 rc = loc_service_get_id(devname, &svc_id, 0); 190 if (rc != EOK) 191 return rc; 192 193 rc = hr_sess_init(&hr); 194 if (rc != EOK) 195 return rc; 196 197 exch = async_exchange_begin(hr->sess); 198 if (exch == NULL) { 199 rc = EINVAL; 200 goto error; 201 } 202 rc = async_req_1_0(exch, HR_STOP, svc_id); 203 async_exchange_end(exch); 204 205 if (rc != EOK) 206 goto error; 207 error: 208 hr_sess_destroy(hr); 209 return rc; 210 } 211 182 212 errno_t hr_print_status(void) 183 213 { … … 187 217 aid_t req; 188 218 size_t size, i; 189 hr_vol_info_t *vols ;219 hr_vol_info_t *vols = NULL; 190 220 191 221 rc = hr_sess_init(&hr); … … 194 224 195 225 exch = async_exchange_begin(hr->sess); 196 if (exch == NULL) 197 return EINVAL; 226 if (exch == NULL) { 227 rc = EINVAL; 228 goto error; 229 } 198 230 199 231 req = async_send_0(exch, HR_STATUS, NULL); 200 201 232 rc = async_data_read_start(exch, &size, sizeof(size_t)); 202 233 if (rc != EOK) { … … 230 261 } 231 262 263 if (size == 0) { 264 printf("no active arrays\n"); 265 goto error; 266 } 267 232 268 for (i = 0; i < size; i++) { 233 269 rc = print_vol_info(i, &vols[i]); … … 237 273 238 274 error: 275 hr_sess_destroy(hr); 239 276 if (vols != NULL) 240 277 free(vols);
Note:
See TracChangeset
for help on using the changeset viewer.