Changeset ca7fa5b in mainline for uspace/srv/bd/hr/util.c


Ignore:
Timestamp:
2025-04-02T18:24:11Z (4 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
800d188
Parents:
bbcd06e
Message:

hr: use <inttypes.h> macro specifiers

File:
1 edited

Legend:

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

    rbbcd06e rca7fa5b  
    3939#include <fibril_synch.h>
    4040#include <hr.h>
     41#include <inttypes.h>
    4142#include <io/log.h>
    4243#include <loc.h>
     
    234235
    235236        errno_t rc;
    236         size_t i, blkno, bsize;
     237        uint64_t blkno;
     238        size_t i, bsize;
    237239        size_t last_bsize = 0;
    238240
     
    244246                }
    245247
    246                 HR_DEBUG("%s(): block_init() on (%lu)\n", __func__, svc_id);
     248                HR_DEBUG("%s(): block_init() on (%" PRIun ")\n", __func__,
     249                    svc_id);
    247250                rc = block_init(svc_id);
    248251                if (rc != EOK) {
    249                         HR_DEBUG("%s(): initing (%lu) failed, aborting\n",
     252                        HR_DEBUG("%s(): initing (%" PRIun ") failed, aborting\n",
    250253                            __func__, svc_id);
    251254                        goto error;
     
    298301        for (i = 0; i < vol->extent_no; i++) {
    299302                if (vol->extents[i].svc_id != 0) {
    300                         HR_DEBUG("hr_fini_devs(): block_fini() on (%lu)\n",
     303                        HR_DEBUG("hr_fini_devs(): block_fini() on (%" PRIun ")\n",
    301304                            vol->extents[i].svc_id);
    302305                        block_fini(vol->extents[i].svc_id);
     
    306309        for (i = 0; i < vol->hotspare_no; i++) {
    307310                if (vol->hotspares[i].svc_id != 0) {
    308                         HR_DEBUG("hr_fini_devs(): block_fini() on (%lu)\n",
     311                        HR_DEBUG("hr_fini_devs(): block_fini() on (%" PRIun ")\n",
    309312                            vol->hotspares[i].svc_id);
    310313                        block_fini(vol->hotspares[i].svc_id);
     
    370373}
    371374
    372 void hr_update_ext_status(hr_volume_t *vol, size_t extent, hr_ext_status_t s)
     375void hr_update_ext_status(hr_volume_t *vol, size_t ext_idx, hr_ext_status_t s)
    373376{
    374377        if (vol->level != HR_LVL_0)
     
    377380        assert(fibril_rwlock_is_write_locked(&vol->states_lock));
    378381
    379         assert(extent < vol->extent_no);
    380 
    381         hr_ext_status_t old = vol->extents[extent].status;
    382         HR_WARN("\"%s\": changing extent %lu state: %s -> %s\n",
    383             vol->devname, extent, hr_get_ext_status_msg(old),
     382        assert(ext_idx < vol->extent_no);
     383
     384        hr_ext_status_t old = vol->extents[ext_idx].status;
     385        HR_WARN("\"%s\": changing extent %zu state: %s -> %s\n",
     386            vol->devname, ext_idx, hr_get_ext_status_msg(old),
    384387            hr_get_ext_status_msg(s));
    385         vol->extents[extent].status = s;
    386 }
    387 
    388 void hr_update_hotspare_status(hr_volume_t *vol, size_t hs, hr_ext_status_t s)
     388        vol->extents[ext_idx].status = s;
     389}
     390
     391void hr_update_hotspare_status(hr_volume_t *vol, size_t hs_idx,
     392    hr_ext_status_t s)
    389393{
    390394        assert(fibril_mutex_is_locked(&vol->hotspare_lock));
    391395
    392         assert(hs < vol->hotspare_no);
    393 
    394         hr_ext_status_t old = vol->hotspares[hs].status;
    395         HR_WARN("\"%s\": changing hotspare %lu state: %s -> %s\n",
    396             vol->devname, hs, hr_get_ext_status_msg(old),
     396        assert(hs_idx < vol->hotspare_no);
     397
     398        hr_ext_status_t old = vol->hotspares[hs_idx].status;
     399        HR_WARN("\"%s\": changing hotspare %zu state: %s -> %s\n",
     400            vol->devname, hs_idx, hr_get_ext_status_msg(old),
    397401            hr_get_ext_status_msg(s));
    398         vol->hotspares[hs].status = s;
     402        vol->hotspares[hs_idx].status = s;
    399403}
    400404
     
    408412}
    409413
    410 void hr_update_ext_svc_id(hr_volume_t *vol, size_t extent, service_id_t new)
     414void hr_update_ext_svc_id(hr_volume_t *vol, size_t ext_idx, service_id_t new)
    411415{
    412416        if (vol->level != HR_LVL_0)
    413417                assert(fibril_rwlock_is_write_locked(&vol->extents_lock));
    414418
    415         assert(extent < vol->extent_no);
    416 
    417         service_id_t old = vol->extents[extent].svc_id;
    418         HR_WARN("\"%s\": changing extent no. %lu svc_id: (%lu) -> (%lu)\n",
    419             vol->devname, extent, old, new);
    420         vol->extents[extent].svc_id = new;
    421 }
    422 
    423 void hr_update_hotspare_svc_id(hr_volume_t *vol, size_t hs, service_id_t new)
     419        assert(ext_idx < vol->extent_no);
     420
     421        service_id_t old = vol->extents[ext_idx].svc_id;
     422        HR_WARN("\"%s\": changing extent no. %zu svc_id: (%" PRIun ") -> "
     423            "(%" PRIun ")\n", vol->devname, ext_idx, old, new);
     424        vol->extents[ext_idx].svc_id = new;
     425}
     426
     427void hr_update_hotspare_svc_id(hr_volume_t *vol, size_t hs_idx,
     428    service_id_t new)
    424429{
    425430        assert(fibril_mutex_is_locked(&vol->hotspare_lock));
    426431
    427         assert(hs < vol->hotspare_no);
    428 
    429         service_id_t old = vol->hotspares[hs].svc_id;
    430         HR_WARN("\"%s\": changing hotspare no. %lu svc_id: (%lu) -> (%lu)\n",
    431             vol->devname, hs, old, new);
    432         vol->hotspares[hs].svc_id = new;
     432        assert(hs_idx < vol->hotspare_no);
     433
     434        service_id_t old = vol->hotspares[hs_idx].svc_id;
     435        HR_WARN("\"%s\": changing hotspare no. %zu svc_id: (%" PRIun ") -> "
     436            "(%" PRIun ")\n", vol->devname, hs_idx, old, new);
     437        vol->hotspares[hs_idx].svc_id = new;
    433438}
    434439
     
    805810                vol->extents[iter->md->index].svc_id = iter->svc_id;
    806811
    807                 size_t blkno;
     812                uint64_t blkno;
    808813                rc = block_get_nblocks(iter->svc_id, &blkno);
    809814                if (rc != EOK)
     
    10491054                goto error;
    10501055
    1051         size_t hs_blkno;
     1056        uint64_t hs_blkno;
    10521057        rc = block_get_nblocks(hotspare, &hs_blkno);
    10531058        if (rc != EOK) {
Note: See TracChangeset for help on using the changeset viewer.