[Open-FCoE] [PATCH 2/2] libfc: used exch destructor callback in fcp

Dev, Vasu vasu.dev at intel.com
Wed Sep 10 22:48:00 UTC 2008


>-----Original Message-----
>From: Mike Christie [mailto:michaelc at cs.wisc.edu]
>> + */
>> +static void fc_fcp_pkt_destroy(struct fc_seq *sp, void *arg)
>> +{
>> +	struct fc_fcp_pkt *fsp = arg;
>> +	fc_fcp_pkt_release(fsp);
>
>you can just pass arg right to fc_fcp_pkt_release because arg is void.
>

Done, removed fsp from this function and applied this patch to tree.
Thanks

At one point, I considered using fc_fcp_pkt_release() directly as exch
destructor callback since additional sp to fc_fcp_pkt_destroy() is not
required/used by current fcp code but that would have not worked as is
without masking compiler warning since I needed to pass void ptr arg to
exch destructor callback to have a generic destructor callback interface
from exch layer and fc_fcp_pkt_release expects fsp pointer to callback.
The gcc would have given incompatible pointer type warning without ugly
type cast "(void (*)(void *))fc_fcp_pkt_release" in setting up
destructor func pointer in this case though difference is only in void
ptr to fsp pointer in this case to argument of callback. Just mentioned
this along passing void ptr to any pointer is okay in direct func call
but not okay for using func pointers with their arguments difference
limited to only void ptr to any pointer. If later was allowed then we
could have removed void arg to all exch resp handlers in other layers
(e.g  fc_lport_flogi_resp()).



More information about the devel mailing list