Changeset fb06476f in mainline for uspace/lib/device/src/hr.c


Ignore:
Timestamp:
2025-04-21T13:20:05Z (3 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
c6d2af8
Parents:
5cb1631
Message:

hr: use enum for RAID layouts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/device/src/hr.c

    r5cb1631 rfb06476f  
    207207        if (vol_info->level == HR_LVL_4 || vol_info->level == HR_LVL_5) {
    208208                printf("layout: %s\n",
    209                     hr_get_layout_str(vol_info->level, vol_info->layout));
     209                    hr_get_layout_str(vol_info->layout));
    210210        }
    211211        if (vol_info->level == HR_LVL_0 || vol_info->level == HR_LVL_4) {
     
    428428}
    429429
    430 const char *hr_get_layout_str(hr_level_t level, uint8_t layout)
    431 {
    432         switch (level) {
    433         case HR_LVL_4:
    434                 switch (layout) {
    435                 case HR_RLQ_RAID4_0:
    436                         return "RAID-4 Non-Rotating Parity 0";
    437                 case HR_RLQ_RAID4_N:
    438                         return "RAID-4 Non-Rotating Parity N";
    439                 default:
    440                         return "Invalid RAID 4 layout";
    441                 }
    442         case HR_LVL_5:
    443                 switch (layout) {
    444                 case HR_RLQ_RAID5_0R:
    445                         return "RAID-5 Rotating Parity 0 with Data Restart";
    446                 case HR_RLQ_RAID5_NR:
    447                         return "RAID-5 Rotating Parity N with Data Restart";
    448                 case HR_RLQ_RAID5_NC:
    449                         return "RAID-5 Rotating Parity N with Data Continuation";
    450                 default:
    451                         return "Invalid RAID 5 layout";
    452                 }
     430const char *hr_get_layout_str(hr_layout_t layout)
     431{
     432        switch (layout) {
     433        case HR_RLQ_NONE:
     434                return "RAID layout not set";
     435        case HR_RLQ_RAID4_0:
     436                return "RAID-4 Non-Rotating Parity 0";
     437        case HR_RLQ_RAID4_N:
     438                return "RAID-4 Non-Rotating Parity N";
     439        case HR_RLQ_RAID5_0R:
     440                return "RAID-5 Rotating Parity 0 with Data Restart";
     441        case HR_RLQ_RAID5_NR:
     442                return "RAID-5 Rotating Parity N with Data Restart";
     443        case HR_RLQ_RAID5_NC:
     444                return "RAID-5 Rotating Parity N with Data Continuation";
    453445        default:
    454                 return "Invalid RAID level";
     446                return "Invalid RAID layout";
    455447        }
    456448}
Note: See TracChangeset for help on using the changeset viewer.