]> sigrok.org Git - libsigrok.git/blobdiff - session_driver.c
Use consistent API callback function names.
[libsigrok.git] / session_driver.c
index 0efd304de2bce9fbc72d93cdfccc4987d35263a0..07a5786090846b8a2ec4a8c921d416b5544d4b24 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * This file is part of the sigrok project.
+ * This file is part of the libsigrok project.
  *
  * Copyright (C) 2013 Bert Vermeulen <bert@biot.com>
  *
 #include "libsigrok.h"
 #include "libsigrok-internal.h"
 
-/* Message logging helpers with driver-specific prefix string. */
-#define DRIVER_LOG_DOMAIN "virtual-session: "
-#define sr_log(l, s, args...) sr_log(l, DRIVER_LOG_DOMAIN s, ## args)
-#define sr_spew(s, args...) sr_spew(DRIVER_LOG_DOMAIN s, ## args)
-#define sr_dbg(s, args...) sr_dbg(DRIVER_LOG_DOMAIN s, ## args)
-#define sr_info(s, args...) sr_info(DRIVER_LOG_DOMAIN s, ## args)
-#define sr_warn(s, args...) sr_warn(DRIVER_LOG_DOMAIN s, ## args)
-#define sr_err(s, args...) sr_err(DRIVER_LOG_DOMAIN s, ## args)
+/* Message logging helpers with subsystem-specific prefix string. */
+#define LOG_PREFIX "virtual-session: "
+#define sr_log(l, s, args...) sr_log(l, LOG_PREFIX s, ## args)
+#define sr_spew(s, args...) sr_spew(LOG_PREFIX s, ## args)
+#define sr_dbg(s, args...) sr_dbg(LOG_PREFIX s, ## args)
+#define sr_info(s, args...) sr_info(LOG_PREFIX s, ## args)
+#define sr_warn(s, args...) sr_warn(LOG_PREFIX s, ## args)
+#define sr_err(s, args...) sr_err(LOG_PREFIX s, ## args)
 
 /* size of payloads sent across the session bus */
 /** @cond PRIVATE */
@@ -115,16 +115,16 @@ static int receive_data(int fd, int revents, void *cb_data)
 }
 
 /* driver callbacks */
-static int hw_cleanup(void);
+static int cleanup(void);
 
-static int hw_init(struct sr_context *sr_ctx)
+static int init(struct sr_context *sr_ctx)
 {
        (void)sr_ctx;
 
        return SR_OK;
 }
 
-static int hw_cleanup(void)
+static int cleanup(void)
 {
        GSList *l;
 
@@ -136,7 +136,7 @@ static int hw_cleanup(void)
        return SR_OK;
 }
 
-static int hw_dev_open(struct sr_dev_inst *sdi)
+static int dev_open(struct sr_dev_inst *sdi)
 {
        if (!(sdi->priv = g_try_malloc0(sizeof(struct session_vdev)))) {
                sr_err("%s: sdi->priv malloc failed", __func__);
@@ -217,8 +217,7 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi)
        return SR_OK;
 }
 
-static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
-               void *cb_data)
+static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
 {
        struct zip_stat zs;
        struct session_vdev *vdev;
@@ -248,7 +247,7 @@ static int hw_dev_acquisition_start(const struct sr_dev_inst *sdi,
        }
 
        /* Send header packet to the session bus. */
-       std_session_send_df_header(cb_data, DRIVER_LOG_DOMAIN);
+       std_session_send_df_header(cb_data, LOG_PREFIX);
 
        /* freewheeling source */
        sr_session_source_add(-1, 0, 0, receive_data, cb_data);
@@ -261,13 +260,13 @@ SR_PRIV struct sr_dev_driver session_driver = {
        .name = "virtual-session",
        .longname = "Session-emulating driver",
        .api_version = 1,
-       .init = hw_init,
-       .cleanup = hw_cleanup,
+       .init = init,
+       .cleanup = cleanup,
        .config_get = config_get,
        .config_set = config_set,
        .config_list = config_list,
-       .dev_open = hw_dev_open,
+       .dev_open = dev_open,
        .dev_close = NULL,
-       .dev_acquisition_start = hw_dev_acquisition_start,
+       .dev_acquisition_start = dev_acquisition_start,
        .dev_acquisition_stop = NULL,
 };