diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2023-07-23 10:49:49 +0900 |
---|---|---|
committer | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2023-10-03 21:45:12 +0900 |
commit | 2a4b7934f3608a269a70e956cd293af6b1d6b435 (patch) | |
tree | a9f4fe551e20e2b79e0b5f59dc2fcb3096fedcb0 | |
parent | 80550c34dbb4b50f589908dceed87ce8f4e236ce (diff) | |
download | libhinawa-2a4b7934f3608a269a70e956cd293af6b1d6b435.tar.gz |
fw_resp: change signature of FwResp.reserve_within_region()
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-- | src/fw_resp.c | 26 | ||||
-rw-r--r-- | src/fw_resp.h | 6 | ||||
-rw-r--r-- | src/hinawa.map | 4 |
3 files changed, 20 insertions, 16 deletions
diff --git a/src/fw_resp.c b/src/fw_resp.c index 041fbf6..73f4886 100644 --- a/src/fw_resp.c +++ b/src/fw_resp.c @@ -299,24 +299,26 @@ HinawaFwResp *hinawa_fw_resp_new(void) * controller), which is used to communicate to the node given as parameter. The range of address * is looked up in region between region_start and region_end. * - * Since: 2.3. + * Returns: TRUE if the overall operation finishes successfully, otherwise FALSE. + * + * Since: 3.0. */ -void hinawa_fw_resp_reserve_within_region(HinawaFwResp *self, HinawaFwNode *node, - guint64 region_start, guint64 region_end, guint width, - GError **error) +gboolean hinawa_fw_resp_reserve_within_region(HinawaFwResp *self, HinawaFwNode *node, + guint64 region_start, guint64 region_end, + guint width, GError **error) { HinawaFwRespPrivate *priv; struct fw_cdev_allocate allocate = {0}; int err; - g_return_if_fail(HINAWA_IS_FW_RESP(self)); - g_return_if_fail(width > 0); - g_return_if_fail(error == NULL || *error == NULL); + g_return_val_if_fail(HINAWA_IS_FW_RESP(self), FALSE); + g_return_val_if_fail(width > 0, FALSE); + g_return_val_if_fail(error == NULL || *error == NULL, FALSE); priv = hinawa_fw_resp_get_instance_private(self); if (priv->node != NULL) { generate_local_error(error, HINAWA_FW_RESP_ERROR_RESERVED); - return; + return FALSE; } allocate.offset = region_start; @@ -326,13 +328,13 @@ void hinawa_fw_resp_reserve_within_region(HinawaFwResp *self, HinawaFwNode *node err = hinawa_fw_node_ioctl(node, FW_CDEV_IOC_ALLOCATE, &allocate, error); if (*error != NULL) - return; + return FALSE; if (err > 0) { if (err == EBUSY) generate_local_error(error, HINAWA_FW_RESP_ERROR_ADDR_SPACE_USED); else generate_syscall_error(error, err, "ioctl(%s)", "FW_CDEV_IOC_ALLOCATE"); - return; + return FALSE; } priv->node = g_object_ref(node); @@ -344,6 +346,8 @@ void hinawa_fw_resp_reserve_within_region(HinawaFwResp *self, HinawaFwNode *node priv->offset = allocate.offset; priv->width = allocate.length; priv->addr_handle = allocate.handle; + + return TRUE; } /** @@ -364,7 +368,7 @@ void hinawa_fw_resp_reserve_within_region(HinawaFwResp *self, HinawaFwNode *node void hinawa_fw_resp_reserve(HinawaFwResp *self, HinawaFwNode *node, guint64 addr, guint width, GError **error) { - hinawa_fw_resp_reserve_within_region(self, node, addr, addr + width, width, error); + (void)hinawa_fw_resp_reserve_within_region(self, node, addr, addr + width, width, error); } /** diff --git a/src/fw_resp.h b/src/fw_resp.h index 39c389b..5084d82 100644 --- a/src/fw_resp.h +++ b/src/fw_resp.h @@ -84,9 +84,9 @@ struct _HinawaFwRespClass { HinawaFwResp *hinawa_fw_resp_new(void); -void hinawa_fw_resp_reserve_within_region(HinawaFwResp *self, HinawaFwNode *node, - guint64 region_start, guint64 region_end, guint width, - GError **error); +gboolean hinawa_fw_resp_reserve_within_region(HinawaFwResp *self, HinawaFwNode *node, + guint64 region_start, guint64 region_end, + guint width, GError **error); void hinawa_fw_resp_reserve(HinawaFwResp *self, HinawaFwNode*node, guint64 addr, guint width, GError **error); void hinawa_fw_resp_release(HinawaFwResp *self); diff --git a/src/hinawa.map b/src/hinawa.map index 525c50e..d9809be 100644 --- a/src/hinawa.map +++ b/src/hinawa.map @@ -73,8 +73,6 @@ HINAWA_2_2_0 { } HINAWA_2_1_0; HINAWA_2_3_0 { - global: - "hinawa_fw_resp_reserve_within_region"; } HINAWA_2_2_0; HINAWA_2_4_0 { @@ -112,4 +110,6 @@ HINAWA_3_0_0 { "hinawa_fw_node_create_source"; "hinawa_fw_req_transaction"; + + "hinawa_fw_resp_reserve_within_region"; } HINAWA_2_6_0; |