tools: fix setup script for Fedora 21
[dpdk.git] / examples / vhost / vhost-net-cdev.c
index 4cf3c56..8cf806a 100644 (file)
@@ -1,13 +1,13 @@
 /*-
  *   BSD LICENSE
- * 
+ *
  *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
  *   All rights reserved.
- * 
+ *
  *   Redistribution and use in source and binary forms, with or without
  *   modification, are permitted provided that the following conditions
  *   are met:
- * 
+ *
  *     * Redistributions of source code must retain the above copyright
  *       notice, this list of conditions and the following disclaimer.
  *     * Redistributions in binary form must reproduce the above copyright
@@ -17,7 +17,7 @@
  *     * Neither the name of Intel Corporation nor the names of its
  *       contributors may be used to endorse or promote products derived
  *       from this software without specific prior written permission.
- * 
+ *
  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -91,7 +91,7 @@ vhost_net_open(fuse_req_t req, struct fuse_file_info *fi)
 
        fi->fh = err;
 
-       RTE_LOG(INFO, CONFIG, "(%"PRIu64") Device configuration started\n", fi->fh);
+       RTE_LOG(INFO, VHOST_CONFIG, "(%"PRIu64") Device configuration started\n", fi->fh);
        fuse_reply_open(req, fi);
 }
 
@@ -105,7 +105,7 @@ vhost_net_release(fuse_req_t req, struct fuse_file_info *fi)
        struct vhost_device_ctx ctx = fuse_req_to_vhost_ctx(req, fi);
 
        ops->destroy_device(ctx);
-       RTE_LOG(INFO, CONFIG, "(%"PRIu64") Device released\n", ctx.fh);
+       RTE_LOG(INFO, VHOST_CONFIG, "(%"PRIu64") Device released\n", ctx.fh);
        fuse_reply_err(req, err);
 }
 
@@ -190,32 +190,32 @@ vhost_net_ioctl(fuse_req_t req, int cmd, void *arg,
        switch(cmd)
        {
                case VHOST_NET_SET_BACKEND:
-                       LOG_DEBUG(CONFIG, "(%"PRIu64") IOCTL: VHOST_NET_SET_BACKEND\n", ctx.fh);
+                       LOG_DEBUG(VHOST_CONFIG, "(%"PRIu64") IOCTL: VHOST_NET_SET_BACKEND\n", ctx.fh);
                        VHOST_IOCTL_R(struct vhost_vring_file, file, ops->set_backend);
                        break;
 
                case VHOST_GET_FEATURES:
-                       LOG_DEBUG(CONFIG, "(%"PRIu64") IOCTL: VHOST_GET_FEATURES\n", ctx.fh);
+                       LOG_DEBUG(VHOST_CONFIG, "(%"PRIu64") IOCTL: VHOST_GET_FEATURES\n", ctx.fh);
                        VHOST_IOCTL_W(uint64_t, features, ops->get_features);
                        break;
 
                case VHOST_SET_FEATURES:
-                       LOG_DEBUG(CONFIG, "(%"PRIu64") IOCTL: VHOST_SET_FEATURES\n", ctx.fh);
+                       LOG_DEBUG(VHOST_CONFIG, "(%"PRIu64") IOCTL: VHOST_SET_FEATURES\n", ctx.fh);
                        VHOST_IOCTL_R(uint64_t, features, ops->set_features);
                        break;
 
                case VHOST_RESET_OWNER:
-                       LOG_DEBUG(CONFIG, "(%"PRIu64") IOCTL: VHOST_RESET_OWNER\n", ctx.fh);
+                       LOG_DEBUG(VHOST_CONFIG, "(%"PRIu64") IOCTL: VHOST_RESET_OWNER\n", ctx.fh);
                        VHOST_IOCTL(ops->reset_owner);
                        break;
 
                case VHOST_SET_OWNER:
-                       LOG_DEBUG(CONFIG, "(%"PRIu64") IOCTL: VHOST_SET_OWNER\n", ctx.fh);
+                       LOG_DEBUG(VHOST_CONFIG, "(%"PRIu64") IOCTL: VHOST_SET_OWNER\n", ctx.fh);
                        VHOST_IOCTL(ops->set_owner);
                        break;
 
                case VHOST_SET_MEM_TABLE:
-                       LOG_DEBUG(CONFIG, "(%"PRIu64") IOCTL: VHOST_SET_MEM_TABLE\n", ctx.fh);
+                       LOG_DEBUG(VHOST_CONFIG, "(%"PRIu64") IOCTL: VHOST_SET_MEM_TABLE\n", ctx.fh);
                        static struct vhost_memory mem_temp;
 
                        switch(in_bufsz){
@@ -246,45 +246,45 @@ vhost_net_ioctl(fuse_req_t req, int cmd, void *arg,
                        break;
 
                case VHOST_SET_VRING_NUM:
-                       LOG_DEBUG(CONFIG, "(%"PRIu64") IOCTL: VHOST_SET_VRING_NUM\n", ctx.fh);
+                       LOG_DEBUG(VHOST_CONFIG, "(%"PRIu64") IOCTL: VHOST_SET_VRING_NUM\n", ctx.fh);
                        VHOST_IOCTL_R(struct vhost_vring_state, state, ops->set_vring_num);
                        break;
 
                case VHOST_SET_VRING_BASE:
-                       LOG_DEBUG(CONFIG, "(%"PRIu64") IOCTL: VHOST_SET_VRING_BASE\n", ctx.fh);
+                       LOG_DEBUG(VHOST_CONFIG, "(%"PRIu64") IOCTL: VHOST_SET_VRING_BASE\n", ctx.fh);
                        VHOST_IOCTL_R(struct vhost_vring_state, state, ops->set_vring_base);
                        break;
 
                case VHOST_GET_VRING_BASE:
-                       LOG_DEBUG(CONFIG, "(%"PRIu64") IOCTL: VHOST_GET_VRING_BASE\n", ctx.fh);
+                       LOG_DEBUG(VHOST_CONFIG, "(%"PRIu64") IOCTL: VHOST_GET_VRING_BASE\n", ctx.fh);
                        VHOST_IOCTL_RW(uint32_t, index, struct vhost_vring_state, state, ops->get_vring_base);
                        break;
 
                case VHOST_SET_VRING_ADDR:
-                       LOG_DEBUG(CONFIG, "(%"PRIu64") IOCTL: VHOST_SET_VRING_ADDR\n", ctx.fh);
+                       LOG_DEBUG(VHOST_CONFIG, "(%"PRIu64") IOCTL: VHOST_SET_VRING_ADDR\n", ctx.fh);
                        VHOST_IOCTL_R(struct vhost_vring_addr, addr, ops->set_vring_addr);
                        break;
 
                case VHOST_SET_VRING_KICK:
-                       LOG_DEBUG(CONFIG, "(%"PRIu64") IOCTL: VHOST_SET_VRING_KICK\n", ctx.fh);
+                       LOG_DEBUG(VHOST_CONFIG, "(%"PRIu64") IOCTL: VHOST_SET_VRING_KICK\n", ctx.fh);
                        VHOST_IOCTL_R(struct vhost_vring_file, file, ops->set_vring_kick);
                        break;
 
                case VHOST_SET_VRING_CALL:
-                       LOG_DEBUG(CONFIG, "(%"PRIu64") IOCTL: VHOST_SET_VRING_CALL\n", ctx.fh);
+                       LOG_DEBUG(VHOST_CONFIG, "(%"PRIu64") IOCTL: VHOST_SET_VRING_CALL\n", ctx.fh);
                        VHOST_IOCTL_R(struct vhost_vring_file, file, ops->set_vring_call);
                        break;
 
                default:
-                       RTE_LOG(ERR, CONFIG, "(%"PRIu64") IOCTL: DOESN NOT EXIST\n", ctx.fh);
+                       RTE_LOG(ERR, VHOST_CONFIG, "(%"PRIu64") IOCTL: DOESN NOT EXIST\n", ctx.fh);
                        result = -1;
                        fuse_reply_ioctl(req, result, NULL, 0);
        }
 
        if (result < 0) {
-               LOG_DEBUG(CONFIG, "(%"PRIu64") IOCTL: FAIL\n", ctx.fh);
+               LOG_DEBUG(VHOST_CONFIG, "(%"PRIu64") IOCTL: FAIL\n", ctx.fh);
        } else {
-               LOG_DEBUG(CONFIG, "(%"PRIu64") IOCTL: SUCCESS\n", ctx.fh);
+               LOG_DEBUG(VHOST_CONFIG, "(%"PRIu64") IOCTL: SUCCESS\n", ctx.fh);
        }
 }
 
@@ -315,7 +315,7 @@ register_cuse_device(const char *base_name, int index, struct vhost_net_device_o
        char *fuse_argv[] = {fuse_opt_dummy, fuse_opt_fore, fuse_opt_nomulti};
 
        if (access(cuse_device_name, R_OK | W_OK) < 0) {
-               RTE_LOG(ERR, CONFIG, "Character device %s can't be accessed, maybe not exist\n", cuse_device_name);
+               RTE_LOG(ERR, VHOST_CONFIG, "Character device %s can't be accessed, maybe not exist\n", cuse_device_name);
                return -1;
        }
 
@@ -325,16 +325,16 @@ register_cuse_device(const char *base_name, int index, struct vhost_net_device_o
         * of userspace vhost which we can then add devices to separately.
         */
        if (strncmp(base_name, default_cdev, PATH_MAX)!=0) {
-               rte_snprintf(device_name, PATH_MAX, "DEVNAME=%s-%d", base_name, index);
-               rte_snprintf(char_device_name, PATH_MAX, "/dev/%s-%d", base_name, index);
+               snprintf(device_name, PATH_MAX, "DEVNAME=%s-%d", base_name, index);
+               snprintf(char_device_name, PATH_MAX, "/dev/%s-%d", base_name, index);
        } else {
-               rte_snprintf(device_name, PATH_MAX, "DEVNAME=%s", base_name);
-               rte_snprintf(char_device_name, PATH_MAX, "/dev/%s", base_name);
+               snprintf(device_name, PATH_MAX, "DEVNAME=%s", base_name);
+               snprintf(char_device_name, PATH_MAX, "/dev/%s", base_name);
        }
 
        /* Check if device already exists. */
        if (access(char_device_name, F_OK) != -1) {
-               RTE_LOG(ERR, CONFIG, "Character device %s already exists\n", char_device_name);
+               RTE_LOG(ERR, VHOST_CONFIG, "Character device %s already exists\n", char_device_name);
                return -1;
        }