X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fvhost_blk%2Fvhost_blk.c;h=b757c9228bfa210b0a0c391a6f6407951c85cb5f;hb=93982b2132d26894573b7b93c8fc33a84046fa1b;hp=8c57013139296dc5ba1db40b77ee84834bb22198;hpb=c19beb3f38cd8463f87f01e1f5941a2a821b8ac6;p=dpdk.git diff --git a/examples/vhost_blk/vhost_blk.c b/examples/vhost_blk/vhost_blk.c index 8c57013139..b757c9228b 100644 --- a/examples/vhost_blk/vhost_blk.c +++ b/examples/vhost_blk/vhost_blk.c @@ -31,6 +31,8 @@ (1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | \ (1ULL << VHOST_USER_F_PROTOCOL_FEATURES)) +struct vhost_blk_ctrlr *g_vhost_ctrlr; + /* Path to folder where character device will be created. Can be set by user. */ static char dev_pathname[PATH_MAX] = ""; static sem_t exit_sem; @@ -856,6 +858,7 @@ new_device(int vid) ctrlr->bdev->vid, i, &blk_vq->last_avail_idx, &blk_vq->last_used_idx); + assert(ret == 0); blk_vq->avail_wrap_counter = blk_vq->last_avail_idx & (1 << 15); @@ -993,11 +996,7 @@ vhost_blk_ctrlr_construct(const char *ctrlr_name) } snprintf(dev_pathname, sizeof(dev_pathname), "%s/%s", path, ctrlr_name); - if (access(dev_pathname, F_OK) != -1) { - if (unlink(dev_pathname) != 0) - rte_exit(EXIT_FAILURE, "Cannot remove %s.\n", - dev_pathname); - } + unlink(dev_pathname); if (rte_vhost_driver_register(dev_pathname, 0) != 0) { fprintf(stderr, "socket %s already exists\n", dev_pathname); @@ -1040,8 +1039,7 @@ signal_handler(__rte_unused int signum) { struct vhost_blk_ctrlr *ctrlr; - if (access(dev_pathname, F_OK) == 0) - unlink(dev_pathname); + unlink(dev_pathname); if (g_should_stop != -1) { g_should_stop = 1; @@ -1092,4 +1090,3 @@ int main(int argc, char *argv[]) return 0; } -