diff --git a/kernel/mars_if.c b/kernel/mars_if.c index b07eac32..8ed9dd93 100644 --- a/kernel/mars_if.c +++ b/kernel/mars_if.c @@ -911,17 +911,16 @@ loff_t if_get_capacity(struct if_brick *brick) * device than physically. */ if (brick->dev_size <= 0) { - struct mars_info info = {}; struct if_input *input = brick->inputs[0]; int status; - status = GENERIC_INPUT_CALL(input, mars_get_info, &info); + status = GENERIC_INPUT_CALL(input, mars_get_info, &brick->info); if (unlikely(status < 0)) { MARS_ERR("cannot get device info, status=%d\n", status); return 0; } - MARS_INF("determined default capacity: %lld bytes\n", info.current_size); - brick->dev_size = info.current_size; + MARS_INF("determined default capacity: %lld bytes\n", brick->info.current_size); + brick->dev_size = brick->info.current_size; } return brick->dev_size; } diff --git a/kernel/mars_if.h b/kernel/mars_if.h index 64c2d17d..28d727f0 100644 --- a/kernel/mars_if.h +++ b/kernel/mars_if.h @@ -109,6 +109,7 @@ struct if_brick { // private struct semaphore switch_sem; struct say_channel *say_channel; + struct mars_info info; }; MARS_TYPES(if);