summaryrefslogtreecommitdiff
path: root/include/usbg
diff options
context:
space:
mode:
authorKrzysztof Opasiak <k.opasiak@samsung.com>2014-02-26 16:06:31 +0100
committerKrzysztof Opasiak <k.opasiak@samsung.com>2014-03-11 09:25:12 +0100
commit7c2d0faea7b1afac89ce9a0a43bf53243a616d55 (patch)
tree156e870c981c37ce0b16190ee929a1e63bb440ab /include/usbg
parent0f1fe776b0a21b3ddcad732465dfe268c4e213dd (diff)
downloadlibusbg-7c2d0faea7b1afac89ce9a0a43bf53243a616d55.tar.gz
libusbg-7c2d0faea7b1afac89ce9a0a43bf53243a616d55.tar.bz2
libusbg-7c2d0faea7b1afac89ce9a0a43bf53243a616d55.zip
libusbg: Return usbg_error instead of char* in usbg_get_*_name().
API should be consistent and use error codes to determine what type of error occurred instead of returning NULL only. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Diffstat (limited to 'include/usbg')
-rw-r--r--include/usbg/usbg.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/include/usbg/usbg.h b/include/usbg/usbg.h
index ad52a5f..0d76010 100644
--- a/include/usbg/usbg.h
+++ b/include/usbg/usbg.h
@@ -217,9 +217,9 @@ extern size_t usbg_get_configfs_path_len(usbg_state *s);
* @param s Pointer to state
* @param buf Buffer where path should be copied
* @param len Length of given buffer
- * @return Pointer to destination or NULL if error occurred.
+ * @return 0 on success or usbg_error if error occurred.
*/
-extern char *usbg_get_configfs_path(usbg_state *s, char *buf, size_t len);
+extern int usbg_get_configfs_path(usbg_state *s, char *buf, size_t len);
/* USB gadget queries */
@@ -302,9 +302,9 @@ extern size_t usbg_get_gadget_name_len(usbg_gadget *g);
* @param b Pointer to gadget
* @param buf Buffer where name should be copied
* @param len Length of given buffer
- * @return Pointer to destination or NULL if error occurred.
+ * @return 0 on success or usbg_error if error occurred.
*/
-extern char *usbg_get_gadget_name(usbg_gadget *g, char *buf, size_t len);
+extern int usbg_get_gadget_name(usbg_gadget *g, char *buf, size_t len);
/**
* @brief Set the USB gadget vendor id
@@ -436,9 +436,9 @@ extern size_t usbg_get_function_name_len(usbg_function *f);
* @param f Pointer to function
* @param buf Buffer where name should be copied
* @param len Length of given buffer
- * @return Pointer to destination or NULL if error occurred.
+ * @return 0 on success or usbg_error if error occurred.
*/
-extern char *usbg_get_function_name(usbg_function *f, char *buf, size_t len);
+extern int usbg_get_function_name(usbg_function *f, char *buf, size_t len);
/* USB configurations allocation and configuration */
@@ -465,9 +465,9 @@ extern size_t usbg_get_config_name_len(usbg_config *c);
* @param c Pointer to config
* @param buf Buffer where name should be copied
* @param len Length of given buffer
- * @return Pointer to destination or NULL if error occurred.
+ * @return 0 on success or usbg_error if error occurred.
*/
-extern char *usbg_get_config_name(usbg_config *c, char *buf, size_t len);
+extern int usbg_get_config_name(usbg_config *c, char *buf, size_t len);
/**
* @brief Set the USB configuration attributes
@@ -555,9 +555,9 @@ extern size_t usbg_get_binding_name_len(usbg_binding *b);
* @param b Pointer to binding
* @param buf Buffer where name should be copied
* @param len Length of given buffer
- * @return Pointer to destination or NULL if error occurred.
+ * @return 0 on success or usbg_error if error occurred.
*/
-extern char *usbg_get_binding_name(usbg_binding *b, char *buf, size_t len);
+extern int usbg_get_binding_name(usbg_binding *b, char *buf, size_t len);
/* USB gadget setup and teardown */
@@ -594,10 +594,10 @@ extern size_t usbg_get_gadget_udc_len(usbg_gadget *g);
* @param b Pointer to gadget
* @param buf Buffer where udc name should be copied
* @param len Length of given buffer
- * @return Pointer to destination or NULL if error occurred.
+ * @return 0 on success or usbg_error if error occurred.
* @note If gadget isn't enabled on any udc returned string is empty.
*/
-extern char *usbg_get_gadget_udc(usbg_gadget *g, char *buf, size_t len);
+extern int usbg_get_gadget_udc(usbg_gadget *g, char *buf, size_t len);
/*
* USB function-specific attribute configuration