|
From: John B. <joh...@hp...> - 2006-05-11 17:10:20
|
Aneesh Kumar wrote:
> On 5/11/06, Aneesh Kumar <ane...@gm...> wrote:
>> On 5/11/06, Aneesh Kumar <ane...@gm...> wrote:
>> > Hi John and Brian,
>> >
>> > What is the specific requirment of using XDR within ICS. ? I see
>> > structures like pt_regs being encoded using ics directly. As per our
>> > last discussion most of these structures are marked OOL. So with XDR
>> > we encode them with XDR routines and out then as OOL data. But then if
>> > all the nodes involved in clustering are of same endian do we need to
>> > encode them using XDR routines ?
>> >
>>
>> After looking at the code again i guess i understand what is
>> happening. For structures carrying pointers to another data type we
>> need the XDR param type.
>>
>> I have dropped from the latest ICS code the openssirpcgen. I am right
>> now looking at NFS and understanding how to do the work the same way
>> they are doing.
>>
>>
>
> How about doing it the below way
>
> struct my_struct {
> int a;
> char *data;
> }
>
> cli_encode_xdr_struct_my_struct(cli_handle_t *handle, struct my_struct *p)
> {
> /* scalar type encode inline */
> cli_encode_int(handle, p->a)
> cli_encode_ool_data_t(handle, p->data, length_of_data, NULL, 0);
> }
>
>
>
> By carefully doing this way i guess we should be able to drop XDR and
> rpcgen
You certainly can. It can become painful for complex structures. You
don't necessarily have to encode the pointer data as ool, though. It
depends on the length. (There is a 300 byte limit on inline data.)
John
>
>
> -aneesh
>
|