aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2023-07-23 10:49:49 +0900
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>2023-10-03 21:45:12 +0900
commit0c6e343d51ed6357f39e80e3b13631c164406a76 (patch)
tree5a81b3104b4f5cf9327f2bdb17d0642a7df1c962
parentef577dca8c76e9b2b6456f4d17b7c32e035e3b1f (diff)
downloadlibhinawa-0c6e343d51ed6357f39e80e3b13631c164406a76.tar.gz
fw_node: change signature of FwNode.get_config_rom()
The function was defined to return void, while it has an argument for GLib.Error. In GNOME convention, such function should return gboolean. This commit change the signature according to the convention. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rw-r--r--samples/common/__init__.py2
-rw-r--r--src/fw_node.c21
-rw-r--r--src/fw_node.h4
-rw-r--r--src/hinawa.map3
4 files changed, 16 insertions, 14 deletions
diff --git a/samples/common/__init__.py b/samples/common/__init__.py
index 816a8dd..17a5c3d 100644
--- a/samples/common/__init__.py
+++ b/samples/common/__init__.py
@@ -57,7 +57,7 @@ def print_fw_node_information(node: Hinawa.FwNode):
print_generation_information(node)
print(' Config ROM:')
- image = node.get_config_rom()
+ _, image = node.get_config_rom()
quads = unpack('>{}I'.format(len(image) // 4), image)
for i, q in enumerate(quads):
print(' 0xfffff00004{:02x}: 0x{:08x}'.format(i * 4, q))
diff --git a/src/fw_node.c b/src/fw_node.c
index 3efbc4c..0dfd613 100644
--- a/src/fw_node.c
+++ b/src/fw_node.c
@@ -400,23 +400,24 @@ gboolean hinawa_fw_node_open(HinawaFwNode *self, const gchar *path, gint open_fl
*
* Get cached content of configuration ROM aligned to big-endian.
*
- * Since: 1.4.
+ * Returns: TRUE if the overall operation finishes successfully, otherwise FALSE.
+ *
+ * Since: 3.0.
*/
-void hinawa_fw_node_get_config_rom(HinawaFwNode *self, const guint8 **image,
- gsize *length, GError **error)
+gboolean hinawa_fw_node_get_config_rom(HinawaFwNode *self, const guint8 **image, gsize *length,
+ GError **error)
{
HinawaFwNodePrivate *priv;
- g_return_if_fail(HINAWA_IS_FW_NODE(self));
- g_return_if_fail(image != NULL);
- g_return_if_fail(length != NULL);
- g_return_if_fail(error == NULL || *error == NULL);
-
+ g_return_val_if_fail(HINAWA_IS_FW_NODE(self), FALSE);
+ g_return_val_if_fail(image != NULL, FALSE);
+ g_return_val_if_fail(length != NULL, FALSE);
+ g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
priv = hinawa_fw_node_get_instance_private(self);
if (priv->fd < 0) {
generate_local_error(error, HINAWA_FW_NODE_ERROR_NOT_OPENED);
- return;
+ return FALSE;
}
g_mutex_lock(&priv->mutex);
@@ -425,6 +426,8 @@ void hinawa_fw_node_get_config_rom(HinawaFwNode *self, const guint8 **image,
*length = priv->config_rom_length;
g_mutex_unlock(&priv->mutex);
+
+ return TRUE;
}
/**
diff --git a/src/fw_node.h b/src/fw_node.h
index 15bb339..420b405 100644
--- a/src/fw_node.h
+++ b/src/fw_node.h
@@ -43,8 +43,8 @@ HinawaFwNode *hinawa_fw_node_new(void);
gboolean hinawa_fw_node_open(HinawaFwNode *self, const gchar *path, gint open_flag, GError **error);
-void hinawa_fw_node_get_config_rom(HinawaFwNode *self, const guint8 **image,
- gsize *length, GError **error);
+gboolean hinawa_fw_node_get_config_rom(HinawaFwNode *self, const guint8 **image, gsize *length,
+ GError **error);
gboolean hinawa_fw_node_read_cycle_time(HinawaFwNode *self, gint clock_id,
HinawaCycleTime *const *cycle_time, GError **error);
diff --git a/src/hinawa.map b/src/hinawa.map
index e9719ce..b2fa21a 100644
--- a/src/hinawa.map
+++ b/src/hinawa.map
@@ -45,8 +45,6 @@ HINAWA_1_4_0 {
} HINAWA_1_3_0;
HINAWA_2_0_0 {
- "hinawa_fw_node_get_config_rom";
-
"hinawa_fw_fcp_transaction";
"hinawa_fw_resp_get_req_frame";
@@ -113,4 +111,5 @@ HINAWA_2_6_0 {
HINAWA_3_0_0 {
global:
"hinawa_fw_node_open";
+ "hinawa_fw_node_get_config_rom";
} HINAWA_2_6_0;