Changeset d199a6f in mainline


Ignore:
Timestamp:
2024-11-15T21:32:20Z (6 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
7b359f5
Parents:
dfa2313
Message:

hr: DPRINTF, ERR_PRINTF → HR_DEBUG, HR_ERROR

Also add HR_WARN for warning level.

Location:
uspace/srv/bd/hr
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/bd/hr/hr.c

    rdfa2313 rd199a6f  
    6262static hr_volume_t *hr_get_volume(service_id_t svc_id)
    6363{
    64         DPRINTF("hr_get_volume(): (%" PRIun ")\n", svc_id);
     64        HR_DEBUG("hr_get_volume(): (%" PRIun ")\n", svc_id);
    6565
    6666        fibril_mutex_lock(&hr_volumes_lock);
     
    7878static errno_t hr_remove_volume(service_id_t svc_id)
    7979{
    80         DPRINTF("hr_remove_volume(): (%" PRIun ")\n", svc_id);
     80        HR_DEBUG("hr_remove_volume(): (%" PRIun ")\n", svc_id);
    8181
    8282        fibril_mutex_lock(&hr_volumes_lock);
     
    9797static void hr_create_srv(ipc_call_t *icall, bool assemble)
    9898{
    99         DPRINTF("hr_create_srv()\n");
     99        HR_DEBUG("hr_create_srv()\n");
    100100
    101101        errno_t rc;
     
    139139                for (i = 0; i < cfg->dev_no; i++) {
    140140                        if (cfg->devs[i] == 0) {
    141                                 ERR_PRINTF("missing device provided for array "
     141                                HR_ERROR("missing device provided for array "
    142142                                    "creation, aborting");
    143143                                free(cfg);
     
    163163        if (assemble) {
    164164                if (cfg->level != HR_LVL_UNKNOWN)
    165                         log_msg(LOG_DEFAULT, LVL_WARN,
    166                             "level manually set when assembling, ingoring");
     165                        HR_WARN("level manually set when assembling, ingoring");
    167166                new_volume->level = HR_LVL_UNKNOWN;
    168167        }
     
    205204                break;
    206205        default:
    207                 ERR_PRINTF("unkown level: %d, aborting\n", new_volume->level);
     206                HR_ERROR("unkown level: %d, aborting\n", new_volume->level);
    208207                rc = EINVAL;
    209208                goto error;
     
    231230
    232231        if (assemble) {
    233                 DPRINTF("assembled volume \"%s\" (%" PRIun ")\n",
     232                HR_DEBUG("assembled volume \"%s\" (%" PRIun ")\n",
    234233                    new_volume->devname, new_volume->svc_id);
    235234        } else {
    236                 DPRINTF("created volume \"%s\" (%" PRIun ")\n",
     235                HR_DEBUG("created volume \"%s\" (%" PRIun ")\n",
    237236                    new_volume->devname, new_volume->svc_id);
    238237        }
     
    250249static void hr_stop_srv(ipc_call_t *icall)
    251250{
    252         DPRINTF("hr_stop_srv()\n");
     251        HR_DEBUG("hr_stop_srv()\n");
    253252
    254253        errno_t rc = EOK;
     
    284283static void hr_print_status_srv(ipc_call_t *icall)
    285284{
    286         DPRINTF("hr_status_srv()\n");
     285        HR_DEBUG("hr_status_srv()\n");
    287286
    288287        errno_t rc;
     
    348347static void hr_ctl_conn(ipc_call_t *icall, void *arg)
    349348{
    350         DPRINTF("hr_ctl_conn()\n");
     349        HR_DEBUG("hr_ctl_conn()\n");
    351350
    352351        async_accept_0(icall);
     
    383382static void hr_client_conn(ipc_call_t *icall, void *arg)
    384383{
    385         DPRINTF("hr_client_conn()\n");
     384        HR_DEBUG("hr_client_conn()\n");
    386385
    387386        hr_volume_t *vol;
     
    392391                hr_ctl_conn(icall, arg);
    393392        } else {
    394                 DPRINTF("bd_conn()\n");
     393                HR_DEBUG("bd_conn()\n");
    395394                vol = hr_get_volume(svc_id);
    396395                if (vol == NULL)
     
    419418        rc = loc_server_register(NAME, &hr_srv);
    420419        if (rc != EOK) {
    421                 ERR_PRINTF("failed registering server: %s", str_error(rc));
     420                HR_ERROR("failed registering server: %s", str_error(rc));
    422421                return EEXIST;
    423422        }
     
    425424        rc = loc_service_register(hr_srv, SERVICE_NAME_HR, &ctl_sid);
    426425        if (rc != EOK) {
    427                 ERR_PRINTF("failed registering service: %s", str_error(rc));
     426                HR_ERROR("failed registering service: %s", str_error(rc));
    428427                return EEXIST;
    429428        }
  • uspace/srv/bd/hr/raid0.c

    rdfa2313 rd199a6f  
    8787
    8888        if (new_volume->dev_no < 2) {
    89                 ERR_PRINTF("RAID 0 array needs at least 2 devices");
     89                HR_ERROR("RAID 0 array needs at least 2 devices\n");
    9090                return EINVAL;
    9191        }
     
    127127static errno_t hr_raid0_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
    128128{
    129         DPRINTF("hr_bd_open()\n");
     129        HR_DEBUG("hr_bd_open()\n");
    130130        return EOK;
    131131}
     
    133133static errno_t hr_raid0_bd_close(bd_srv_t *bd)
    134134{
    135         DPRINTF("hr_bd_close()\n");
     135        HR_DEBUG("hr_bd_close()\n");
    136136        return EOK;
    137137}
     
    185185        for (size_t i = 0; i < vol->dev_no; i++) {
    186186                if (vol->extents[i].status != HR_EXT_ONLINE) {
    187                         ERR_PRINTF("RAID 0 needs all extents to be ONLINE, "
     187                        HR_WARN("RAID 0 needs all extents to be ONLINE, "
    188188                            "marking \"%s\" (%lu) as FAULTY",
    189189                            vol->devname, vol->svc_id);
  • uspace/srv/bd/hr/raid1.c

    rdfa2313 rd199a6f  
    8787
    8888        if (new_volume->dev_no < 2) {
    89                 ERR_PRINTF("RAID 1 array needs at least 2 devices\n");
     89                HR_ERROR("RAID 1 array needs at least 2 devices\n");
    9090                return EINVAL;
    9191        }
     
    127127static errno_t hr_raid1_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
    128128{
    129         DPRINTF("hr_bd_open()\n");
     129        HR_DEBUG("hr_bd_open()\n");
    130130        return EOK;
    131131}
     
    133133static errno_t hr_raid1_bd_close(bd_srv_t *bd)
    134134{
    135         DPRINTF("hr_bd_close()\n");
     135        HR_DEBUG("hr_bd_close()\n");
    136136        return EOK;
    137137}
     
    192192        if (healthy == 0) {
    193193                if (old_state != HR_VOL_FAULTY) {
    194                         ERR_PRINTF("RAID 1 needs at least 1 extent to be"
     194                        HR_WARN("RAID 1 needs at least 1 extent to be"
    195195                            "ONLINE, marking \"%s\" (%lu) volume as FAULTY",
    196196                            vol->devname, vol->svc_id);
     
    200200        } else if (healthy < vol->dev_no) {
    201201                if (old_state != HR_VOL_DEGRADED) {
    202                         ERR_PRINTF("RAID 1 array \"%s\" (%lu) has some "
     202                        HR_WARN("RAID 1 array \"%s\" (%lu) has some "
    203203                            "inactive extent(s), marking volume as DEGRADED",
    204204                            vol->devname, vol->svc_id);
     
    208208        } else {
    209209                if (old_state != HR_VOL_ONLINE) {
    210                         DPRINTF("RAID 1 array \"%s\" (%lu) has all extents "
     210                        HR_WARN("RAID 1 array \"%s\" (%lu) has all extents "
    211211                            "active, marking volume as ONLINE",
    212212                            vol->devname, vol->svc_id);
  • uspace/srv/bd/hr/raid4.c

    rdfa2313 rd199a6f  
    9999
    100100        if (new_volume->dev_no < 3) {
    101                 ERR_PRINTF("RAID 4 array needs at least 3 devices");
     101                HR_ERROR("RAID 4 array needs at least 3 devices\n");
    102102                return EINVAL;
    103103        }
     
    140140static errno_t hr_raid4_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
    141141{
    142         DPRINTF("hr_bd_open()\n");
     142        HR_DEBUG("hr_bd_open()\n");
    143143        return EOK;
    144144}
     
    146146static errno_t hr_raid4_bd_close(bd_srv_t *bd)
    147147{
    148         DPRINTF("hr_bd_close()\n");
     148        HR_DEBUG("hr_bd_close()\n");
    149149        return EOK;
    150150}
     
    214214        case 0:
    215215                if (old_state != HR_VOL_ONLINE) {
    216                         DPRINTF("RAID 4 has all extents online, "
     216                        HR_WARN("RAID 4 has all extents online, "
    217217                            "marking \"%s\" (%lu) as ONLINE",
    218218                            vol->devname, vol->svc_id);
     
    222222        case 1:
    223223                if (old_state != HR_VOL_DEGRADED) {
    224                         ERR_PRINTF("RAID 4 array \"%s\" (%lu) has 1 extent "
     224                        HR_WARN("RAID 4 array \"%s\" (%lu) has 1 extent "
    225225                            "inactive, marking as DEGRADED",
    226226                            vol->devname, vol->svc_id);
     
    230230        default:
    231231                if (old_state != HR_VOL_FAULTY) {
    232                         ERR_PRINTF("RAID 4 array \"%s\" (%lu) has more "
     232                        HR_WARN("RAID 4 array \"%s\" (%lu) has more "
    233233                            "than one 1 extent inactive, marking as FAULTY",
    234234                            vol->devname, vol->svc_id);
  • uspace/srv/bd/hr/raid5.c

    rdfa2313 rd199a6f  
    9696
    9797        if (new_volume->dev_no < 3) {
    98                 ERR_PRINTF("RAID 5 array needs at least 3 devices");
     98                HR_ERROR("RAID 5 array needs at least 3 devices\n");
    9999                return EINVAL;
    100100        }
     
    137137static errno_t hr_raid5_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
    138138{
    139         DPRINTF("hr_bd_open()\n");
     139        HR_DEBUG("hr_bd_open()\n");
    140140        return EOK;
    141141}
     
    143143static errno_t hr_raid5_bd_close(bd_srv_t *bd)
    144144{
    145         DPRINTF("hr_bd_close()\n");
     145        HR_DEBUG("hr_bd_close()\n");
    146146        return EOK;
    147147}
     
    211211        case 0:
    212212                if (old_state != HR_VOL_ONLINE) {
    213                         DPRINTF("RAID 5 has all extents online, "
     213                        HR_WARN("RAID 5 has all extents online, "
    214214                            "marking \"%s\" (%lu) as ONLINE",
    215215                            vol->devname, vol->svc_id);
     
    219219        case 1:
    220220                if (old_state != HR_VOL_DEGRADED) {
    221                         ERR_PRINTF("RAID 5 array \"%s\" (%lu) has 1 extent "
     221                        HR_WARN("RAID 5 array \"%s\" (%lu) has 1 extent "
    222222                            "inactive, marking as DEGRADED",
    223223                            vol->devname, vol->svc_id);
     
    227227        default:
    228228                if (old_state != HR_VOL_FAULTY) {
    229                         ERR_PRINTF("RAID 5 array \"%s\" (%lu) has more "
     229                        HR_WARN("RAID 5 array \"%s\" (%lu) has more "
    230230                            "than one 1 extent inactive, marking as FAULTY",
    231231                            vol->devname, vol->svc_id);
  • uspace/srv/bd/hr/superblock.c

    rdfa2313 rd199a6f  
    5454errno_t hr_write_meta_to_vol(hr_volume_t *vol)
    5555{
    56         DPRINTF("hr_write_meta_to_vol()\n");
     56        HR_DEBUG("hr_write_meta_to_vol()\n");
    5757
    5858        errno_t rc;
     
    7171
    7272        if (vol->nblocks < meta_blkno) {
    73                 ERR_PRINTF("not enough blocks to write metadat\n");
     73                HR_ERROR("not enough blocks to write metadat\n");
    7474                rc = EINVAL;
    7575                goto error;
    7676        } else if (vol->nblocks == meta_blkno) {
    77                 ERR_PRINTF("there would be zero data blocks after writing "
     77                HR_ERROR("there would be zero data blocks after writing "
    7878                    "metadata, aborting");
    7979                rc = EINVAL;
     
    114114{
    115115        if (uint64_t_le2host(md->magic) != HR_MAGIC) {
    116                 ERR_PRINTF("invalid magic\n");
     116                HR_ERROR("invalid magic\n");
    117117                return EINVAL;
    118118        }
     
    122122errno_t hr_fill_vol_from_meta(hr_volume_t *vol)
    123123{
    124         DPRINTF("hr_get_vol_from_meta()\n");
     124        HR_DEBUG("hr_get_vol_from_meta()\n");
    125125
    126126        errno_t rc;
     
    170170
    171171        if (vol->dev_no != uint32_t_le2host(metadata->extent_no)) {
    172                 ERR_PRINTF("number of divices in array differ: specified %zu, "
     172                HR_ERROR("number of divices in array differ: specified %zu, "
    173173                    "metadata states %u",
    174174                    vol->dev_no, uint32_t_le2host(metadata->extent_no));
     
    184184
    185185        if (str_cmp(metadata->devname, vol->devname) != 0) {
    186                 log_msg(LOG_DEFAULT, LVL_WARN,
    187                     "devname on metadata (%s) and config (%s) differ, "
     186                HR_WARN("devname on metadata (%s) and config (%s) differ, "
    188187                    "using config", metadata->devname, vol->devname);
    189188        }
  • uspace/srv/bd/hr/util.c

    rdfa2313 rd199a6f  
    5050errno_t hr_init_devs(hr_volume_t *vol)
    5151{
    52         DPRINTF("hr_init_devs()\n");
     52        HR_DEBUG("hr_init_devs()\n");
    5353
    5454        errno_t rc;
     
    6363                }
    6464
    65                 DPRINTF("hr_init_devs(): block_init() on (%lu)\n",
     65                HR_DEBUG("hr_init_devs(): block_init() on (%lu)\n",
    6666                    extent->svc_id);
    6767                rc = block_init(extent->svc_id);
     
    6969
    7070                if (rc != EOK) {
    71                         ERR_PRINTF("hr_init_devs(): initing (%lu) failed, "
     71                        HR_ERROR("hr_init_devs(): initing (%lu) failed, "
    7272                            "aborting\n", extent->svc_id);
    7373                        break;
     
    8080void hr_fini_devs(hr_volume_t *vol)
    8181{
    82         DPRINTF("hr_fini_devs()\n");
     82        HR_DEBUG("hr_fini_devs()\n");
    8383
    8484        size_t i;
     
    8686        for (i = 0; i < vol->dev_no; i++) {
    8787                if (vol->extents[i].status != HR_EXT_MISSING) {
    88                         DPRINTF("hr_fini_devs(): block_fini() on (%lu)\n",
     88                        HR_DEBUG("hr_fini_devs(): block_fini() on (%lu)\n",
    8989                            vol->extents[i].svc_id);
    9090                        block_fini(vol->extents[i].svc_id);
     
    9595errno_t hr_register_volume(hr_volume_t *vol)
    9696{
    97         DPRINTF("hr_register_volume()\n");
     97        HR_DEBUG("hr_register_volume()\n");
    9898
    9999        errno_t rc;
     
    108108        rc = loc_service_register(hr_srv, fullname, &new_id);
    109109        if (rc != EOK) {
    110                 ERR_PRINTF("unable to register device \"%s\": %s\n",
     110                HR_ERROR("unable to register device \"%s\": %s\n",
    111111                    fullname, str_error(rc));
    112112                goto error;
     
    115115        rc = loc_category_get_id("raid", &cat_id, IPC_FLAG_BLOCKING);
    116116        if (rc != EOK) {
    117                 ERR_PRINTF("failed resolving category \"raid\": %s\n",
     117                HR_ERROR("failed resolving category \"raid\": %s\n",
    118118                    str_error(rc));
    119119                goto error;
     
    122122        rc = loc_service_add_to_cat(hr_srv, new_id, cat_id);
    123123        if (rc != EOK) {
    124                 ERR_PRINTF("failed adding \"%s\" to category \"raid\": %s\n",
     124                HR_ERROR("failed adding \"%s\" to category \"raid\": %s\n",
    125125                    fullname, str_error(rc));
    126126                goto error;
     
    136136errno_t hr_check_devs(hr_volume_t *vol, uint64_t *rblkno, size_t *rbsize)
    137137{
    138         DPRINTF("hr_check_devs()\n");
     138        HR_DEBUG("hr_check_devs()\n");
    139139
    140140        errno_t rc;
     
    154154                        goto error;
    155155                if (last_nblocks != 0 && nblocks != last_nblocks) {
    156                         ERR_PRINTF("number of blocks differs\n");
     156                        HR_ERROR("number of blocks differs\n");
    157157                        rc = EINVAL;
    158158                        goto error;
     
    171171                        goto error;
    172172                if (last_bsize != 0 && bsize != last_bsize) {
    173                         ERR_PRINTF("block sizes differ\n");
     173                        HR_ERROR("block sizes differ\n");
    174174                        rc = EINVAL;
    175175                        goto error;
     
    180180
    181181        if ((bsize % 512) != 0) {
    182                 ERR_PRINTF("block size not multiple of 512\n");
     182                HR_ERROR("block size not multiple of 512\n");
    183183                return EINVAL;
    184184        }
     
    206206void hr_update_ext_status(hr_volume_t *vol, uint64_t extent, hr_ext_status_t s)
    207207{
    208         log_msg(LOG_DEFAULT, LVL_WARN,
    209             "vol %s, changing extent: %lu, to status: %s",
     208        HR_WARN("vol %s, changing extent: %lu, to status: %s",
    210209            vol->devname, extent, hr_get_ext_status_msg(s));
    211210        vol->extents[extent].status = s;
  • uspace/srv/bd/hr/util.h

    rdfa2313 rd199a6f  
    4141#include "var.h"
    4242
    43 #define DPRINTF(format, ...) \
     43#define HR_DEBUG(format, ...) \
    4444    log_msg(LOG_DEFAULT, LVL_DEBUG, format, ##__VA_ARGS__)
    4545
    46 #define ERR_PRINTF(format, ...) \
     46#define HR_WARN(format, ...) \
     47    log_msg(LOG_DEFAULT, LVL_WARN, format, ##__VA_ARGS__)
     48
     49#define HR_ERROR(format, ...) \
    4750    log_msg(LOG_DEFAULT, LVL_ERROR, format, ##__VA_ARGS__)
    4851
Note: See TracChangeset for help on using the changeset viewer.