[PATCH 14/16] libusbg: Add functions to get import error text and line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Krzysztof Opasiak <k.opasiak@xxxxxxxxxxx>
---
 include/usbg/usbg.h |   43 +++++++++++++++++++++++++++++++++++++++++++
 src/usbg.c          |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 91 insertions(+)

diff --git a/include/usbg/usbg.h b/include/usbg/usbg.h
index 23783eb..a934a7b 100644
--- a/include/usbg/usbg.h
+++ b/include/usbg/usbg.h
@@ -962,6 +962,49 @@ extern int usbg_import_config(usbg_gadget *g, FILE *stream, int id,
  */
 extern int usbg_import_gadget(usbg_state *s, FILE *stream,
 			      const char *name, usbg_gadget **g);
+
+/**
+ * @brief Get text of error which occurred during last function import
+ * @param g gadget where function import error occurred
+ * @return Text of error or NULL if no error data
+ */
+extern const char *usbg_get_func_import_error_text(usbg_gadget *g);
+
+/**
+ * @brief Get line number where function import error occurred
+ * @param g gadget where function import error occurred
+ * @return line number or value below 0 if no error data
+ */
+extern int usbg_get_func_import_error_line(usbg_gadget *g);
+
+/**
+ * @brief Get text of error which occurred during last config import
+ * @param g gadget where config import error occurred
+ * @return Text of error or NULL if no error data
+ */
+extern const char *usbg_get_config_import_error_text(usbg_gadget *g);
+
+/**
+ * @brief Get line number where config import error occurred
+ * @param g gadget where config import error occurred
+ * @return line number or value below 0 if no error data
+ */
+extern int usbg_get_config_import_error_line(usbg_gadget *g);
+
+/**
+ * @brief Get text of error which occurred during last gadget import
+ * @param s where gadget import error occurred
+ * @return Text of error or NULL if no error data
+ */
+extern const char *usbg_get_gadget_import_error_text(usbg_state *s);
+
+/**
+ * @brief Get line number where gadget import error occurred
+ * @param s where gadget import error occurred
+ * @return line number or value below 0 if no error data
+ */
+extern int usbg_get_gadget_import_error_line(usbg_state *s);
+
 /**
  * @}
  */
diff --git a/src/usbg.c b/src/usbg.c
index 24f72cd..ff443a5 100644
--- a/src/usbg.c
+++ b/src/usbg.c
@@ -4229,3 +4229,51 @@ out:
 	return ret;
 }
 
+const char *usbg_get_func_import_error_text(usbg_gadget *g)
+{
+	if (!g || !g->last_failed_import)
+		return NULL;
+
+	return config_error_text(g->last_failed_import);
+}
+
+const char *usbg_get_func_import_error_line(usbg_gadget *g)
+{
+	if (!g || !g->last_failed_import)
+		return -1;
+
+	return config_error_line(g->last_failed_import);
+}
+
+const char *usbg_get_config_import_error_text(usbg_gadget *g)
+{
+	if (!g || !g->last_failed_import)
+		return NULL;
+
+	return config_error_text(g->last_failed_import);
+}
+
+const char *usbg_get_config_import_error_line(usbg_gadget *g)
+{
+	if (!g || !g->last_failed_import)
+		return -1;
+
+	return config_error_line(g->last_failed_import);
+}
+
+const char *usbg_get_gadget_import_error_text(usbg_state *s)
+{
+	if (!s || !s->last_failed_import)
+		return NULL;
+
+	return config_error_text(s->last_failed_import);
+}
+
+const char *usbg_get_gadget_import_error_line(usbg_state *s)
+{
+	if (!s || !s->last_failed_import)
+		return -1;
+
+	return config_error_line(s->last_failed_import);
+}
+
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux