[sheepdog] [PATCH v7 6/6] sheep: add a cluster driver for shepherd

Hitoshi Mitake mitake.hitoshi at gmail.com
Mon Mar 11 06:36:31 CET 2013


At Mon, 11 Mar 2013 13:27:15 +0800,
Liu Yuan wrote:
> 
> On 03/11/2013 11:48 AM, Hitoshi Mitake wrote:
> > +static void read_msg_from_shepherd(void)
> > +{
> > +	switch (state) {
> > +	case STATE_PRE_JOIN:
> > +		read_msg_pre_join();
> > +		break;
> > +	case STATE_JOINED:
> > +		read_msg();
> 
> For read_msg and read_msg_pre_join, you actually do more than 'read msg'
> by actually handling the message.
> 
> So I'd suggest a helper read message and pass the rcv message to switch
> statements.
> 

Yes, the names are not so good. I'll implement a helper for reading message.

> By the way, the main proper of read_msg() is very big. How about
> translating each case handling into function pointers similar to
> zk_event_handlers ?
> 

OK, I'll split the function into finer grain.

Thanks,
Hitoshi



More information about the sheepdog mailing list