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)
...
@@ -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
* logging level will be applied to all device channels. You can change it
* later using wrtd_log_level_set()
* later using wrtd_log_level_set()
* @param[in] dev device token
* @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
* @param[in] input channel number [-1, 4]. [-1] for all channels, [0,4] for a
* specific one.
* specific one.
* @param[in] core WRTD core to use
* @param[in] core WRTD core to use
* @return a HMQ token on success, NULL on error and errno is set appropriately
* @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
,
static
struct
wrnc_hmq
*
wrtd_log_open
(
struct
wrtd_node
*
dev
,
uint32_t
lvl
,
int
channel
,
int
channel
,
enum
wrtd_core
core
)
enum
wrtd_core
core
)
{
{
struct
wrtd_desc
*
wrtd
=
(
struct
wrtd_desc
*
)
dev
;
struct
wrtd_desc
*
wrtd
=
(
struct
wrtd_desc
*
)
dev
;
...
@@ -125,37 +124,22 @@ static struct wrnc_hmq *wrtd_log_open(struct wrtd_node *dev,
...
@@ -125,37 +124,22 @@ static struct wrnc_hmq *wrtd_log_open(struct wrtd_node *dev,
return
NULL
;
return
NULL
;
}
}
if
(
channel
>
-
1
)
{
hmq
=
wrnc_hmq_open
(
wrtd
->
wrnc
,
hmq_back_index
,
0
);
if
(
core
==
WRTD_CORE_IN
)
if
(
!
hmq
)
err
=
wrtd_in_log_level_set
(
dev
,
channel
,
lvl
);
return
NULL
;
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
;
if
(
channel
>
-
1
)
{
/* the user want to filter per channel */
err
=
wrnc_hmq_filter_add
(
hmq
,
&
filter
);
err
=
wrnc_hmq_filter_add
(
hmq
,
&
filter
);
if
(
err
)
{
if
(
err
)
wrnc_hmq_close
(
hmq
);
goto
out_close
;
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
);
}
}
return
hmq
;
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,
...
@@ -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
* logging level will be applied to all device channels. You can change it
* later using wrtd_out_log_level_set()
* later using wrtd_out_log_level_set()
* @param[in] dev device token
* @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
* @param[in] output channel number [-1, 3]. [-1] for all channels, [0,3] for a
* specific one.
* specific one.
* @return a HMQ token on success, NULL on error and errno is set appropriately
* @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
,
struct
wrnc_hmq
*
wrtd_out_log_open
(
struct
wrtd_node
*
dev
,
int
output
)
uint32_t
lvl
,
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,
...
@@ -324,11 +305,9 @@ int wrtd_out_log_level_get(struct wrtd_node *dev, unsigned int input,
* specific one.
* specific one.
* @return a HMQ token on success, NULL on error and errno is set appropriately
* @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
,
struct
wrnc_hmq
*
wrtd_in_log_open
(
struct
wrtd_node
*
dev
,
int
input
)
uint32_t
lvl
,
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);
...
@@ -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
,
extern
int
wrtd_log_read
(
struct
wrnc_hmq
*
hmq_log
,
struct
wrtd_log_entry
*
log
,
int
count
);
int
count
);
extern
void
wrtd_log_close
(
struct
wrnc_hmq
*
hmq
);
extern
void
wrtd_log_close
(
struct
wrnc_hmq
*
hmq
);
extern
struct
wrnc_hmq
*
wrtd_in_log_open
(
struct
wrtd_node
*
dev
,
extern
struct
wrnc_hmq
*
wrtd_in_log_open
(
struct
wrtd_node
*
dev
,
int
input
);
uint32_t
lvl
,
int
input
);
extern
int
wrtd_in_log_level_set
(
struct
wrtd_node
*
dev
,
unsigned
int
input
,
extern
int
wrtd_in_log_level_set
(
struct
wrtd_node
*
dev
,
unsigned
int
input
,
uint32_t
log_level
);
uint32_t
log_level
);
extern
int
wrtd_in_log_level_get
(
struct
wrtd_node
*
dev
,
unsigned
int
input
,
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,
...
@@ -205,9 +203,7 @@ extern int wrtd_out_log_level_set(struct wrtd_node *dev, unsigned int output,
uint32_t
log_level
);
uint32_t
log_level
);
extern
int
wrtd_out_log_level_get
(
struct
wrtd_node
*
dev
,
unsigned
int
input
,
extern
int
wrtd_out_log_level_get
(
struct
wrtd_node
*
dev
,
unsigned
int
input
,
uint32_t
*
log_level
);
uint32_t
*
log_level
);
extern
struct
wrnc_hmq
*
wrtd_out_log_open
(
struct
wrtd_node
*
dev
,
extern
struct
wrnc_hmq
*
wrtd_out_log_open
(
struct
wrtd_node
*
dev
,
int
output
);
uint32_t
lvl
,
int
output
);
/**@}*/
/**@}*/
...
...
applications/wrtd/tools/wrtd-logging.c
View file @
5f49bbaa
...
@@ -126,7 +126,7 @@ int main(int argc, char *argv[])
...
@@ -126,7 +126,7 @@ int main(int argc, char *argv[])
}
}
/* Open logging interfaces */
/* 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
])
{
if
(
!
log
[
0
])
{
fprintf
(
stderr
,
"Cannot open input logging HMQ: %s
\n
"
,
fprintf
(
stderr
,
"Cannot open input logging HMQ: %s
\n
"
,
wrtd_strerror
(
errno
));
wrtd_strerror
(
errno
));
...
@@ -135,7 +135,7 @@ int main(int argc, char *argv[])
...
@@ -135,7 +135,7 @@ int main(int argc, char *argv[])
p
[
0
].
fd
=
log
[
0
]
->
fd
;
p
[
0
].
fd
=
log
[
0
]
->
fd
;
p
[
0
].
events
=
POLLIN
;
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
])
{
if
(
!
log
[
1
])
{
fprintf
(
stderr
,
"Cannot open output logging HMQ: %s
\n
"
,
fprintf
(
stderr
,
"Cannot open output logging HMQ: %s
\n
"
,
wrtd_strerror
(
errno
));
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