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
2e35554a
Commit
2e35554a
authored
Jul 02, 2015
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get zio version directly from git
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
ca75f9be
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
49 additions
and
17 deletions
+49
-17
Makefile
Makefile
+12
-2
bus.c
bus.c
+3
-1
core.c
core.c
+5
-2
zio-user.h
include/linux/zio-user.h
+18
-3
zio.h
include/linux/zio.h
+2
-0
Makefile
tools/Makefile
+1
-1
test-dtc.c
tools/test-dtc.c
+2
-2
zio-cat-file.c
tools/zio-cat-file.c
+2
-2
zio-dump.c
tools/zio-dump.c
+4
-4
No files found.
Makefile
View file @
2e35554a
...
@@ -14,7 +14,11 @@ obj-m += drivers/
...
@@ -14,7 +14,11 @@ obj-m += drivers/
obj-m
+=
buffers/
obj-m
+=
buffers/
obj-m
+=
triggers/
obj-m
+=
triggers/
GIT_VERSION
=
$(
shell
cd
$(src)
;
git describe
--dirty
--long
--tags
)
# src is defined byt the kernel Makefile, but we want to use it also in our
# local Makefile (tools, lib)
src
?=
$(
shell
pwd
)
GIT_VERSION
:=
$(
shell
cd
$(src)
;
git describe
--dirty
--long
--tags
)
# For this CSM_VERSION, please see ohwr.org/csm documentation
# For this CSM_VERSION, please see ohwr.org/csm documentation
ifdef
CONFIG_CSM_VERSION
ifdef
CONFIG_CSM_VERSION
...
@@ -23,9 +27,15 @@ else
...
@@ -23,9 +27,15 @@ else
ccflags-y
+=
-DCERN_SUPER_MODULE
=
""
ccflags-y
+=
-DCERN_SUPER_MODULE
=
""
endif
endif
# Extract major, minor and patch number
ZIO_VERSION
:=
-D__ZIO_MAJOR_VERSION
=
$(
shell
echo
$(GIT_VERSION)
|
cut
-d
'-'
-f
2 |
cut
-d
'.'
-f
1
;
)
ZIO_VERSION
+=
-D__ZIO_MINOR_VERSION
=
$(
shell
echo
$(GIT_VERSION)
|
cut
-d
'-'
-f
2 |
cut
-d
'.'
-f
2
;
)
ZIO_VERSION
+=
-D__ZIO_PATCH_VERSION
=
$(
shell
echo
$(GIT_VERSION)
|
cut
-d
'-'
-f
3
)
export
ZIO_VERSION
# WARNING: the line below doesn't work in-kernel if you compile with O=
# WARNING: the line below doesn't work in-kernel if you compile with O=
ccflags-y
+=
-I
$(src)
/include/
-DGIT_VERSION
=
\"
$(GIT_VERSION)
\"
ccflags-y
+=
-I
$(src)
/include/
-DGIT_VERSION
=
\"
$(GIT_VERSION)
\"
ccflags-y
+=
$(ZIO_VERSION)
ccflags-$(CONFIG_ZIO_DEBUG)
+=
-DDEBUG
ccflags-$(CONFIG_ZIO_DEBUG)
+=
-DDEBUG
all
:
modules tools
all
:
modules tools
...
...
bus.c
View file @
2e35554a
...
@@ -23,7 +23,9 @@ static struct zio_status *zstat = &zio_global_status; /* Always use ptr */
...
@@ -23,7 +23,9 @@ static struct zio_status *zstat = &zio_global_status; /* Always use ptr */
*/
*/
static
ssize_t
zio_show_version
(
struct
bus_type
*
bus
,
char
*
buf
)
static
ssize_t
zio_show_version
(
struct
bus_type
*
bus
,
char
*
buf
)
{
{
return
sprintf
(
buf
,
"%d.%d
\n
"
,
ZIO_MAJOR_VERSION
,
ZIO_MINOR_VERSION
);
return
sprintf
(
buf
,
"%d.%d-%d
\n
"
,
zio_version_major
(
zio_version
),
zio_version_minor
(
zio_version
),
zio_version_patch
(
zio_version
));
}
}
/*
/*
...
...
core.c
View file @
2e35554a
...
@@ -16,6 +16,9 @@
...
@@ -16,6 +16,9 @@
#include <linux/zio-buffer.h>
#include <linux/zio-buffer.h>
#include "zio-internal.h"
#include "zio-internal.h"
const
uint32_t
zio_version
=
ZIO_VERSION
(
__ZIO_MAJOR_VERSION
,
__ZIO_MINOR_VERSION
,
__ZIO_PATCH_VERSION
);
struct
zio_status
zio_global_status
;
struct
zio_status
zio_global_status
;
static
struct
zio_status
*
zstat
=
&
zio_global_status
;
/* Always use ptr */
static
struct
zio_status
*
zstat
=
&
zio_global_status
;
/* Always use ptr */
/*
/*
...
@@ -31,8 +34,8 @@ struct zio_control *zio_alloc_control(gfp_t gfp)
...
@@ -31,8 +34,8 @@ struct zio_control *zio_alloc_control(gfp_t gfp)
if
(
!
ctrl
)
if
(
!
ctrl
)
return
NULL
;
return
NULL
;
ctrl
->
major_version
=
ZIO_MAJOR_VERSION
;
ctrl
->
major_version
=
zio_version_major
(
zio_version
)
;
ctrl
->
minor_version
=
ZIO_MINOR_VERSION
;
ctrl
->
minor_version
=
zio_version_minor
(
zio_version
)
;
if
(
ntohl
(
1
)
==
1
)
if
(
ntohl
(
1
)
==
1
)
ctrl
->
flags
|=
ZIO_CONTROL_BIG_ENDIAN
;
ctrl
->
flags
|=
ZIO_CONTROL_BIG_ENDIAN
;
else
else
...
...
include/linux/zio-user.h
View file @
2e35554a
...
@@ -8,9 +8,24 @@
...
@@ -8,9 +8,24 @@
#ifndef __ZIO_USER_H__
#ifndef __ZIO_USER_H__
#define __ZIO_USER_H__
#define __ZIO_USER_H__
/* ZIO_VERSION: is a zio_class attribute to identify the framework version*/
#define ZIO_VERSION(M, m, p) (((M & 0xFF) << 24) | ((m & 0xFF) << 16) | (p & 0xFFFF))
#define ZIO_MAJOR_VERSION 1
#define ZIO_MINOR_VERSION 0
static
inline
uint8_t
zio_version_major
(
uint32_t
version
)
{
return
(
version
>>
24
)
&
0xFF
;
}
static
inline
uint8_t
zio_version_minor
(
uint32_t
version
)
{
return
(
version
>>
16
)
&
0xFF
;
}
static
inline
uint16_t
zio_version_patch
(
uint32_t
version
)
{
return
version
&
0xFF
;
}
/*
/*
* ZIO_OBJ_NAME_LEN is the name's length used for registered objects
* ZIO_OBJ_NAME_LEN is the name's length used for registered objects
...
...
include/linux/zio.h
View file @
2e35554a
...
@@ -7,6 +7,8 @@
...
@@ -7,6 +7,8 @@
#ifdef __KERNEL__
/* Nothing more is for user space */
#ifdef __KERNEL__
/* Nothing more is for user space */
extern
const
uint32_t
zio_version
;
/*
/*
* ZIO_NAME_LEN is the full name length used in the head structures.
* ZIO_NAME_LEN is the full name length used in the head structures.
* It is sometimes built at run time, for example buffer instances
* It is sometimes built at run time, for example buffer instances
...
...
tools/Makefile
View file @
2e35554a
# build user-space tools for zio
# build user-space tools for zio
CFLAGS
=
-I
$(M)
/include/
-Wall
$(EXTRACFLAGS)
CFLAGS
=
-I
$(M)
/include/
-Wall
$(
ZIO_VERSION)
$(
EXTRACFLAGS)
CC
?=
$(CROSS_COMPILE)
gcc
CC
?=
$(CROSS_COMPILE)
gcc
progs
:=
zio-dump
progs
:=
zio-dump
...
...
tools/test-dtc.c
View file @
2e35554a
...
@@ -129,8 +129,8 @@ int main(int argc, char **argv)
...
@@ -129,8 +129,8 @@ int main(int argc, char **argv)
exit
(
1
);
exit
(
1
);
}
}
ctrl
.
major_version
=
ZIO_MAJOR_VERSION
;
ctrl
.
major_version
=
__
ZIO_MAJOR_VERSION
;
ctrl
.
minor_version
=
ZIO_MINOR_VERSION
;
ctrl
.
minor_version
=
__
ZIO_MINOR_VERSION
;
if
(
verbose
)
{
if
(
verbose
)
{
printf
(
" time: %9li.%09li
\n
"
,
ts
.
tv_sec
,
ts
.
tv_nsec
);
printf
(
" time: %9li.%09li
\n
"
,
ts
.
tv_sec
,
ts
.
tv_nsec
);
printf
(
"period: %9li.%09li
\n
"
,
period
.
tv_sec
,
period
.
tv_nsec
);
printf
(
"period: %9li.%09li
\n
"
,
period
.
tv_sec
,
period
.
tv_nsec
);
...
...
tools/zio-cat-file.c
View file @
2e35554a
...
@@ -90,8 +90,8 @@ int main(int argc, char **argv)
...
@@ -90,8 +90,8 @@ int main(int argc, char **argv)
if
(
i
!=
sizeof
(
ctrl
))
if
(
i
!=
sizeof
(
ctrl
))
goto
ctrl_read_error
;
goto
ctrl_read_error
;
if
(
!
j
)
{
if
(
!
j
)
{
if
(
ctrl
.
major_version
!=
ZIO_MAJOR_VERSION
if
(
ctrl
.
major_version
!=
__
ZIO_MAJOR_VERSION
||
ctrl
.
minor_version
!=
ZIO_MINOR_VERSION
)
{
||
ctrl
.
minor_version
!=
__
ZIO_MINOR_VERSION
)
{
fprintf
(
stderr
,
"%s: unexpected ZIO version
\n
"
,
fprintf
(
stderr
,
"%s: unexpected ZIO version
\n
"
,
argv
[
0
]);
argv
[
0
]);
exit
(
1
);
exit
(
1
);
...
...
tools/zio-dump.c
View file @
2e35554a
...
@@ -112,18 +112,18 @@ void read_channel(int cfd, int dfd, FILE *log)
...
@@ -112,18 +112,18 @@ void read_channel(int cfd, int dfd, FILE *log)
}
}
/* Fail badly if the version is not the right one */
/* Fail badly if the version is not the right one */
if
(
ctrl
.
major_version
!=
ZIO_MAJOR_VERSION
)
if
(
ctrl
.
major_version
!=
__
ZIO_MAJOR_VERSION
)
err
++
;
err
++
;
if
(
ZIO_MAJOR_VERSION
==
0
&&
ctrl
.
minor_version
!=
ZIO_MINOR_VERSION
)
if
(
__ZIO_MAJOR_VERSION
==
0
&&
ctrl
.
minor_version
!=
__
ZIO_MINOR_VERSION
)
err
++
;
err
++
;
if
(
err
)
{
if
(
err
)
{
fprintf
(
stderr
,
"%s: kernel has zio %i.%i, "
fprintf
(
stderr
,
"%s: kernel has zio %i.%i, "
"but I'm compiled for %i.%i
\n
"
,
prgname
,
"but I'm compiled for %i.%i
\n
"
,
prgname
,
ctrl
.
major_version
,
ctrl
.
minor_version
,
ctrl
.
major_version
,
ctrl
.
minor_version
,
ZIO_MAJOR_VERSION
,
ZIO_MINOR_VERSION
);
__ZIO_MAJOR_VERSION
,
__
ZIO_MINOR_VERSION
);
exit
(
1
);
exit
(
1
);
}
}
if
(
ctrl
.
minor_version
!=
ZIO_MINOR_VERSION
)
{
if
(
ctrl
.
minor_version
!=
__
ZIO_MINOR_VERSION
)
{
static
int
warned
;
static
int
warned
;
if
(
!
warned
++
)
if
(
!
warned
++
)
...
...
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