file: properly use container_of() to not trip type safety warnings

This commit is contained in:
Jo-Philipp Wich 2013-04-16 21:21:25 +02:00
parent dfa1d802b2
commit 6a00d27ae5

8
file.c
View file

@ -381,7 +381,7 @@ static void
rpc_file_exec_opipe_read_cb(struct ustream *s, int bytes) rpc_file_exec_opipe_read_cb(struct ustream *s, int bytes)
{ {
struct rpc_file_exec_context *c = struct rpc_file_exec_context *c =
container_of(s, struct rpc_file_exec_context, opipe); container_of(s, struct rpc_file_exec_context, opipe.stream);
if (ustream_read_buf_full(s)) if (ustream_read_buf_full(s))
rpc_file_exec_reply(c, UBUS_STATUS_NOT_SUPPORTED); rpc_file_exec_reply(c, UBUS_STATUS_NOT_SUPPORTED);
@ -391,7 +391,7 @@ static void
rpc_file_exec_epipe_read_cb(struct ustream *s, int bytes) rpc_file_exec_epipe_read_cb(struct ustream *s, int bytes)
{ {
struct rpc_file_exec_context *c = struct rpc_file_exec_context *c =
container_of(s, struct rpc_file_exec_context, epipe); container_of(s, struct rpc_file_exec_context, epipe.stream);
if (ustream_read_buf_full(s)) if (ustream_read_buf_full(s))
rpc_file_exec_reply(c, UBUS_STATUS_NOT_SUPPORTED); rpc_file_exec_reply(c, UBUS_STATUS_NOT_SUPPORTED);
@ -401,7 +401,7 @@ static void
rpc_file_exec_opipe_state_cb(struct ustream *s) rpc_file_exec_opipe_state_cb(struct ustream *s)
{ {
struct rpc_file_exec_context *c = struct rpc_file_exec_context *c =
container_of(s, struct rpc_file_exec_context, opipe); container_of(s, struct rpc_file_exec_context, opipe.stream);
if (c->opipe.stream.eof && c->epipe.stream.eof) if (c->opipe.stream.eof && c->epipe.stream.eof)
rpc_file_exec_reply(c, UBUS_STATUS_OK); rpc_file_exec_reply(c, UBUS_STATUS_OK);
@ -411,7 +411,7 @@ static void
rpc_file_exec_epipe_state_cb(struct ustream *s) rpc_file_exec_epipe_state_cb(struct ustream *s)
{ {
struct rpc_file_exec_context *c = struct rpc_file_exec_context *c =
container_of(s, struct rpc_file_exec_context, epipe); container_of(s, struct rpc_file_exec_context, epipe.stream);
if (c->opipe.stream.eof && c->epipe.stream.eof) if (c->opipe.stream.eof && c->epipe.stream.eof)
rpc_file_exec_reply(c, UBUS_STATUS_OK); rpc_file_exec_reply(c, UBUS_STATUS_OK);