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


Ignore:
Timestamp:
2024-12-06T20:19:21Z (7 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
ea0d494
Parents:
241c3f6
Message:

hr: layout info printing

File:
1 edited

Legend:

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

    r241c3f6 r4066371  
    133133
    134134        printf("level: %d\n", vol_info->level);
     135        if (vol_info->level == HR_LVL_4 || vol_info->level == HR_LVL_5) {
     136                printf("layout: %s\n",
     137                    hr_get_layout_str(vol_info->level, vol_info->RLQ));
     138        }
    135139        if (vol_info->level == HR_LVL_0 || vol_info->level == HR_LVL_4) {
    136140                if (vol_info->strip_size / 1024 < 1)
     
    159163                                return rc;
    160164                }
    161                 if (i == 0 && vol_info->level == HR_LVL_4)
    162                         printf("          P   %s    %zu       %s\n", hr_get_ext_status_msg(ext->status), i, devname);
    163                 else if (vol_info->level == HR_LVL_4)
    164                         printf("              %s    %zu       %s\n", hr_get_ext_status_msg(ext->status), i, devname);
    165                 else
     165                if (vol_info->level == HR_LVL_4) {
     166                        if ((i == 0 && vol_info->RLQ == HR_RLQ_RAID4_0) ||
     167                            (i == vol_info->extent_no - 1 &&
     168                            vol_info->RLQ == HR_RLQ_RAID4_N))
     169                                printf("          P   %s    %zu       %s\n", hr_get_ext_status_msg(ext->status), i, devname);
     170                        else
     171                                printf("              %s    %zu       %s\n", hr_get_ext_status_msg(ext->status), i, devname);
     172                } else {
    166173                        printf("          %s    %zu       %s\n", hr_get_ext_status_msg(ext->status), i, devname);
     174                }
    167175        }
    168176
     
    343351}
    344352
     353const char *hr_get_layout_str(hr_level_t level, uint8_t RLQ)
     354{
     355        switch (level) {
     356        case HR_LVL_4:
     357                switch (RLQ) {
     358                case HR_RLQ_RAID4_0:
     359                        return "RAID-4 Non-Rotating Parity 0";
     360                case HR_RLQ_RAID4_N:
     361                        return "RAID-4 Non-Rotating Parity N";
     362                default:
     363                        return "RAID-4 INVALID";
     364                }
     365        case HR_LVL_5:
     366                switch (RLQ) {
     367                case HR_RLQ_RAID5_0R:
     368                        return "RAID-5 Rotating Parity 0 with Data Restart";
     369                case HR_RLQ_RAID5_NR:
     370                        return "RAID-5 Rotating Parity N with Data Restart";
     371                case HR_RLQ_RAID5_NC:
     372                        return "RAID-5 Rotating Parity N with Data Continuation";
     373                default:
     374                        return "RAID-5 INVALID";
     375                }
     376        default:
     377                return "INVALID";
     378        }
     379}
     380
    345381/** @}
    346382 */
Note: See TracChangeset for help on using the changeset viewer.