From 1f115d726147285da256a499abc1fe98b3726453 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 24 Apr 2016 19:44:03 -0400 Subject: driver: added struct sfrt_source_version, sfrt_source_version(). --- Makefile.in | 4 ++-- include/sofort/sofort.h | 10 ++++++++++ src/driver/sfrt_driver_ctx.c | 14 ++++++++++++++ 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 +#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; +} -- cgit v1.2.3