diff options
author | Gluster Ant <bugzilla-bot@gluster.org> | 2018-09-12 17:22:48 +0530 |
---|---|---|
committer | Nigel Babu <nigelb@redhat.com> | 2018-09-12 17:22:48 +0530 |
commit | 45a71c0548b6fd2c757aa2e7b7671a1411948894 (patch) | |
tree | 2a5a9b73bae47ab53a41166fd041a06612587f48 /libglusterfs/src/rot-buffs.h | |
parent | be77dbbda692792335a8e9e7c02e0c281f003c40 (diff) |
Land clang-format changes
Change-Id: I6f5d8140a06f3c1b2d196849299f8d483028d33b
Diffstat (limited to 'libglusterfs/src/rot-buffs.h')
-rw-r--r-- | libglusterfs/src/rot-buffs.h | 122 |
1 files changed, 63 insertions, 59 deletions
diff --git a/libglusterfs/src/rot-buffs.h b/libglusterfs/src/rot-buffs.h index 8ee5271533e..1e91e83ecf0 100644 --- a/libglusterfs/src/rot-buffs.h +++ b/libglusterfs/src/rot-buffs.h @@ -16,106 +16,110 @@ #include "common-utils.h" typedef struct rbuf_iovec { - struct iovec iov; + struct iovec iov; - struct list_head list; + struct list_head list; } rbuf_iovec_t; -#define RBUF_IOVEC_SIZE (sizeof (rbuf_iovec_t)) +#define RBUF_IOVEC_SIZE (sizeof(rbuf_iovec_t)) typedef struct rbuf_list { - gf_lock_t c_lock; + gf_lock_t c_lock; - pthread_mutex_t b_lock; /* protects this structure */ - pthread_cond_t b_cond; /* signal for writer completion */ + pthread_mutex_t b_lock; /* protects this structure */ + pthread_cond_t b_cond; /* signal for writer completion */ - gf_boolean_t awaiting; + gf_boolean_t awaiting; - unsigned long long pending; /* pending writers */ - unsigned long long completed; /* completed writers */ + unsigned long long pending; /* pending writers */ + unsigned long long completed; /* completed writers */ - rbuf_iovec_t *rvec; /* currently used IO vector */ + rbuf_iovec_t *rvec; /* currently used IO vector */ - struct list_head veclist; /* list of attached rbuf_iov */ + struct list_head veclist; /* list of attached rbuf_iov */ - unsigned long long used; /* consumable entries - attached in ->veclist */ - unsigned long long total; /* total entries in ->veclist (used - during deallocation) */ + unsigned long long used; /* consumable entries + attached in ->veclist */ + unsigned long long total; /* total entries in ->veclist (used + during deallocation) */ - unsigned long seq[2]; /* if interested, this whould store - the start sequence number and the - range */ + unsigned long seq[2]; /* if interested, this whould store + the start sequence number and the + range */ - struct list_head list; /* attachment to rbuf_t */ + struct list_head list; /* attachment to rbuf_t */ } rbuf_list_t; struct rlist_iter { - struct list_head veclist; + struct list_head veclist; - unsigned long long iter; + unsigned long long iter; }; -#define RLIST_ENTRY_COUNT(rlist) rlist->used +#define RLIST_ENTRY_COUNT(rlist) rlist->used -#define rlist_iter_init(riter, rlist) \ - do { \ - (riter)->iter = rlist->used; \ - (riter)->veclist = rlist->veclist; \ - } while (0) +#define rlist_iter_init(riter, rlist) \ + do { \ + (riter)->iter = rlist->used; \ + (riter)->veclist = rlist->veclist; \ + } while (0) -#define rvec_for_each_entry(pos, riter) \ - for (pos = list_entry \ - ((riter)->veclist.next, typeof(*pos), list); \ - (riter)->iter > 0; \ - pos = list_entry \ - (pos->list.next, typeof(*pos), list), \ - --((riter)->iter)) +#define rvec_for_each_entry(pos, riter) \ + for (pos = list_entry((riter)->veclist.next, typeof(*pos), list); \ + (riter)->iter > 0; \ + pos = list_entry(pos->list.next, typeof(*pos), list), \ + --((riter)->iter)) /** * Sequence number assignment routine is called during buffer * switch under rbuff ->lock. */ -typedef void (sequence_fn) (rbuf_list_t *, void *); +typedef void(sequence_fn)(rbuf_list_t *, void *); -#define RLIST_STORE_SEQ(rlist, start, range) \ - do { \ - rlist->seq[0] = start; \ - rlist->seq[1] = range; \ - } while (0) +#define RLIST_STORE_SEQ(rlist, start, range) \ + do { \ + rlist->seq[0] = start; \ + rlist->seq[1] = range; \ + } while (0) -#define RLIST_GET_SEQ(rlist, start, range) \ - do { \ - start = rlist->seq[0]; \ - range = rlist->seq[1]; \ - } while (0) +#define RLIST_GET_SEQ(rlist, start, range) \ + do { \ + start = rlist->seq[0]; \ + range = rlist->seq[1]; \ + } while (0) typedef struct rbuf { - gf_lock_t lock; /* protects "current" rlist */ + gf_lock_t lock; /* protects "current" rlist */ - rbuf_list_t *current; /* cached pointer to first free rlist */ + rbuf_list_t *current; /* cached pointer to first free rlist */ - struct list_head freelist; + struct list_head freelist; } rbuf_t; typedef enum { - RBUF_CONSUMABLE = 1, - RBUF_BUSY, - RBUF_EMPTY, - RBUF_WOULD_STARVE, + RBUF_CONSUMABLE = 1, + RBUF_BUSY, + RBUF_EMPTY, + RBUF_WOULD_STARVE, } rlist_retval_t; /* Initialization/Destruction */ -rbuf_t *rbuf_init (int); -void rbuf_dtor (rbuf_t *); +rbuf_t * +rbuf_init(int); +void +rbuf_dtor(rbuf_t *); /* Producer API */ -char *rbuf_reserve_write_area (rbuf_t *, size_t, void **); -int rbuf_write_complete (void *); +char * +rbuf_reserve_write_area(rbuf_t *, size_t, void **); +int +rbuf_write_complete(void *); /* Consumer API */ -int rbuf_get_buffer (rbuf_t *, void **, sequence_fn *, void *); -int rbuf_wait_for_completion (rbuf_t *, void *, - void (*)(rbuf_list_t *, void *), void *); +int +rbuf_get_buffer(rbuf_t *, void **, sequence_fn *, void *); +int +rbuf_wait_for_completion(rbuf_t *, void *, void (*)(rbuf_list_t *, void *), + void *); #endif |