Changeset 4066371 in mainline


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

hr: layout info printing

Location:
uspace
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/device/include/hr.h

    r241c3f6 r4066371  
    5555} hr_level_t;
    5656
     57/*
     58 * SNIA
     59 * Common RAID Disk Data Format
     60 * Specification
     61 * Version 2.0 Revision 19
     62 */
     63#define HR_RLQ_RAID4_0  0x00 /* RAID-4 Non-Rotating Parity 0 */
     64#define HR_RLQ_RAID4_N  0x01 /* RAID-4 Non-Rotating Parity N */
     65#define HR_RLQ_RAID5_0R 0x00 /* RAID-5 Rotating Parity 0 with Data Restart */
     66#define HR_RLQ_RAID5_NR 0x02 /* RAID-5 Rotating Parity N with Data Restart */
     67#define HR_RLQ_RAID5_NC 0x03 /* RAID-5 Rotating Parity N with Data Continuation */
     68
    5769typedef enum hr_vol_status {
    5870        HR_VOL_ONLINE,  /* OK, OPTIMAL */
     
    97109        size_t bsize;
    98110        hr_vol_status_t status;
     111        uint8_t RLQ;
    99112} hr_vol_info_t;
    100113
     
    109122extern const char *hr_get_vol_status_msg(hr_vol_status_t);
    110123extern const char *hr_get_ext_status_msg(hr_ext_status_t);
     124extern const char *hr_get_layout_str(hr_level_t, uint8_t);
    111125
    112126#endif
  • 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 */
  • uspace/srv/bd/hr/hr.c

    r241c3f6 r4066371  
    366366                info.bsize = vol->bsize;
    367367                info.status = vol->status;
     368                info.RLQ = vol->RLQ;
    368369
    369370                if (!async_data_read_receive(&call, &size)) {
  • uspace/srv/bd/hr/var.h

    r241c3f6 r4066371  
    8080        hr_vol_status_t status;
    8181        hr_level_t level;
    82         /*
    83          * SNIA
    84          * Common RAID Disk Data Format
    85          * Specification
    86          * Version 2.0 Revision 19
    87          */
    88 #define HR_RLQ_RAID4_0  0x00 /* RAID-4 Non-Rotating Parity 0 */
    89 #define HR_RLQ_RAID4_N  0x01 /* RAID-4 Non-Rotating Parity N */
    90 #define HR_RLQ_RAID5_0R 0x00 /* RAID-5 Rotating Parity 0 with Data Restart */
    91 #define HR_RLQ_RAID5_NR 0x02 /* RAID-5 Rotating Parity N with Data Restart */
    92 #define HR_RLQ_RAID5_NC 0x03 /* RAID-5 Rotating Parity N with Data Continuation */
    9382        uint8_t RLQ; /* RAID Level Qualifier */
    9483        char devname[HR_DEVNAME_LEN];
Note: See TracChangeset for help on using the changeset viewer.