summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-04-25 09:20:57 -0400
committermidipix <writeonce@midipix.org>2016-11-10 23:35:42 -0500
commitb7025c26792a6f56fb96288dc3bedc74b356a001 (patch)
tree58807ce0e4c0e49f413655064a8f03e18c56fbd6
parent781ac1bd0f2df4523b1a715befd1ae63d92afecc (diff)
downloadperk-b7025c26792a6f56fb96288dc3bedc74b356a001.tar.bz2
perk-b7025c26792a6f56fb96288dc3bedc74b356a001.tar.xz
driver: added struct pe_source_version, pe_source_version().
-rw-r--r--Makefile.in4
-rw-r--r--include/perk/perk.h10
-rw-r--r--src/driver/pe_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/perk/perk.h b/include/perk/perk.h
index a99c8f4..d6f69ec 100644
--- a/include/perk/perk.h
+++ b/include/perk/perk.h
@@ -46,6 +46,13 @@ extern "C" {
/* unit action flags */
#define PERK_ACTION_MAP_READWRITE 0x0001
+struct pe_source_version {
+ int major;
+ int minor;
+ int revision;
+ const char * commit;
+};
+
struct pe_raw_image {
void * addr;
size_t size;
@@ -149,6 +156,9 @@ struct pe_unit_ctx {
int nerrors;
};
+/* package info */
+perk_api const struct pe_source_version * pe_source_version(void);
+
/* driver api */
perk_api int pe_get_driver_ctx (char ** argv, char ** envp, uint32_t flags, struct pe_driver_ctx **);
perk_api void pe_free_driver_ctx (struct pe_driver_ctx *);
diff --git a/src/driver/pe_driver_ctx.c b/src/driver/pe_driver_ctx.c
index c580ca7..59e5c35 100644
--- a/src/driver/pe_driver_ctx.c
+++ b/src/driver/pe_driver_ctx.c
@@ -12,9 +12,18 @@
#include <perk/perk.h>
#include <perk/perk_output.h>
+#include "perk_version.h"
#include "perk_driver_impl.h"
#include "argv/argv.h"
+/* package info */
+static const struct pe_source_version pe_src_version = {
+ PERK_TAG_VER_MAJOR,
+ PERK_TAG_VER_MINOR,
+ PERK_TAG_VER_PATCH,
+ PERK_GIT_VERSION
+};
+
struct pe_driver_ctx_alloc {
struct argv_meta * meta;
struct pe_driver_ctx_impl ctx;
@@ -228,3 +237,8 @@ void pe_free_driver_ctx(struct pe_driver_ctx * ctx)
pe_free_driver_ctx_impl(ictx);
}
}
+
+const struct pe_source_version * pe_source_version(void)
+{
+ return &pe_src_version;
+}