| 420 | } |
| 421 | |
| 422 | int |
| 423 | CacheHostRecord::Init(CacheType typ) |
| 424 | { |
| 425 | int i, j; |
| 426 | extern Queue<CacheVol> cp_list; |
| 427 | extern int cp_list_len; |
| 428 | |
| 429 | num_vols = 0; |
| 430 | type = typ; |
| 431 | cp = static_cast<CacheVol **>(ats_malloc(cp_list_len * sizeof(CacheVol *))); |
| 432 | memset(cp, 0, cp_list_len * sizeof(CacheVol *)); |
| 433 | num_cachevols = 0; |
| 434 | CacheVol *cachep = cp_list.head; |
| 435 | for (; cachep; cachep = cachep->link.next) { |
| 436 | if (cachep->scheme == type) { |
| 437 | Dbg(dbg_ctl_cache_hosting, "Host Record: %p, Volume: %d, size: %" PRId64, this, cachep->vol_number, (int64_t)cachep->size); |
| 438 | cp[num_cachevols] = cachep; |
| 439 | num_cachevols++; |
| 440 | num_vols += cachep->num_vols; |
| 441 | } |
| 442 | } |
| 443 | if (!num_cachevols) { |
| 444 | Warning("error: No volumes found for Cache Type %d", type); |
| 445 | return -1; |
| 446 | } |
| 447 | stripes = static_cast<StripeSM **>(ats_malloc(num_vols * sizeof(StripeSM *))); |
| 448 | int counter = 0; |
| 449 | for (i = 0; i < num_cachevols; i++) { |
| 450 | CacheVol *cachep1 = cp[i]; |
| 451 | for (j = 0; j < cachep1->num_vols; j++) { |
| 452 | stripes[counter++] = cachep1->stripes[j]; |
| 453 | } |
| 454 | } |
| 455 | ink_assert(counter == num_vols); |
| 456 | |
| 457 | build_vol_hash_table(this); |
| 458 | return 0; |
| 459 | } |
| 460 | |
| 461 | int |
| 462 | CacheHostRecord::Init(matcher_line *line_info, CacheType typ) |
no test coverage detected