Changeset e47a032 in mainline for uspace/lib
- Timestamp:
- 2024-10-28T20:02:39Z (12 months ago)
- Children:
- 9fc1d36d
- Parents:
- 066fed9
- Location:
- uspace/lib/device
- Files:
-
- 2 edited
-
include/hr.h (modified) (4 diffs)
-
src/hr.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/device/include/hr.h
r066fed9 re47a032 54 54 } hr_level_t; 55 55 56 typedef enum hr_vol_status { 57 HR_VOL_ONLINE, /* OK, OPTIMAL */ 58 HR_VOL_FAULTY 59 } hr_vol_status_t; 60 61 typedef enum hr_ext_status { 62 HR_EXT_ONLINE, /* OK */ 63 HR_EXT_MISSING, 64 HR_EXT_FAILED 65 } hr_ext_status_t; 66 56 67 typedef struct hr { 57 68 async_sess_t *sess; … … 67 78 typedef struct hr_extent { 68 79 service_id_t svc_id; 69 int status;80 hr_ext_status_t status; 70 81 } hr_extent_t; 71 82 … … 78 89 uint32_t strip_size; 79 90 size_t bsize; 91 hr_vol_status_t status; 80 92 } hr_vol_info_t; 81 93 … … 87 99 extern errno_t hr_print_status(void); 88 100 101 extern const char *hr_get_vol_status_msg(hr_vol_status_t); 102 extern const char *hr_get_ext_status_msg(hr_ext_status_t); 103 89 104 #endif 90 105 -
uspace/lib/device/src/hr.c
r066fed9 re47a032 130 130 printf("devname: %s\n", devname); 131 131 132 printf("status: %s\n", hr_get_vol_status_msg(vol_info->status)); 133 132 134 printf("level: %d\n", vol_info->level); 133 135 if (vol_info->level == HR_LVL_0 || vol_info->level == HR_LVL_4) { … … 150 152 for (i = 0; i < vol_info->extent_no; i++) { 151 153 ext = &vol_info->extents[i]; 152 rc = loc_service_get_name(ext->svc_id, &devname); 153 if (rc != EOK) 154 return rc; 154 if (ext->status == HR_EXT_MISSING) { 155 devname = (char *) "MISSING-devname"; 156 } else { 157 rc = loc_service_get_name(ext->svc_id, &devname); 158 if (rc != EOK) 159 return rc; 160 } 155 161 if (i == 0 && vol_info->level == HR_LVL_4) 156 printf(" P % d %zu %s\n", ext->status, i, devname);162 printf(" P %s %zu %s\n", hr_get_ext_status_msg(ext->status), i, devname); 157 163 else if (vol_info->level == HR_LVL_4) 158 printf(" % d %zu %s\n", ext->status, i, devname);164 printf(" %s %zu %s\n", hr_get_ext_status_msg(ext->status), i, devname); 159 165 else 160 printf(" % d %zu %s\n", ext->status, i, devname);166 printf(" %s %zu %s\n", hr_get_ext_status_msg(ext->status), i, devname); 161 167 } 162 168 return EOK; … … 262 268 } 263 269 270 const char *hr_get_vol_status_msg(hr_vol_status_t status) 271 { 272 switch (status) { 273 case HR_VOL_ONLINE: 274 return "ONLINE"; 275 case HR_VOL_FAULTY: 276 return "FAULTY"; 277 default: 278 return "UNKNOWN"; 279 } 280 } 281 282 const char *hr_get_ext_status_msg(hr_ext_status_t status) 283 { 284 switch (status) { 285 case HR_EXT_ONLINE: 286 return "ONLINE"; 287 case HR_EXT_MISSING: 288 return "MISSING"; 289 case HR_EXT_FAILED: 290 return "FAILED"; 291 default: 292 return "UNKNOWN"; 293 } 294 } 295 264 296 /** @} 265 297 */
Note:
See TracChangeset
for help on using the changeset viewer.
