Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/adt/measured_strings.c

    r61bfc370 r6b82009  
    7474        new->length = length;
    7575        new->value = ((uint8_t *) new) + sizeof(measured_string_t);
    76         // append terminating zero explicitly - to be safe
     76        /* Append terminating zero explicitly - to be safe */
    7777        memcpy(new->value, string, new->length);
    7878        new->value[new->length] = '\0';
     
    297297 * size has to be negotiated in advance.
    298298 *
    299  * @param[in] phone     The other module phone.
     299 * @param[in] exch      Exchange.
    300300 * @param[out] strings  The returned measured strings array.
    301301 * @param[out] data     The measured strings data. This memory block stores the
     
    304304 * @return              EOK on success.
    305305 * @return              EINVAL if the strings or data parameter is NULL.
    306  * @return              EINVAL if the phone or count parameter is not positive.
     306 * @return              EINVAL if the exch or count parameter is invalid.
    307307 * @return              EINVAL if the sent array differs in size.
    308308 * @return              ENOMEM if there is not enough memory left.
     
    310310 *                      async_data_read_start() function.
    311311 */
    312 int
    313 measured_strings_return(int phone, measured_string_t **strings, uint8_t **data,
    314     size_t count)
     312int measured_strings_return(async_exch_t *exch, measured_string_t **strings,
     313    uint8_t **data, size_t count)
    315314{
    316315        size_t *lengths;
     
    319318        int rc;
    320319
    321         if ((phone < 0) || (!strings) || (!data) || (count <= 0))
     320        if ((exch == NULL) || (!strings) || (!data) || (count <= 0))
    322321                return EINVAL;
    323322
     
    326325                return ENOMEM;
    327326
    328         rc = async_data_read_start(phone, lengths,
     327        rc = async_data_read_start(exch, lengths,
    329328            sizeof(size_t) * (count + 1));
    330329        if (rc != EOK) {
     
    351350                (*strings)[index].length = lengths[index];
    352351                if (lengths[index] > 0) {
    353                         rc = async_data_read_start(phone, next, lengths[index]);
     352                        rc = async_data_read_start(exch, next, lengths[index]);
    354353                        if (rc != EOK) {
    355354                                free(lengths);
     
    375374 * size has to be negotiated in advance.
    376375 *
    377  * @param[in] phone     The other module phone.
     376 * @param[in] exch      Exchange.
    378377 * @param[in] strings   The measured strings array to be transferred.
    379378 * @param[in] count     The measured strings array size.
    380379 * @return              EOK on success.
    381380 * @return              EINVAL if the strings parameter is NULL.
    382  * @return              EINVAL if the phone or count parameter is not positive.
     381 * @return              EINVAL if the exch or count parameter is invalid.
    383382 * @return              Other error codes as defined for the
    384383 *                      async_data_write_start() function.
    385384 */
    386 int
    387 measured_strings_send(int phone, const measured_string_t *strings,
     385int measured_strings_send(async_exch_t *exch, const measured_string_t *strings,
    388386    size_t count)
    389387{
     
    392390        int rc;
    393391
    394         if ((phone < 0) || (!strings) || (count <= 0))
     392        if ((exch == NULL) || (!strings) || (count <= 0))
    395393                return EINVAL;
    396394
     
    399397                return ENOMEM;
    400398
    401         rc = async_data_write_start(phone, lengths,
     399        rc = async_data_write_start(exch, lengths,
    402400            sizeof(size_t) * (count + 1));
    403401        if (rc != EOK) {
     
    410408        for (index = 0; index < count; index++) {
    411409                if (strings[index].length > 0) {
    412                         rc = async_data_write_start(phone, strings[index].value,
     410                        rc = async_data_write_start(exch, strings[index].value,
    413411                            strings[index].length);
    414412                        if (rc != EOK)
     
    422420/** @}
    423421 */
    424 
Note: See TracChangeset for help on using the changeset viewer.