Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
Mock Turtle
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Mock Turtle
Commits
5f49bbaa
Commit
5f49bbaa
authored
Aug 06, 2015
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrtd:lib: API change, do not set default log level on open
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
14e259fc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
45 deletions
+20
-45
libwrtd-logging.c
applications/wrtd/lib/libwrtd-logging.c
+16
-37
libwrtd.h
applications/wrtd/lib/libwrtd.h
+2
-6
wrtd-logging.c
applications/wrtd/tools/wrtd-logging.c
+2
-2
No files found.
applications/wrtd/lib/libwrtd-logging.c
View file @
5f49bbaa
...
...
@@ -97,14 +97,13 @@ enum wrtd_log_level wrtd_strlogging_to_level(char *log)
* logging level will be applied to all device channels. You can change it
* later using wrtd_log_level_set()
* @param[in] dev device token
* @param[in] lvl default logging level
* @param[in] input channel number [-1, 4]. [-1] for all channels, [0,4] for a
* specific one.
* @param[in] core WRTD core to use
* @return a HMQ token on success, NULL on error and errno is set appropriately
*/
static
struct
wrnc_hmq
*
wrtd_log_open
(
struct
wrtd_node
*
dev
,
uint32_t
lvl
,
int
channel
,
int
channel
,
enum
wrtd_core
core
)
{
struct
wrtd_desc
*
wrtd
=
(
struct
wrtd_desc
*
)
dev
;
...
...
@@ -125,37 +124,22 @@ static struct wrnc_hmq *wrtd_log_open(struct wrtd_node *dev,
return
NULL
;
}
if
(
channel
>
-
1
)
{
if
(
core
==
WRTD_CORE_IN
)
err
=
wrtd_in_log_level_set
(
dev
,
channel
,
lvl
);
else
err
=
wrtd_out_log_level_set
(
dev
,
channel
,
lvl
);
if
(
err
)
return
NULL
;
hmq
=
wrnc_hmq_open
(
wrtd
->
wrnc
,
hmq_back_index
,
0
);
if
(
!
hmq
)
return
NULL
;
hmq
=
wrnc_hmq_open
(
wrtd
->
wrnc
,
hmq_back_index
,
0
);
if
(
!
hmq
)
return
NULL
;
if
(
channel
>
-
1
)
{
/* the user want to filter per channel */
err
=
wrnc_hmq_filter_add
(
hmq
,
&
filter
);
if
(
err
)
{
wrnc_hmq_close
(
hmq
);
return
NULL
;
}
}
else
{
/* Set the same logging level to all channels */
for
(
i
=
0
;
i
<
n_chan
;
++
i
)
{
if
(
core
==
WRTD_CORE_IN
)
err
=
wrtd_in_log_level_set
(
dev
,
i
,
lvl
);
else
err
=
wrtd_out_log_level_set
(
dev
,
i
,
lvl
);
if
(
err
)
return
NULL
;
}
hmq
=
wrnc_hmq_open
(
wrtd
->
wrnc
,
hmq_back_index
,
0
);
if
(
err
)
goto
out_close
;
}
return
hmq
;
out_close:
wrnc_hmq_close
(
hmq
);
return
NULL
;
}
...
...
@@ -264,16 +248,13 @@ static int wrtd_log_level_set(struct wrtd_node *dev, unsigned int channel,
* logging level will be applied to all device channels. You can change it
* later using wrtd_out_log_level_set()
* @param[in] dev device token
* @param[in] lvl default logging level
* @param[in] output channel number [-1, 3]. [-1] for all channels, [0,3] for a
* specific one.
* @return a HMQ token on success, NULL on error and errno is set appropriately
*/
struct
wrnc_hmq
*
wrtd_out_log_open
(
struct
wrtd_node
*
dev
,
uint32_t
lvl
,
int
output
)
struct
wrnc_hmq
*
wrtd_out_log_open
(
struct
wrtd_node
*
dev
,
int
output
)
{
return
wrtd_log_open
(
dev
,
lvl
,
output
,
WRTD_CORE_OUT
);
return
wrtd_log_open
(
dev
,
output
,
WRTD_CORE_OUT
);
}
...
...
@@ -324,11 +305,9 @@ int wrtd_out_log_level_get(struct wrtd_node *dev, unsigned int input,
* specific one.
* @return a HMQ token on success, NULL on error and errno is set appropriately
*/
struct
wrnc_hmq
*
wrtd_in_log_open
(
struct
wrtd_node
*
dev
,
uint32_t
lvl
,
int
input
)
struct
wrnc_hmq
*
wrtd_in_log_open
(
struct
wrtd_node
*
dev
,
int
input
)
{
return
wrtd_log_open
(
dev
,
lvl
,
input
,
WRTD_CORE_IN
);
return
wrtd_log_open
(
dev
,
input
,
WRTD_CORE_IN
);
}
...
...
applications/wrtd/lib/libwrtd.h
View file @
5f49bbaa
...
...
@@ -194,9 +194,7 @@ extern void wrtd_strlogging_full(char *buf, uint32_t log_level);
extern
int
wrtd_log_read
(
struct
wrnc_hmq
*
hmq_log
,
struct
wrtd_log_entry
*
log
,
int
count
);
extern
void
wrtd_log_close
(
struct
wrnc_hmq
*
hmq
);
extern
struct
wrnc_hmq
*
wrtd_in_log_open
(
struct
wrtd_node
*
dev
,
uint32_t
lvl
,
int
input
);
extern
struct
wrnc_hmq
*
wrtd_in_log_open
(
struct
wrtd_node
*
dev
,
int
input
);
extern
int
wrtd_in_log_level_set
(
struct
wrtd_node
*
dev
,
unsigned
int
input
,
uint32_t
log_level
);
extern
int
wrtd_in_log_level_get
(
struct
wrtd_node
*
dev
,
unsigned
int
input
,
...
...
@@ -205,9 +203,7 @@ extern int wrtd_out_log_level_set(struct wrtd_node *dev, unsigned int output,
uint32_t
log_level
);
extern
int
wrtd_out_log_level_get
(
struct
wrtd_node
*
dev
,
unsigned
int
input
,
uint32_t
*
log_level
);
extern
struct
wrnc_hmq
*
wrtd_out_log_open
(
struct
wrtd_node
*
dev
,
uint32_t
lvl
,
int
output
);
extern
struct
wrnc_hmq
*
wrtd_out_log_open
(
struct
wrtd_node
*
dev
,
int
output
);
/**@}*/
...
...
applications/wrtd/tools/wrtd-logging.c
View file @
5f49bbaa
...
...
@@ -126,7 +126,7 @@ int main(int argc, char *argv[])
}
/* Open logging interfaces */
log
[
0
]
=
wrtd_in_log_open
(
wrtd
,
WRTD_LOG_ALL
,
chan
);
log
[
0
]
=
wrtd_in_log_open
(
wrtd
,
chan
);
if
(
!
log
[
0
])
{
fprintf
(
stderr
,
"Cannot open input logging HMQ: %s
\n
"
,
wrtd_strerror
(
errno
));
...
...
@@ -135,7 +135,7 @@ int main(int argc, char *argv[])
p
[
0
].
fd
=
log
[
0
]
->
fd
;
p
[
0
].
events
=
POLLIN
;
log
[
1
]
=
wrtd_out_log_open
(
wrtd
,
WRTD_LOG_ALL
,
chan
);
log
[
1
]
=
wrtd_out_log_open
(
wrtd
,
chan
);
if
(
!
log
[
1
])
{
fprintf
(
stderr
,
"Cannot open output logging HMQ: %s
\n
"
,
wrtd_strerror
(
errno
));
...
...
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