int cmd_pfs_getid(const char *sel_path, const char *name, int privateid) { hammer2_ioc_pfs_t pfs; int ecode = 0; int fd; uint32_t status; char *pfs_id_str = NULL; if ((fd = hammer2_ioctl_handle(sel_path)) < 0) return(1); bzero(&pfs, sizeof(pfs)); snprintf(pfs.name, sizeof(pfs.name), "%s", name); if (ioctl(fd, HAMMER2IOC_PFS_LOOKUP, &pfs) < 0) { perror("ioctl"); ecode = 1; } else { if (privateid) uuid_to_string(&pfs.pfs_fsid, &pfs_id_str, &status); else uuid_to_string(&pfs.pfs_clid, &pfs_id_str, &status); printf("%s\n", pfs_id_str); free(pfs_id_str); pfs_id_str = NULL; } close(fd); return (ecode); }
mach_port_t AuthHostInstance::lookup(SessionId jobId) { StLock<Mutex> _(*this); mach_port_t pluginhostPort = MACH_PORT_NULL; kern_return_t result; const char *serviceName; /* PR-7483709 const */ uuid_t instanceId = UUID_INITIALIZER_FROM_SESSIONID(jobId); uuid_string_t s; if ((mHostType == securityAgent)) { if (!(session().attributes() & sessionHasGraphicAccess)) CssmError::throwMe(CSSM_ERRCODE_NO_USER_INTERACTION); if (inDarkWake()) CssmError::throwMe(CSSM_ERRCODE_IN_DARK_WAKE); } if (mHostType == securityAgent) serviceName = SECURITYAGENT_BOOTSTRAP_NAME_BASE; else serviceName = AUTHORIZATIONHOST_BOOTSTRAP_NAME_BASE; secdebug("AuthHostInstance", "looking up %s instance %s", serviceName, uuid_to_string(instanceId, s)); // XXX/gh debugging if ((result = bootstrap_look_up3(bootstrap_port, serviceName, &pluginhostPort, 0, instanceId, BOOTSTRAP_SPECIFIC_INSTANCE)) != KERN_SUCCESS) { Syslog::error("error %d looking up %s instance %s", result, serviceName, uuid_to_string(instanceId, s)); } else secdebug("AuthHostInstance", "port = %x", (unsigned int)pluginhostPort); return pluginhostPort; }
static void dump_pfsd(hammer_pseudofs_data_t pfsd, int fd) { struct hammer_ioc_version version; u_int32_t status; char *str = NULL; printf(" sync-beg-tid=0x%016jx\n", (uintmax_t)pfsd->sync_beg_tid); printf(" sync-end-tid=0x%016jx\n", (uintmax_t)pfsd->sync_end_tid); uuid_to_string(&pfsd->shared_uuid, &str, &status); printf(" shared-uuid=%s\n", str); uuid_to_string(&pfsd->unique_uuid, &str, &status); printf(" unique-uuid=%s\n", str); if (pfsd->mirror_flags & HAMMER_PFSD_SLAVE) { printf(" slave\n"); } printf(" label=\"%s\"\n", pfsd->label); if (pfsd->snapshots[0]) printf(" snapshots=\"%s\"\n", pfsd->snapshots); if (pfsd->prune_min < (60 * 60 * 24)) { printf(" prune-min=%02d:%02d:%02d\n", pfsd->prune_min / 60 / 60 % 24, pfsd->prune_min / 60 % 60, pfsd->prune_min % 60); } else if (pfsd->prune_min % (60 * 60 * 24)) { printf(" prune-min=%dd/%02d:%02d:%02d\n", pfsd->prune_min / 60 / 60 / 24, pfsd->prune_min / 60 / 60 % 24, pfsd->prune_min / 60 % 60, pfsd->prune_min % 60); } else { printf(" prune-min=%dd\n", pfsd->prune_min / 60 / 60 / 24); } if (pfsd->mirror_flags & HAMMER_PFSD_SLAVE) { printf(" operating as a SLAVE\n"); } else { printf(" operating as a MASTER\n"); } if (pfsd->snapshots[0] == 0) { bzero(&version, sizeof(version)); if (ioctl(fd, HAMMERIOC_GET_VERSION, &version) < 0) return; if (version.cur_version < 3) { if (pfsd->mirror_flags & HAMMER_PFSD_SLAVE) { printf(" snapshots directory not set for " "slave\n"); } else { printf(" snapshots directory for master " "defaults to <pfs>/snapshots\n"); } } else { printf(" snapshots directory defaults to " "/var/hammer/<pfs>\n"); } } }
int rmnode (lua_State *L) { TreeNode *node = checktree(L, 1); TreeNode *parent = node->parent; int i; char uuid_str[40]; uuid_to_string(&node->uuid, uuid_str); printd("Removing node with uuid %s\n", uuid_str); if (parent != NULL) { uuid_to_string(&parent->uuid, uuid_str); printd("Node has parent with uuid %s. Remove reference from parent's children list.\n", uuid_str); for (i = 0; i < parent->children_count; ++i) { if (parent->children != NULL && parent->children[i] != NULL && 0 == custom_uuid_compare(node->uuid, parent->children[i]->uuid)) { parent->children[i] = NULL; /* free (unref) userdata in parent node */ luaL_unref(L, LUA_REGISTRYINDEX, parent->udreflist[i]); parent->udreflist[i] = LUA_REFNIL; } } } // free node strucrure /* free (unref) userdata in current node */ for (i = 0; i < node->children_count; ++i) { if (node->udreflist != NULL && node->udreflist[i] != LUA_REFNIL) { luaL_unref(L, LUA_REGISTRYINDEX, node->udreflist[i]); node->udreflist[i] = LUA_REFNIL; node->children[i]->parent = NULL; } } if (node->dataType == LUA_TSTRING) free(node->data.charVal); if (node->name) free(node->name); if (node->children) free(node->children); if (node->udreflist) free(node->udreflist); node->udreflist = NULL; node->children = NULL; node->parent = NULL; node->name = NULL; return 0; }
static char * _soap_addressing_generate_id(void) { uuid_t uuid; uint32_t status; char *ret, *buf; uuid_create(&uuid, &status); if (status != uuid_s_ok) { log_error("uuidcreate failed (%s)", _soap_addressing_uuid_error(status)); return NULL; } uuid_to_string(&uuid, &buf, &status); if (status != uuid_s_ok) { log_error("uuid_to_string failed (%s)", _soap_addressing_uuid_error(status)); return NULL; } if (!(ret = (char *)malloc(128))) { log_error("malloc failed (%s)", strerror(errno)); free(buf); return NULL; } sprintf(ret, "%s/%s", soap_server_get_name(), buf); free(buf); return ret; }
static void read_handler(BLECharacteristic characteristic, const uint8_t *value, size_t value_length, uint16_t value_offset, BLEGATTError error) { char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; Uuid characteristic_uuid = ble_characteristic_get_uuid(characteristic); uuid_to_string(&characteristic_uuid, uuid_buffer); APP_LOG(APP_LOG_LEVEL_INFO, "Read Characteristic %s, %u bytes, error: %u", uuid_buffer, value_length, error); for (size_t i = 0; i < value_length; ++i) { APP_LOG(APP_LOG_LEVEL_INFO, "0x%02x", value[i]); } const Uuid node_service_4_uuid = UuidMake(0x18, 0xcd, 0xa7, 0x84, 0x4b, 0xd3, 0x43, 0x70, 0x85, 0xbb, 0xbf, 0xed, 0x91, 0xec, 0x86, 0xaf); // node sensor data incoming if (uuid_equal(&characteristic_uuid, &node_service_4_uuid)) { APP_LOG(APP_LOG_LEVEL_INFO, "Incoming sensor data..."); if(value_length + node_ctx.read_node_buffer_pos > node_ctx.read_node_buffer_max) { process_read_buffer(); node_ctx.read_node_buffer_pos = 0; } char *buff = (char *)&node_ctx.read_node_buffer; memcpy(buff+node_ctx.read_node_buffer_pos, value, value_length); node_ctx.read_node_buffer_pos += value_length; } }
void ficlUuidToString(FICL_VM *pVM) { #ifndef TESTMAIN char *uuid; uint32_t status; #endif uuid_t *u; #if FICL_ROBUST > 1 vmCheckStack(pVM, 1, 0); #endif u = (uuid_t *)stackPopPtr(pVM->pStack); #ifndef TESTMAIN uuid_to_string(u, &uuid, &status); if (status != uuid_s_ok) { stackPushPtr(pVM->pStack, uuid); stackPushINT(pVM->pStack, strlen(uuid)); } else #endif stackPushINT(pVM->pStack, -1); return; }
static void draw_data_row(GContext* ctx, const Layer *cell_layer, MenuIndex *cell_index, void *data) { ScanResult *result = list_get_by_index(cell_index->row); // Build the title string: char title[32]; // Annotate with "NODE" if the device has a heart rate service: char *node_str = result->has_node_service ? "NODE" : ""; // If there is a local name, show it, otherwise use the device address: if (strlen(result->local_name)) { snprintf(title, sizeof(title), "%s %s", result->local_name, node_str); } else { const BTDeviceAddress address = bt_device_get_address(result->device); snprintf(title, sizeof(title), BT_DEVICE_ADDRESS_FMT " %s", BT_DEVICE_ADDRESS_XPLODE(address), node_str); } // Build the subtitle string: char subtitle[UUID_STRING_BUFFER_LENGTH]; if (result->has_services) { // Make a displayable string of the first Service UUID: uuid_to_string(&result->first_service_uuid, subtitle); } else { // If advertisement did not contain Service UUIDs: strncpy(subtitle, "No Service UUIDs", sizeof(subtitle)); } menu_cell_basic_draw(ctx, cell_layer, title, subtitle, NULL); }
static void descriptor_write_handler(BLEDescriptor descriptor, BLEGATTError error) { char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; Uuid descriptor_uuid = ble_descriptor_get_uuid(descriptor); uuid_to_string(&descriptor_uuid, uuid_buffer); APP_LOG(APP_LOG_LEVEL_INFO, "Write response for Descriptor %s (error=%u)", uuid_buffer, error); }
zmq::uuid_t::uuid_t () { uint32_t status; uuid_create (&uuid, &status); zmq_assert (status == uuid_s_ok); uuid_to_string (&uuid, &uuid_str, &status); zmq_assert (status == uuid_s_ok); }
static void write_handler(BLECharacteristic characteristic, BLEGATTError error) { char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; Uuid characteristic_uuid = ble_characteristic_get_uuid(characteristic); uuid_to_string(&characteristic_uuid, uuid_buffer); APP_LOG(APP_LOG_LEVEL_INFO, "Write response for Characteristic %s (error=%u)", uuid_buffer, error); }
static int efi_print_var(CHAR16 *varnamearg, EFI_GUID *matchguid, int lflag) { UINTN datasz, i; EFI_STATUS status; UINT32 attr; CHAR16 *data; char *str; uint32_t uuid_status; int is_ascii; datasz = 0; status = RS->GetVariable(varnamearg, matchguid, &attr, &datasz, NULL); if (status != EFI_BUFFER_TOO_SMALL) { printf("Can't get the variable: error %#lx\n", status); return (CMD_ERROR); } data = malloc(datasz); status = RS->GetVariable(varnamearg, matchguid, &attr, &datasz, data); if (status != EFI_SUCCESS) { printf("Can't get the variable: error %#lx\n", status); return (CMD_ERROR); } uuid_to_string((uuid_t *)matchguid, &str, &uuid_status); if (lflag) { printf("%s 0x%x %S", str, attr, varnamearg); } else { printf("%s 0x%x %S=", str, attr, varnamearg); is_ascii = 1; free(str); str = (char *)data; for (i = 0; i < datasz - 1; i++) { /* Quick hack to see if this ascii-ish string printable range plus tab, cr and lf */ if ((str[i] < 32 || str[i] > 126) && str[i] != 9 && str[i] != 10 && str[i] != 13) { is_ascii = 0; break; } } if (str[datasz - 1] != '\0') is_ascii = 0; if (is_ascii) printf("%s", str); else { for (i = 0; i < datasz / 2; i++) { if (isalnum(data[i]) || isspace(data[i])) printf("%c", data[i]); else printf("\\x%02x", data[i]); } } } free(data); if (pager_output("\n")) return (CMD_WARN); return (CMD_OK); }
char* pn_i_genuuid(void) { char *generated; uuid_t uuid; uint32_t rc; uuid_create(&uuid, &rc); // Under FreeBSD the returned string is newly allocated from the heap uuid_to_string(&uuid, &generated, &rc); return generated; }
// ------------------------------------------------------------------------ // // Main Functions // ------------------------------------------------------------------------ // void log_app_info() { extern const PebbleProcessInfo __pbl_app_info; LOG("APP Version: %d.%d", __pbl_app_info.process_version.major, __pbl_app_info.process_version.minor); LOG("Name: %s", __pbl_app_info.name); LOG("Company: %s", __pbl_app_info.company); char uuidString[UUID_STRING_BUFFER_LENGTH]; uuid_to_string((Uuid*)&__pbl_app_info.uuid, uuidString); LOG("UUID: %s", uuidString); }
static const char * uuid(uuid_t *id) { static char buffer[64]; char *s; uuid_to_string(id, &s, NULL); strcpy(buffer, s); free(s); return (buffer); }
static void subscribe_handler(BLECharacteristic characteristic, BLESubscription subscription_type, BLEGATTError error) { char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; Uuid characteristic_uuid = ble_characteristic_get_uuid(characteristic); uuid_to_string(&characteristic_uuid, uuid_buffer); APP_LOG(APP_LOG_LEVEL_INFO, "Subscription to Characteristic %s (subscription_type=%u, error=%u)", uuid_buffer, subscription_type, error); }
static int hpss_get_bfid(struct fsal_obj_handle *fsal_obj_hdl, caddr_t buffer_addr, size_t buffer_size, size_t *p_output_size, void *arg) { struct hpss_fsal_obj_handle *obj_hdl; sec_cred_t *p_ucreds = arg; hpss_vattr_t hpss_vattr; char *tmp_str_uuid; int rc; /* sanity checks. */ if (!fsal_obj_hdl || !p_output_size || !buffer_addr || !p_ucreds) return ERR_FSAL_FAULT; obj_hdl = container_of(fsal_obj_hdl, struct hpss_fsal_obj_handle, obj_handle); rc = hpss_GetAttrHandle(&(obj_hdl->handle->ns_handle), NULL, p_ucreds, NULL, &hpss_vattr); /** * /!\ WARNING : When the directory handle is stale, HPSS returns ENOTDIR. * Thus, in this case, we must double check * by checking the directory handle. */ if (rc == HPSS_ENOTDIR) if (HPSSFSAL_IsStaleHandle(&obj_hdl->handle->ns_handle, p_ucreds)) return ERR_FSAL_STALE; if (rc) return hpss2fsal_error(rc); uuid_to_string(&(hpss_vattr.va_soid.ObjectID), (char **)&tmp_str_uuid, &rc); if (rc != 0) return hpss2fsal_error(rc); *p_output_size = snprintf(buffer_addr, buffer_size, "%s", tmp_str_uuid); /* HPSS returns a string that it has just allocated. * Free it to avoid memory leak. */ free(tmp_str_uuid); return 0; }
const char * dmsg_uuid_to_str(uuid_t *uuid, char **strp) { uint32_t status; if (*strp) { free(*strp); *strp = NULL; } uuid_to_string(uuid, strp, &status); return (*strp); }
void uuuid_to_string(struct uuuid_t* uuuid, char** out, int* status) { uint32_t st; uuid_to_string(&uuuid->uuid, out, &st); if (st == uuid_s_ok) *status = UUUID_OK; else *status = UUUID_ERR; }
char * guul_get_uuid() { uuid_t uuid; uint32_t status; char *result = NULL; uuid_create (&uuid, &status); uuid_to_string (&uuid, &result, &status); return result; }
void ConfigurationPrivate::save() { QMutexLocker guard(&mutex); QString key(uuid_to_string(id)); // Read configuration QSettings conf; conf.beginGroup("Configurations"); conf.beginGroup(key); QByteArray ciphertext = encryptMap(data, key); conf.setValue("data", ciphertext); conf.setValue("title", title); }
void ConfigurationPrivate::load() { QMutexLocker guard(&mutex); QString key(uuid_to_string(id)); // Read configuration QSettings conf; conf.beginGroup("Configurations"); conf.beginGroup(key); QByteArray ciphertext = conf.value("data").toByteArray(); data = decryptMap(ciphertext, key); title = conf.value("title").toString(); }
const std::string uuid () { uuid_t id; uint32_t status; char *buffer (0); uuid_create (&id, &status); uuid_to_string (&id, &buffer, &status); std::string res (buffer); free (buffer); return res; }
int main(int argc, char **argv) { char str[1000]; afsUUID u1, u2; uuid_create(&u1); uuid_to_string(&u1, str, sizeof(str)); printf("u: %s\n", str); return 0; }
zmq::uuid_t::uuid_t () { #ifdef ZMQ_HAVE_HPUX unsigned32 status; #else uint32_t status; #endif uuid_create (&uuid, &status); zmq_assert (status == uuid_s_ok); uuid_to_string (&uuid, &string_buf, &status); zmq_assert (status == uuid_s_ok); create_blob (); }
static Datum special_uuid_value(const char *name) { uuid_t *uuid = get_cached_uuid_t(0); char *str; uuid_rc_t rc; rc = uuid_load(uuid, name); if (rc != UUID_RC_OK) pguuid_complain(rc); str = uuid_to_string(uuid); return DirectFunctionCall1(uuid_in, CStringGetDatum(str)); }
/* len is unused with OSSP, but we want to have the same number of args */ static Datum uuid_generate_internal(int mode, const uuid_t *ns, const char *name, int len) { uuid_t *uuid = get_cached_uuid_t(0); char *str; uuid_rc_t rc; rc = uuid_make(uuid, mode, ns, name); if (rc != UUID_RC_OK) pguuid_complain(rc); str = uuid_to_string(uuid); return DirectFunctionCall1(uuid_in, CStringGetDatum(str)); }
static void descriptor_read_handler(BLEDescriptor descriptor, const uint8_t *value, size_t value_length, uint16_t value_offset, BLEGATTError error) { char uuid_buffer[UUID_STRING_BUFFER_LENGTH]; Uuid descriptor_uuid = ble_descriptor_get_uuid(descriptor); uuid_to_string(&descriptor_uuid, uuid_buffer); APP_LOG(APP_LOG_LEVEL_INFO, "Read Descriptor %s, %u bytes, error: %u", uuid_buffer, value_length, error); for (size_t i = 0; i < value_length; ++i) { APP_LOG(APP_LOG_LEVEL_INFO, "0x%02x", value[i]); } }
/* * Create an LDAP server container entry. */ static void rpc_ns__ldap_export_server(LDAP *ld, char *dn, rpc_if_handle_t if_spec, unsigned32 *status ) { unsigned_char_p_t uuid = NULL; rpc_if_id_t if_id; LDAPMod *modV[4]; LDAPMod modRpcNsObjectID, modObjectClass; char *valueRpcNsObjectID[2], *valueObjectClass[3]; rpc_if_inq_id(if_spec, &if_id, status); if (*status != rpc_s_ok) { return; } uuid_to_string(&if_id.uuid, &uuid, status); if (*status != rpc_s_ok) { return; } valueRpcNsObjectID[0] = uuid; valueRpcNsObjectID[1] = NULL; modRpcNsObjectID.mod_op = LDAP_MOD_ADD; modRpcNsObjectID.mod_type = "rpcNsObjectID"; modRpcNsObjectID.mod_values = valueRpcNsObjectID; valueObjectClass[0] = "rpcServer"; valueObjectClass[1] = "rpcEntry"; valueObjectClass[2] = "top"; modObjectClass.mod_op = LDAP_MOD_ADD; modObjectClass.mod_type = "objectClass"; modObjectClass.mod_values = valueObjectClass; modV[0] = &modRpcNsObjectID; modV[1] = &modObjectClass; modV[2] = NULL; if (ldap_add_s(ld, dn, modV) != LDAP_SUCCESS) { *status = rpc_s_update_failed; } else { *status = rpc_s_ok; } rpc_string_free(&uuid, status); }
//void node_debug(struct NodeState *nodeState, char *fmt, ...) void node_debug(struct NodeState *nodeState, ...) { va_list arg; char s[BUFSIZE]; va_start(arg, nodeState); char *fmt = va_arg(arg, char*); vsnprintf(s, BUFSIZE, fmt, arg); va_end(arg); uuid_to_string(nodeID, nodeState->self->ID) printf("%lld %s: %s\n", getClock(), nodeID, s); }