Hello, Please find the attached patch for correcting this problem. If the IsSupported is equal to 'False', then Type and Value will be set to zero in saHpiSensorReadingGet() function.
Kindly review. Regards, PG ________________________________ From: Peter D Phan [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 03, 2008 8:44 PM To: [email protected] Subject: Re: [Openhpi-devel] Marshalling asserts for SAF API saHpiSensorReadingGet. PG, We need to correct marshalling code because that is the right place to fix this problem. Option 1 is good to have so that each plugin can keep the infrastructure code to hurt itself. so if you wish you, or the plugin owner, can implement it for OA SOAP. We did that for snmp_bc plugin. But we can not count on all the plugins, especially future ones, to set Type and Value when IsSupported == FALSE. Regards, -------------------------------------------------------------------------------------------- P. D. Phan IBM Austin -------------------------------------------------------------------------------------------- [cid:477065010@05122008-00EF]Raghavendra PG ---12/03/2008 03:34:26 AM---Hello, Raghavendra PG <[EMAIL PROTECTED]> 12/03/2008 03:34 AM Please respond to [email protected] To "[email protected]" <[email protected]> cc Subject [Openhpi-devel] Marshalling asserts for SAF API saHpiSensorReadingGet. Hello, The openhpi daemon is crashing when trying to get the sensor reading on a sensor which is not supporting the reading (IsSupported is set to False). This problem is observed with OA SOAP plugin. We are implementing new set of operational sensors whose reading is not supported. According the SAF HPI spec B.02 section 7.2.5, if the sensor does not support reading, then saHpiSensorReadingGet() should set the IsSupported field in the 'Reading' structure to 'False' (2nd para in Remarks). This means that saHpiSensorReadingGet() API is not setting (changing) the other fields of 'Reading' structure by openhpi plugin. The other fields are important only if the IsSupported is set to 'True'. The marshalling code (marshal.c:477) is asserting when it is trying to marshal the 1st out parameter (SAHPI_INOUT SaHpiSensorReadingT *Reading) of SAF API saHpiSensorReadingGet. The SaHpiSensorReadingT structure has 3 fields. typedef struct { SaHpiBoolT IsSupported; SaHpiSensorReadingTypeT Type; SaHpiSensorReadingUnionT Value; } SaHpiSensorReadingT; If I'm wrong in understanding the marshalling, please correct me. The assertion is happening when marshalling tried on 3rd field (SaHpiSensorReadingUnionT Value) of SaHpiSensorReadingT structure. When IsSupported is set to False, the 'Type' and 'Value' are not set. These fields will have some junk data. When marshal tries to marshal union and it is not able to find the correct value. Hence, marshal code asserts. This is a limitation in marshalling code. It expects all the fields of a return structure to have proper values. POSSIBLE WORKAROUND: --------------------- 1. The plugin should set 'Type' and 'Value' fields of the 'Reading' structure to some value (can be memset) even when IsSupported is set to 'False'. All the plugins needs to (which supports sensor without reading support) implement this approach 2. Set all fields of the Reading structure to zero (using memset) before calling the plugin ABI oh_get_sensor_reading. The plugins need not worry about other fields if the IsSupported is set to 'False'. I'm more inclined towards option 1. Any suggestions, thoughts or other options? Regards, PG ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Openhpi-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openhpi-devel
<<inline: graycol.gif>>
<<inline: ecblank.gif>>
sensor_reading_get_marshalling.patch
Description: sensor_reading_get_marshalling.patch
------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________ Openhpi-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openhpi-devel
