~ubuntu-branches/ubuntu/precise/corosync/precise-proposed

« back to all changes in this revision

Viewing changes to lib/confdb.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Loschwitz
  • Date: 2011-10-19 14:32:18 UTC
  • mfrom: (1.1.6 upstream) (5.1.16 sid)
  • Revision ID: james.westby@ubuntu.com-20111019143218-ew8phl0raqyog844
Tags: 1.4.2-1
* Changed my email address in debian/control
* Add corosync-blackbox to the corosync package
* Imported Upstream version 1.4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
575
575
        return (error);
576
576
}
577
577
 
 
578
cs_error_t confdb_object_name_get (
 
579
        confdb_handle_t handle,
 
580
        hdb_handle_t object_handle,
 
581
        char *object_name,
 
582
        size_t *object_name_len)
 
583
{
 
584
        cs_error_t error;
 
585
        struct confdb_inst *confdb_inst;
 
586
        struct iovec iov;
 
587
        struct req_lib_confdb_object_name_get request;
 
588
        struct res_lib_confdb_object_name_get response;
 
589
 
 
590
        error = hdb_error_to_cs(hdb_handle_get (&confdb_handle_t_db, handle, (void *)&confdb_inst));
 
591
        if (error != CS_OK) {
 
592
                return (error);
 
593
        }
 
594
 
 
595
        if (confdb_inst->standalone) {
 
596
                error = CS_OK;
 
597
 
 
598
                if (confdb_sa_object_name_get(object_handle, object_name, object_name_len))
 
599
                        error = CS_ERR_ACCESS;
 
600
                goto error_exit;
 
601
        }
 
602
 
 
603
        request.header.size = sizeof (struct req_lib_confdb_object_name_get);
 
604
        request.header.id = MESSAGE_REQ_CONFDB_OBJECT_NAME_GET;
 
605
        request.object_handle = object_handle;
 
606
 
 
607
        iov.iov_base = (char *)&request;
 
608
        iov.iov_len = sizeof (struct req_lib_confdb_object_name_get);
 
609
 
 
610
        error = coroipcc_msg_send_reply_receive (
 
611
                confdb_inst->handle,
 
612
                &iov,
 
613
                1,
 
614
                &response,
 
615
                sizeof (struct res_lib_confdb_object_name_get));
 
616
 
 
617
        if (error != CS_OK) {
 
618
                goto error_exit;
 
619
        }
 
620
 
 
621
        error = response.header.error;
 
622
        if (error == CS_OK) {
 
623
                *object_name_len = response.object_name.length;
 
624
                memcpy(object_name, response.object_name.value, *object_name_len);
 
625
        }
 
626
 
 
627
error_exit:
 
628
        (void)hdb_handle_put (&confdb_handle_t_db, handle);
 
629
 
 
630
        return (error);
 
631
}
 
632
 
578
633
static cs_error_t do_find_destroy(
579
634
        struct confdb_inst *confdb_inst,
580
635
        hdb_handle_t find_handle)