Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Z
ZIO
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
ZIO
Commits
0aea6955
Commit
0aea6955
authored
Nov 30, 2015
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: add printing version of repo
with -V switch Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
07da0470
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
4 deletions
+41
-4
Makefile
tools/Makefile
+2
-0
test-dtc.c
tools/test-dtc.c
+14
-2
zio-cat-file.c
tools/zio-cat-file.c
+12
-0
zio-dump.c
tools/zio-dump.c
+13
-2
No files found.
tools/Makefile
View file @
0aea6955
...
...
@@ -2,6 +2,8 @@
# build user-space tools for zio
CFLAGS
=
-I
$(M)
/include/
-Wall
$(ZIO_VERSION)
$(EXTRACFLAGS)
CFLAGS
+=
-DGIT_VERSION
=
\"
$(GIT_VERSION)
\"
CC
?=
$(CROSS_COMPILE)
gcc
progs
:=
zio-dump
...
...
tools/test-dtc.c
View file @
0aea6955
...
...
@@ -15,6 +15,8 @@
#include <linux/zio-user.h>
static
char
git_version
[]
=
"version: "
GIT_VERSION
;
#define FNAME "/dev/zdtc-0000-0-0-ctrl"
void
help
(
char
*
name
)
...
...
@@ -25,10 +27,17 @@ void help(char *name)
" -f <file> default: %s
\n
"
" -t <time> default:
\"
1.5
\"
(see code for details)
\n
"
" -p <period> default:
\"
0
\"\n
"
" -n <number> default: infinite
\n
"
,
FNAME
);
" -n <number> default: infinite
\n
"
" -v increase verbosity
\n
"
" -V print version information
\n
"
,
FNAME
);
exit
(
1
);
}
static
void
print_version
(
char
*
pname
)
{
printf
(
"%s %s
\n
"
,
pname
,
git_version
);
}
/* Boring parsing separated to a separate function (same code as elsewhere) */
static
int
parse_ts
(
char
*
s
,
struct
timespec
*
ts
)
{
...
...
@@ -77,7 +86,7 @@ int main(int argc, char **argv)
struct
timespec
period
=
{
0
,
0
};
/* -f <filename> -t <[+][secs].frac> -p <.frac> -v */
while
((
i
=
getopt
(
argc
,
argv
,
"f:t:p:n:v"
))
!=
-
1
)
{
while
((
i
=
getopt
(
argc
,
argv
,
"f:t:p:n:v
V
"
))
!=
-
1
)
{
switch
(
i
)
{
case
'f'
:
fname
=
optarg
;
...
...
@@ -94,6 +103,9 @@ int main(int argc, char **argv)
case
'v'
:
verbose
++
;
break
;
case
'V'
:
print_version
(
argv
[
0
]);
exit
(
0
);
default:
help
(
argv
[
0
]);
}
...
...
tools/zio-cat-file.c
View file @
0aea6955
...
...
@@ -17,8 +17,15 @@
#include <linux/zio-user.h>
static
char
git_version
[]
=
"version: "
GIT_VERSION
;
#define VERBOSE 0
static
void
print_version
(
char
*
pname
)
{
printf
(
"%s %s
\n
"
,
pname
,
git_version
);
}
int
main
(
int
argc
,
char
**
argv
)
{
int
cfd
;
/* control file descriptor */
...
...
@@ -33,10 +40,15 @@ int main(int argc, char **argv)
void
*
map
,
*
ptr
;
struct
timeval
tv1
,
tv2
;
if
((
argc
==
2
)
&&
(
!
strcmp
(
argv
[
1
],
"-V"
)))
{
print_version
(
argv
[
0
]);
exit
(
0
);
}
if
(
argc
!=
3
)
{
fprintf
(
stderr
,
"%s: Wrong number of arguments
\n
"
"Use:
\"
%s <data-file> <nblocks>
\"\n
"
,
argv
[
0
],
argv
[
0
]);
fprintf
(
stderr
,
"Or -V for version details
\n
"
);
exit
(
1
);
}
nblocks
=
atoi
(
argv
[
2
]);
...
...
tools/zio-dump.c
View file @
0aea6955
...
...
@@ -15,6 +15,8 @@
#include <linux/zio-user.h>
static
char
git_version
[]
=
"version: "
GIT_VERSION
;
unsigned
char
buf
[
1024
*
1024
];
char
*
prgname
;
int
opt_print_attr
;
...
...
@@ -222,10 +224,16 @@ void help(char *name)
" -s sniff-device (array of controls)
\n
"
" -m print memory address (for mmap)
\n
"
" -n <number> stop after that many blocks
\n
"
" -r <number> shown bytes at buffer begin/end
\n
"
);
" -r <number> shown bytes at buffer begin/end
\n
"
" -V print version information
\n
"
);
exit
(
1
);
}
static
void
print_version
(
char
*
pname
)
{
printf
(
"%s %s
\n
"
,
pname
,
git_version
);
}
int
main
(
int
argc
,
char
**
argv
)
{
FILE
*
f
;
...
...
@@ -240,7 +248,7 @@ int main(int argc, char **argv)
prgname
=
argv
[
0
];
while
((
c
=
getopt
(
argc
,
argv
,
"aAcsmn:r:"
))
!=
-
1
)
{
while
((
c
=
getopt
(
argc
,
argv
,
"aAcsmn:r:
V
"
))
!=
-
1
)
{
switch
(
c
)
{
case
'a'
:
opt_print_attr
=
1
;
...
...
@@ -274,6 +282,9 @@ int main(int argc, char **argv)
help
(
prgname
);
}
break
;
case
'V'
:
print_version
(
argv
[
0
]);
exit
(
0
);
default:
help
(
prgname
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment