Skip to content

Commit

Permalink
ocxl_info cleanup
Browse files Browse the repository at this point in the history
 - Add patch level to the version string
 - Clean libocxl_info.h
 - Don't leak build machine hostname in ocxl_info()
 - Remove stray newline from the end of ocxl_info

Signed-off-by: Alastair D'Silva <[email protected]>
  • Loading branch information
deece committed May 1, 2018
1 parent 62c15c6 commit 6ec56ee
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ endif

src/libocxl_info.h: version.pl
VERSION_MAJOR=${VERSION_MAJOR} VERSION_MINOR=${VERSION_MINOR} \
CC="${CC}" CFLAGS="${CFLAGS}" \
VERSION_PATCH=${VERSION_PATCH} CC="${CC}" CFLAGS="${CFLAGS}" \
./version.pl > src/libocxl_info.h

obj:
Expand Down Expand Up @@ -97,7 +97,7 @@ docs:
$(call Q,DOCS-HTML, doxygen Doxyfile-html,)

clean:
rm -rf obj testobj sampleobj docs
rm -rf obj testobj sampleobj docs src/libocxl_info.h

install: all docs
mkdir -p $(DESTDIR)$(libdir)
Expand Down
3 changes: 3 additions & 0 deletions Makefile.vars
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ VERSION_MAJOR = 1
# Change VERSION_MINOR on new features
VERSION_MINOR = 0

# Change VERSION_PATCH on each tag
VERSION_PATCH = 0

AR = $(CROSS_COMPILE)ar
AS = $(CROSS_COMPILE)as
LD = $(CROSS_COMPILE)ld
Expand Down
2 changes: 1 addition & 1 deletion src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void libocxl_init()

val = getenv("LIBOCXL_INFO");
if (val && (!strcasecmp(val, "yes") || !strcmp(val, "1"))) {
fprintf(stderr, "%s", libocxl_info);
fprintf(stderr, "%s\n", libocxl_info);
}

val = getenv("LIBOCXL_TRACE_ALL");
Expand Down
6 changes: 3 additions & 3 deletions version.pl
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
$gitHash = "\"Git hash: $hash$dirty\\n\"";
}

my $platform = `uname -a`;
my $platform = `uname -srvmpio`;
chomp $platform;

print <<"EOF";
const char *libocxl_info =
"LibOCXL Version: $ENV{VERSION_MAJOR}.$ENV{VERSION_MINOR}\\n"
"LibOCXL Version: $ENV{VERSION_MAJOR}.$ENV{VERSION_MINOR}.$ENV{VERSION_PATCH}\\n"
"CC: $ENV{CC}\\n"
"Compiler Version: $compilerLines[0]\\n"
"CFLAGS: $ENV{CFLAGS}\\n"
$gitHash
"Platform: $platform\\n\\n";
"Build platform: $platform\\n";
EOF

0 comments on commit 6ec56ee

Please sign in to comment.