summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-04-24 19:44:03 -0400
committermidipix <writeonce@midipix.org>2016-04-24 19:51:42 -0400
commit1f115d726147285da256a499abc1fe98b3726453 (patch)
tree674eda491b08e1079fef4bba4472829c24e9a4cd
parentb2d0f49b5a6349b7ec93b3a37f81757f60532863 (diff)
downloadsofort-1f115d726147285da256a499abc1fe98b3726453.tar.bz2
sofort-1f115d726147285da256a499abc1fe98b3726453.tar.xz
driver: added struct sfrt_source_version, sfrt_source_version().
-rw-r--r--Makefile.in4
-rw-r--r--include/sofort/sofort.h10
-rw-r--r--src/driver/sfrt_driver_ctx.c14
3 files changed, 26 insertions, 2 deletions
diff --git a/Makefile.in b/Makefile.in
index 0957e32..d8ae066 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -86,10 +86,10 @@ include $(PROJECT_DIR)/project/overrides.mk
$(APP_SRCS:%.c=%.o): version.tag
$(APP_SRCS:%.c=%.o): CFLAGS_STATIC = $(CFLAGS_APP)
-src/%.lo: $(PROJECT_DIR)/src/%.c $(ALL_HEADERS) host.tag dirs.tag
+src/%.lo: $(PROJECT_DIR)/src/%.c $(ALL_HEADERS) host.tag dirs.tag version.tag
$(CC) -c -o $@ $< $(CFLAGS_SHARED)
-src/%.o: $(PROJECT_DIR)/src/%.c $(ALL_HEADERS) host.tag dirs.tag
+src/%.o: $(PROJECT_DIR)/src/%.c $(ALL_HEADERS) host.tag dirs.tag version.tag
$(CC) -c -o $@ $< $(CFLAGS_STATIC)
lib/%$(OS_LIB_SUFFIX)$(VER_XYZ):
diff --git a/include/sofort/sofort.h b/include/sofort/sofort.h
index 639266a..4bf4c1a 100644
--- a/include/sofort/sofort.h
+++ b/include/sofort/sofort.h
@@ -40,6 +40,13 @@ extern "C" {
#define SFRT_OUTPUT_NAME 0x0001 /* dummy */
#define SFRT_OUTPUT_ADDRESS 0x0002 /* dummy */
+struct sfrt_source_version {
+ int major;
+ int minor;
+ int revision;
+ const char * commit;
+};
+
struct sfrt_input {
void * addr;
size_t size;
@@ -71,6 +78,9 @@ struct sfrt_unit_ctx {
int nerrors;
};
+/* package info */
+sfrt_api const struct sfrt_source_version * sfrt_source_version(void);
+
/* driver api */
sfrt_api int sfrt_get_driver_ctx (char ** argv, char ** envp, uint32_t flags, struct sfrt_driver_ctx **);
sfrt_api int sfrt_create_driver_ctx (const struct sfrt_common_ctx *, struct sfrt_driver_ctx **);
diff --git a/src/driver/sfrt_driver_ctx.c b/src/driver/sfrt_driver_ctx.c
index f582a3e..2d3a29b 100644
--- a/src/driver/sfrt_driver_ctx.c
+++ b/src/driver/sfrt_driver_ctx.c
@@ -5,9 +5,18 @@
#define ARGV_DRIVER
#include <sofort/sofort.h>
+#include "sofort_version.h"
#include "sofort_driver_impl.h"
#include "argv/argv.h"
+/* package info */
+static const struct sfrt_source_version sfrt_src_version = {
+ SFRT_TAG_VER_MAJOR,
+ SFRT_TAG_VER_MINOR,
+ SFRT_TAG_VER_PATCH,
+ SOFORT_GIT_VERSION
+};
+
struct sfrt_driver_ctx_alloc {
struct argv_meta * meta;
struct sfrt_driver_ctx_impl ctx;
@@ -185,3 +194,8 @@ void sfrt_free_driver_ctx(struct sfrt_driver_ctx * ctx)
sfrt_free_driver_ctx_impl(ictx);
}
}
+
+const struct sfrt_source_version * sfrt_source_version(void)
+{
+ return &sfrt_src_version;
+}