* [PATCH 0/2] Make fio.h a bit more C++ safe
@ 2014-02-12 14:51 Daniel Gollub
2014-02-12 14:51 ` [PATCH 1/2] Make file.h C++ safe by casting fio_file_flags Daniel Gollub
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Daniel Gollub @ 2014-02-12 14:51 UTC (permalink / raw)
To: fio; +Cc: Daniel Gollub
Following patches allow to include fio.h for a C++ based
(external) ioengine to be compiled with g++.
(Preparing two fio engines: one internal for CEPH RBD
another external for CEPH FileStore)
Daniel Gollub (2):
Make file.h C++ safe by casting fio_file_flags
Make parse.h C++ safe by avoiding "or" keyword
file.h | 4 ++--
options.c | 6 +++---
parse.c | 4 ++--
parse.h | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
--
1.7.10.4
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1/2] Make file.h C++ safe by casting fio_file_flags 2014-02-12 14:51 [PATCH 0/2] Make fio.h a bit more C++ safe Daniel Gollub @ 2014-02-12 14:51 ` Daniel Gollub 2014-02-12 14:51 ` [PATCH 2/2] Make parse.h C++ safe by avoiding "or" keyword Daniel Gollub 2014-02-12 15:26 ` [PATCH 0/2] Make fio.h a bit more C++ safe Jens Axboe 2 siblings, 0 replies; 4+ messages in thread From: Daniel Gollub @ 2014-02-12 14:51 UTC (permalink / raw) To: fio; +Cc: Daniel Gollub Fixes for g++ (4.7.2) following compiler errors when fio.h gets included (e.g. in an external C++ ioengine): --8<--- [...] os/../file.h: In function ‘void fio_file_set_open(fio_file*)’: os/../file.h:142:1: error: invalid conversion from ‘int’ to ‘fio_file_flags’ [-fpermissive] os/../file.h: In function ‘void fio_file_clear_open(fio_file*)’: os/../file.h:142:1: error: invalid conversion from ‘int’ to ‘fio_file_flags’ [-fpermissive] os/../file.h: In function ‘void fio_file_set_closing(fio_file*)’: [...] --->8--- Signed-off-by: Daniel Gollub <d.gollub@telekom.de> --- file.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/file.h b/file.h index d7e05f4..12d2d11 100644 --- a/file.h +++ b/file.h @@ -128,11 +128,11 @@ struct fio_file { #define FILE_FLAG_FNS(name) \ static inline void fio_file_set_##name(struct fio_file *f) \ { \ - (f)->flags |= FIO_FILE_##name; \ + (f)->flags = (enum fio_file_flags) ((f)->flags | FIO_FILE_##name); \ } \ static inline void fio_file_clear_##name(struct fio_file *f) \ { \ - (f)->flags &= ~FIO_FILE_##name; \ + (f)->flags = (enum fio_file_flags) ((f)->flags & ~FIO_FILE_##name); \ } \ static inline int fio_file_##name(struct fio_file *f) \ { \ -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] Make parse.h C++ safe by avoiding "or" keyword 2014-02-12 14:51 [PATCH 0/2] Make fio.h a bit more C++ safe Daniel Gollub 2014-02-12 14:51 ` [PATCH 1/2] Make file.h C++ safe by casting fio_file_flags Daniel Gollub @ 2014-02-12 14:51 ` Daniel Gollub 2014-02-12 15:26 ` [PATCH 0/2] Make fio.h a bit more C++ safe Jens Axboe 2 siblings, 0 replies; 4+ messages in thread From: Daniel Gollub @ 2014-02-12 14:51 UTC (permalink / raw) To: fio; +Cc: Daniel Gollub Fixes for g++ (4.7.2) following compiler errors when fio.h gets included (e.g. in an external C++ ioengine): --8<--- [...] parse.h:31:6: error: expected unqualified-id before ‘or’ token [...] --->8--- Signed-off-by: Daniel Gollub <d.gollub@telekom.de> --- options.c | 6 +++--- parse.c | 4 ++-- parse.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/options.c b/options.c index 57e9af5..a646546 100644 --- a/options.c +++ b/options.c @@ -1901,18 +1901,18 @@ struct fio_option fio_options[FIO_MAX_OPTS] = { { .ival = "wait_before", .oval = SYNC_FILE_RANGE_WAIT_BEFORE, .help = "SYNC_FILE_RANGE_WAIT_BEFORE", - .or = 1, + .orval = 1, }, { .ival = "write", .oval = SYNC_FILE_RANGE_WRITE, .help = "SYNC_FILE_RANGE_WRITE", - .or = 1, + .orval = 1, }, { .ival = "wait_after", .oval = SYNC_FILE_RANGE_WAIT_AFTER, .help = "SYNC_FILE_RANGE_WAIT_AFTER", - .or = 1, + .orval = 1, }, }, .type = FIO_OPT_STR_MULTI, diff --git a/parse.c b/parse.c index 6141c91..f74f0a9 100644 --- a/parse.c +++ b/parse.c @@ -415,14 +415,14 @@ static int __handle_option(struct fio_option *o, const char *ptr, void *data, if (!strncmp(vp->ival, ptr, str_match_len(vp, ptr))) { ret = 0; if (o->roff1) { - if (vp->or) + if (vp->orval) *(unsigned int *) o->roff1 |= vp->oval; else *(unsigned int *) o->roff1 = vp->oval; } else { if (!o->off1) continue; - val_store(ilp, vp->oval, o->off1, vp->or, data); + val_store(ilp, vp->oval, o->off1, vp->orval, data); } continue; } diff --git a/parse.h b/parse.h index 34d99d4..b98b514 100644 --- a/parse.h +++ b/parse.h @@ -28,7 +28,7 @@ struct value_pair { const char *ival; /* string option */ unsigned int oval; /* output value */ const char *help; /* help text for sub option */ - int or; /* OR value */ + int orval; /* OR value */ void *cb; /* sub-option callback */ }; -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] Make fio.h a bit more C++ safe 2014-02-12 14:51 [PATCH 0/2] Make fio.h a bit more C++ safe Daniel Gollub 2014-02-12 14:51 ` [PATCH 1/2] Make file.h C++ safe by casting fio_file_flags Daniel Gollub 2014-02-12 14:51 ` [PATCH 2/2] Make parse.h C++ safe by avoiding "or" keyword Daniel Gollub @ 2014-02-12 15:26 ` Jens Axboe 2 siblings, 0 replies; 4+ messages in thread From: Jens Axboe @ 2014-02-12 15:26 UTC (permalink / raw) To: Daniel Gollub, fio; +Cc: Daniel Gollub On 02/12/2014 07:51 AM, Daniel Gollub wrote: > Following patches allow to include fio.h for a C++ based > (external) ioengine to be compiled with g++. > > (Preparing two fio engines: one internal for CEPH RBD > another external for CEPH FileStore) > > Daniel Gollub (2): > Make file.h C++ safe by casting fio_file_flags > Make parse.h C++ safe by avoiding "or" keyword Thanks, applied both of them. You missed goptions.c for the ->or change, caught that and fixed it. -- Jens Axboe ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-02-12 15:26 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-02-12 14:51 [PATCH 0/2] Make fio.h a bit more C++ safe Daniel Gollub 2014-02-12 14:51 ` [PATCH 1/2] Make file.h C++ safe by casting fio_file_flags Daniel Gollub 2014-02-12 14:51 ` [PATCH 2/2] Make parse.h C++ safe by avoiding "or" keyword Daniel Gollub 2014-02-12 15:26 ` [PATCH 0/2] Make fio.h a bit more C++ safe Jens Axboe
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox