[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Jun 2 11:04:14 MDT 2011


On Thu, Jun 02, 2011 at 09:40:48AM +0930, Rusty Russell wrote:
> On Wed, 1 Jun 2011 11:57:08 +0200, Volker Lendecke <Volker.Lendecke at SerNet.DE> wrote:
> > On Wed, Jun 01, 2011 at 11:48:02AM +0200, Rusty Russell wrote:
> > >  	for (i = 0; i < state->request.count; i++) {
> > > -		end = tevent_timeval_add(&end, 0, state->request.delay);
> > > +		end = tevent_timeval_add(&end, state->request.delay / 1000000,
> > > +					 state->request.delay % 1000000);
> > 
> > Wouldn't it be smarter to add that knowledge to timeval_add
> > than to add the burden to all callers?
> > 
> > Volker
> 
> That's what I did for lib/util/time.c by creating explicit
> timeval_current_ofs_msec() and timeval_current_ofs_usec() routines.  I
> think that's clearer.  But I didn't want to introduce a new (public)
> tevent_ function for this which would have a single user.
> 
> I think the real answer is that our timeval handling routines could be
> overhauled to always deal pass 'struct timeval' and return them, eg:
> 
> struct timeval time_now(void);
> struct timeval time_sub(struct timeval recent, struct timeval old);
> struct timeval time_add(struct timeval a, struct timeval b);
> struct timeval time_divide(struct timeval t, unsigned long div);
> struct timeval time_multiply(struct timeval t, unsigned long mult);
> uint64_t time_to_msec(struct timeval t);
> uint64_t time_to_usec(struct timeval t);
> struct timeval time_from_msec(uint64_t msec);
> struct timeval time_from_usec(uint64_t usec);
> 
> This makes it easier to chain them, and do what this is really trying to do:
> 
> 	now = tevent_timeval_current();
> 	end = now;
> 	for (i = 0; i < state->request.count; i++) {
> 		end = tevent_timeval_add(&end, state->request.delay / 1000000,
> 					 state->request.delay % 1000000);
> 	}
> 
> 	if (!tevent_req_set_endtime(req, state->caller.cldap->event.ctx, end)) {
> 
> as:
>         duration = time_multiply(time_usec(state->request.delay),
>                                  state->request.count);
> 	if (!tevent_req_set_endtime(req, state->caller.cldap->event.ctx,
>                                     time_add(time_current(), duration)))
>         {
> 
> What do you think?

Looks good to me. The one thing I really need to know is how
many of the changes to master fixed bugs that are still in v3-6-test ?

Were most of these fixes protection against insane parameter
values in smb.conf, or were they fixes for actual timing bugs ?

Thansk,

Jeremy.


More information about the samba-technical mailing list