[OpenAFS-devel] xstat_fs_test, etc

Derrick Brashear shadow@gmail.com
Wed, 29 Jun 2011 12:51:44 -0400


On Tue, Jun 28, 2011 at 8:42 PM, Jeff Blaine <jblaine@kickflop.net> wrote:
> On 6/28/2011 8:30 PM, Jeff Blaine wrote:
>>
>> 4. Moving the poller into a common C file instead of
>> duplicating it as it is in the existing xstat_*_test.c
>> files means either
>>
>> a) We agree that the "Handler" function is
>> always named the same, such as xstatHandler
>>
>> b) We add yet another argument to poller()
>> for passing in the handler function
>>
>> I'm speaking of the handler passed to xstat_cm_Init()
>>
>> Comments?
>
> Actually, I see no way of sanely making this 1 poller
> unless a lot more is agreed on for uniform naming.
>
> These are all called from the old RunTheTest in
> each *_test binary, which is what was extracted
> from xstat_fs_test as poller():
>
> xstat_fs_test =A0 =A0 =A0 =A0xstat_cm_test
> ------------- =A0 =A0 =A0 =A0-------------
> FS_Handler =A0 =A0 =A0 =A0 =A0 CM_Handler
> xstat_fs_Init =A0 =A0 =A0 =A0xstat_cm_Init
> xstat_fs_Cleanup =A0 =A0 xstat_cm_Cleanup
>
> So unless anyone has any clever ideas, there's going
> to be a cmpoller() and fspoller() with 90% identical
> code.
>

struct poller_func {
 int (*handler) (void);
 int (*init) (int, struct sockaddr_in *, int, int (*) (void), int,
int, afs_int32*);
 int (*cleanup) (int);
};

fill in with appropriate values. pass as rock. call the rock's
handler, init and cleanup. the duplicated code is now just the rock
population.



--=20
Derrick