static void vfio_unmap_bar(VFIOPCIDevice *vdev, int nr)

{

    VFIOBAR *bar = &vdev->bars[nr];



    if (!bar->region.size) {

        return;

    }



    vfio_bar_quirk_teardown(vdev, nr);



    memory_region_del_subregion(&bar->region.mem, &bar->region.mmap_mem);

    munmap(bar->region.mmap, memory_region_size(&bar->region.mmap_mem));



    if (vdev->msix && vdev->msix->table_bar == nr) {

        memory_region_del_subregion(&bar->region.mem, &vdev->msix->mmap_mem);

        munmap(vdev->msix->mmap, memory_region_size(&vdev->msix->mmap_mem));

    }

}

static void vfio_unmap_bar(VFIOPCIDevice *vdev, int nr)

{

    VFIOBAR *bar = &vdev->bars[nr];



    if (!bar->region.size) {

        return;

    }



    vfio_bar_quirk_teardown(vdev, nr);



    memory_region_del_subregion(&bar->region.mem, &bar->region.mmap_mem);

    munmap(bar->region.mmap, memory_region_size(&bar->region.mmap_mem));



    if (vdev->msix && vdev->msix->table_bar == nr) {

        memory_region_del_subregion(&bar->region.mem, &vdev->msix->mmap_mem);

        munmap(vdev->msix->mmap, memory_region_size(&vdev->msix->mmap_mem));

    }

}

static void FUNC_0(VFIOPCIDevice *VAR_0, int VAR_1)

{

    VFIOBAR *bar = &VAR_0->bars[VAR_1];



    if (!bar->region.size) {

        return;

    }



    vfio_bar_quirk_teardown(VAR_0, VAR_1);



    memory_region_del_subregion(&bar->region.mem, &bar->region.mmap_mem);

    munmap(bar->region.mmap, memory_region_size(&bar->region.mmap_mem));



    if (VAR_0->msix && VAR_0->msix->table_bar == VAR_1) {

        memory_region_del_subregion(&bar->region.mem, &VAR_0->msix->mmap_mem);

        munmap(VAR_0->msix->mmap, memory_region_size(&VAR_0->msix->mmap_mem));

    }

}

static void FUNC_0(VFIOPCIDevice *VAR_0, int VAR_1)
{ VFIOBAR *bar = &VAR_0->bars[VAR_1]; if (!bar->region.size) { return; } vfio_bar_quirk_teardown(VAR_0, VAR_1); memory_region_del_subregion(&bar->region.mem, &bar->region.mmap_mem); munmap(bar->region.mmap, memory_region_size(&bar->region.mmap_mem)); if (VAR_0->msix && VAR_0->msix->table_bar == VAR_1) { memory_region_del_subregion(&bar->region.mem, &VAR_0->msix->mmap_mem); munmap(VAR_0->msix->mmap, memory_region_size(&VAR_0->msix->mmap_mem)); } }