examples/eventdev: fix build with gcc 10
[dpdk.git] / examples / vm_power_manager / channel_manager.h
index 251d216..8284be0 100644 (file)
@@ -12,6 +12,7 @@ extern "C" {
 #include <linux/limits.h>
 #include <sys/un.h>
 #include <rte_atomic.h>
+#include <stdbool.h>
 
 /* Maximum name length including '\0' terminator */
 #define CHANNEL_MGR_MAX_NAME_LEN    64
@@ -22,6 +23,9 @@ extern "C" {
 /* File socket directory */
 #define CHANNEL_MGR_SOCKET_PATH     "/tmp/powermonitor/"
 
+/* FIFO file name template */
+#define CHANNEL_MGR_FIFO_PATTERN_NAME   "fifo"
+
 #ifndef UNIX_PATH_MAX
 struct sockaddr_un _sockaddr_un;
 #define UNIX_PATH_MAX sizeof(_sockaddr_un.sun_path)
@@ -76,6 +80,7 @@ struct vm_info {
        unsigned num_vcpus;                           /**< number of vCPUS */
        struct channel_info channels[RTE_MAX_LCORE];  /**< channel_info array */
        unsigned num_channels;                        /**< Number of channels */
+       int allow_query;                              /**< is query allowed */
 };
 
 /**
@@ -140,6 +145,22 @@ uint16_t get_pcpu(struct channel_info *chan_info, unsigned int vcpu);
  */
 int set_pcpu(char *vm_name, unsigned int vcpu, unsigned int pcpu);
 
+/**
+ * Allow or disallow queries for specified VM.
+ * It is thread-safe.
+ *
+ * @param name
+ *  Virtual Machine name to lookup.
+ *
+ * @param allow_query
+ *  Query status to be set.
+ *
+ * @return
+ *  - 0 on success.
+ *  - Negative on error.
+ */
+int set_query_status(char *vm_name, bool allow_query);
+
 /**
  * Add a VM as specified by name to the Channel Manager. The name must
  * correspond to a valid libvirt domain name.
@@ -206,13 +227,13 @@ int add_channels(const char *vm_name, unsigned *channel_list,
                unsigned num_channels);
 
 /**
- * Set up a fifo by which host applications can send command an policies
+ * Set up fifos by which host applications can send command an policies
  * through a fifo to the vm_power_manager
  *
  * @return
  *  - 0 for success
  */
-int add_host_channel(void);
+int add_host_channels(void);
 
 /**
  * Remove a channel definition from the channel manager. This must only be