diff options
Diffstat (limited to 'hw/goldfish_mmc.c')
-rw-r--r-- | hw/goldfish_mmc.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/hw/goldfish_mmc.c b/hw/goldfish_mmc.c index 124f865..8b5c137 100644 --- a/hw/goldfish_mmc.c +++ b/hw/goldfish_mmc.c @@ -560,18 +560,25 @@ static void goldfish_mmc_setbs(struct goldfish_mmc_state* s, BlockDriverState* b void goldfish_mmc_insert(int id, BlockDriverState* bs) { if (id >= GOLDFISH_MMC_MAX) { - fprintf(stderr, "mmc controller %d out of range\n", id); - return; + return -1; } goldfish_mmc_setbs(gDrvState[id], bs); } -void goldfish_mmc_remove(int id, BlockDriverState* bs) +int goldfish_mmc_is_media_inserted(int id) +{ + if (id > GOLDFISH_MMC_MAX) { + return -1; + } + + return (gDrvState[id]->bs != NULL); +} + +void goldfish_mmc_remove(int id) { if (id >= GOLDFISH_MMC_MAX) { - fprintf(stderr, "mmc controller %d out of range\n", id); - return; + return -1; } goldfish_mmc_setbs(gDrvState[id], NULL); |