Chunk: Use CLD timers
PATCH 5/12 Chunk: Use CLD timers
Since ncld uses CLD timers and thus we had to have them in libcldc, we may as well use them in Chunk. This gives us an automatic importation of bugfixes.
Signed-off-by Pete Zaitcev <[email protected]>
--- server/chunkd.h | 27 ++------------ server/cldu.c | 4 +- server/util.c | 84 +++++----------------------------------------- 3 files changed, 17 insertions(+), 98 deletions(-)
commit 6a7f28a8a6312e06c075032aeaa4741f5cbde2f2
Author: Master <[email protected]> Date: Sat Apr 17 19:39:56 2010 -0600
Switch chunkd to the CLD's timer (auto-import bugfixes).
server/chunkd.h +5 -22
@@ -28,6 +28,7 @@#include <chunk_msg.h> #include <hail_log.h> #include <tchdb.h> +#include <cldc.h> /* for cld_timer */ #include <objcache.h> #ifndef ARRAY_SIZE
@@ -57,15 +58,6 @@ struct client_write;typedef bool (*cli_evt_func )(struct client *,unsigned int );typedef bool (*cli_write_func )(struct client *,struct client_write *,bool ); -struct timer { -bool fired; -bool on_list; -void (*cb)(struct timer *); -void *userdata; -time_t expires; -char name[32 ]; -}; -struct client_write {const void *buf;/* write buffer */ uint64_t len;/* write buffer length */
@@ -303,23 +295,14 @@ extern void syslogerr(const char *prefix);extern void strup (char *s);extern int write_pid_file (const char *pid_fn);extern int fsetflags (const char *prefix,int fd,int or_flags); -extern void timer_add (struct timer *timer,time_t expires); -extern void timer_del (struct timer *timer); +extern void timer_init (struct cld_timer *timer,const char *name, +void (*cb)(struct cld_timer *),void *userdata); +extern void timer_add (struct cld_timer *timer,time_t expires); +extern void timer_del (struct cld_timer *timer);extern time_t timers_run (void );extern char *time2str (char *strbuf,time_t time);extern void hexstr (const unsigned char *buf,size_t buf_len,char *outstr); -static inline void timer_init (struct timer *timer,const char *name, -void (*cb)(struct timer *), -void *userdata) -{ -memset (timer,0 ,sizeof (*timer)); - timer->cb = cb; - timer->userdata = userdata; -strncpy (timer->name, name,sizeof (timer->name)); - timer->name[sizeof (timer->name) -1 ] =0 ; -} -/* server.c */ extern SSL_CTX *ssl_ctx;extern int debugging;
server/cldu.c +2 -2
@@ -46,7 +46,7 @@ struct cld_session {int actx;/* Active host cldv[actx] */ struct cld_host cldv[N_CLD ]; -struct timer timer; +struct cld_timer timer;char *ffname;struct ncld_fh *ffh;/* keep open for lock */
@@ -95,7 +95,7 @@ static void cldu_saveargs(struct cld_session *sp, char *infopath, sp->ploc = loc; } -static void cldu_timer_event (struct timer *timer) +static void cldu_timer_event (struct cld_timer *timer) {struct cld_session *cs = timer->userdata;int newactive;
server/util.c +10 -74
107 lines not on this page · raw message
Quoted 11 lines · Pete Zaitcev
Since ncld uses CLD timers and thus we had to have them in libcldc, we may as well use them in Chunk. This gives us an automatic importation of bugfixes.
Signed-off-by Pete Zaitcev<[email protected]>--- server/chunkd.h | 27 ++------------ server/cldu.c | 4 +- server/util.c | 84 +++++----------------------------------------- 3 files changed, 17 insertions(+), 98 deletions(-)
I think the need for a "libhail" is becoming clear...
Quoted 11 lines · Pete Zaitcev
Since ncld uses CLD timers and thus we had to have them in libcldc, we may as well use them in Chunk. This gives us an automatic importation of bugfixes.
Signed-off-by Pete Zaitcev<[email protected]>--- server/chunkd.h | 27 ++------------ server/cldu.c | 4 +- server/util.c | 84 +++++----------------------------------------- 3 files changed, 17 insertions(+), 98 deletions(-)
applied 5-8