Message ID | 157981918030.502116.11086856862222322471.stgit@chester (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | selinux-testsuite: move variable definitions out of binder_common.h | expand |
On 1/23/20 5:39 PM, Paul Moore wrote: > From: Paul Moore <paul@paul-moore.com> > > Move the definitions of variables out of binder_common.h and into > binder_common.c in order to prevent compiler errors. > > Signed-off-by: Paul Moore <paul@paul-moore.com> Acked-by: Stephen Smalley <sds@tycho.nsa.gov> > --- > tests/binder/binder_common.c | 4 ++++ > tests/binder/binder_common.h | 15 +++++++++++---- > 2 files changed, 15 insertions(+), 4 deletions(-) > > diff --git a/tests/binder/binder_common.c b/tests/binder/binder_common.c > index 224238b..7cf6c74 100644 > --- a/tests/binder/binder_common.c > +++ b/tests/binder/binder_common.c > @@ -16,6 +16,10 @@ > > #include "binder_common.h" > > +bool verbose; > +enum binder_test_fd_t fd_type; > +char *fd_type_str; > + > const char *cmd_name(uint32_t cmd) > { > switch (cmd) { > diff --git a/tests/binder/binder_common.h b/tests/binder/binder_common.h > index f0245f3..f60860e 100644 > --- a/tests/binder/binder_common.h > +++ b/tests/binder/binder_common.h > @@ -1,3 +1,6 @@ > +#ifndef _BINDER_COMMON_H > +#define _BINDER_COMMON_H > + > #include <errno.h> > #include <fcntl.h> > #include <inttypes.h> > @@ -42,16 +45,20 @@ enum { > #define TEST_SERVICE_GET 290317 /* Sent by Client */ > #define TEST_SERVICE_SEND_FD 311019 /* Sent by Client */ > > -bool verbose; > +extern bool verbose; > > const char *cmd_name(uint32_t cmd); > void print_trans_data(const struct binder_transaction_data *txn_in); > int binder_write(int fd, void *data, size_t len); > > -enum { > +enum binder_test_fd_t { > BINDER_FD, > BPF_MAP_FD, > BPF_PROG_FD, > BPF_TEST > -} fd_type; > -char *fd_type_str; > +}; > +extern enum binder_test_fd_t fd_type; > + > +extern char *fd_type_str; > + > +#endif >
On Fri, Jan 24, 2020 at 9:06 AM Stephen Smalley <sds@tycho.nsa.gov> wrote: > On 1/23/20 5:39 PM, Paul Moore wrote: > > From: Paul Moore <paul@paul-moore.com> > > > > Move the definitions of variables out of binder_common.h and into > > binder_common.c in order to prevent compiler errors. > > > > Signed-off-by: Paul Moore <paul@paul-moore.com> > > Acked-by: Stephen Smalley <sds@tycho.nsa.gov> I'm pretty sure Ondrej is fairly busy right now with DevConf.cz so I went ahead and merged this into the master branch.
diff --git a/tests/binder/binder_common.c b/tests/binder/binder_common.c index 224238b..7cf6c74 100644 --- a/tests/binder/binder_common.c +++ b/tests/binder/binder_common.c @@ -16,6 +16,10 @@ #include "binder_common.h" +bool verbose; +enum binder_test_fd_t fd_type; +char *fd_type_str; + const char *cmd_name(uint32_t cmd) { switch (cmd) { diff --git a/tests/binder/binder_common.h b/tests/binder/binder_common.h index f0245f3..f60860e 100644 --- a/tests/binder/binder_common.h +++ b/tests/binder/binder_common.h @@ -1,3 +1,6 @@ +#ifndef _BINDER_COMMON_H +#define _BINDER_COMMON_H + #include <errno.h> #include <fcntl.h> #include <inttypes.h> @@ -42,16 +45,20 @@ enum { #define TEST_SERVICE_GET 290317 /* Sent by Client */ #define TEST_SERVICE_SEND_FD 311019 /* Sent by Client */ -bool verbose; +extern bool verbose; const char *cmd_name(uint32_t cmd); void print_trans_data(const struct binder_transaction_data *txn_in); int binder_write(int fd, void *data, size_t len); -enum { +enum binder_test_fd_t { BINDER_FD, BPF_MAP_FD, BPF_PROG_FD, BPF_TEST -} fd_type; -char *fd_type_str; +}; +extern enum binder_test_fd_t fd_type; + +extern char *fd_type_str; + +#endif