这篇教程C++ uuid_is_null函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中uuid_is_null函数的典型用法代码示例。如果您正苦于以下问题:C++ uuid_is_null函数的具体用法?C++ uuid_is_null怎么用?C++ uuid_is_null使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了uuid_is_null函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: DECLARE_TESTDECLARE_TEST( uuid, string ){ uuid_t uuid, uuidref; char* str; uuidref = uuid_generate_random(); EXPECT_FALSE( uuid_is_null( uuidref ) ); str = string_from_uuid( uuidref ); EXPECT_NE( str, 0 ); uuid = string_to_uuid( str ); EXPECT_FALSE( uuid_is_null( uuid ) ); EXPECT_TRUE( uuid_equal( uuid, uuidref ) ); string_deallocate( str ); uuid = string_to_uuid( "" ); EXPECT_EQ_MSGFORMAT( uuid_is_null( uuid ), true, "empty string did not convert to null uuid: %s", string_from_uuid_static( uuid ) ); uuid = string_to_uuid( "0" ); EXPECT_EQ_MSGFORMAT( uuid_is_null( uuid ), true, "/"0/" string did not convert to null uuid: %s", string_from_uuid_static( uuid ) ); uuid = string_to_uuid( string_from_uuid_static( uuid_null() ) ); EXPECT_EQ_MSGFORMAT( uuid_is_null( uuid ), true, "null uuid reconvert through string did not convert to null uuid: %s", string_from_uuid_static( uuid ) ); return 0;}
开发者ID:emoon,项目名称:foundation_lib,代码行数:28,
示例2: sim_event_get_alarm_insert_clausegchar*sim_event_get_alarm_insert_clause(SimEvent *event){ gchar time[TIMEBUF_SIZE]; gchar *timestamp=time; gchar *query; gint c; gint a; gchar uuidtext[37]; gchar uuidtext_backlog[37]; g_return_val_if_fail(event, NULL); g_return_val_if_fail(SIM_IS_EVENT (event), NULL); if (event->risk_c < 0) event->risk_c = 0; else if (event->risk_c > 10) event->risk_c = 10; if (event->risk_a < 0) event->risk_a = 0; else if (event->risk_a > 10) event->risk_a = 10; c = rint(event->risk_c); a = rint(event->risk_a); if(event->time_str) timestamp=event->time_str; else strftime (timestamp, TIMEBUF_SIZE, "%F %T", gmtime ((time_t *) &event->time)); uuid_unparse_upper(event->uuid, uuidtext); uuid_unparse_upper(event->uuid_backlog, uuidtext_backlog); query = g_strdup_printf( "REPLACE INTO alarm " "(event_id, backlog_id, timestamp, plugin_id, plugin_sid, " "protocol, src_ip, dst_ip, src_port, dst_port, " "risk, snort_sid, snort_cid,uuid_backlog,uuid_event) " " VALUES ('%u', '%u', '%s', %d, %d, %d, %u, %u, %d, %d, %d, %u, %u,'%s','%s')", event->id, event->backlog_id, timestamp, event->plugin_id, event->plugin_sid, event->protocol, (event->src_ia) ? sim_inetaddr_ntohl(event->src_ia) : -1, (event->dst_ia) ? sim_inetaddr_ntohl(event->dst_ia) : -1, event->src_port, event->dst_port, (a > c) ? a : c, event->snort_sid, event->snort_cid, (!uuid_is_null(event->uuid_backlog) ? uuidtext_backlog : ""), (!uuid_is_null(event->uuid) ? uuidtext : "")); return query;}
开发者ID:DuVale,项目名称:phpzdl,代码行数:51,
示例3: main_runintmain_run(void* main_arg) { int result = RENDERCOMPILE_RESULT_OK; rendercompile_input_t input = rendercompile_parse_command_line(environment_command_line()); FOUNDATION_UNUSED(main_arg); if (input.display_help) { rendercompile_print_usage(); goto exit; } resource_source_set_path(STRING_ARGS(input.source_path)); resource_compile_register(render_compile); size_t ifile, fsize; for (ifile = 0, fsize = array_size(input.input_files); ifile < fsize; ++ifile) { uuid_t uuid = string_to_uuid(STRING_ARGS(input.input_files[ifile])); if (uuid_is_null(uuid)) { char buffer[BUILD_MAX_PATHLEN]; string_t pathstr = string_copy(buffer, sizeof(buffer), STRING_ARGS(input.input_files[ifile])); pathstr = path_clean(STRING_ARGS(pathstr), sizeof(buffer)); pathstr = path_absolute(STRING_ARGS(pathstr), sizeof(buffer)); uuid = resource_import_map_lookup(STRING_ARGS(pathstr)); } if (uuid_is_null(uuid)) { log_warnf(HASH_RESOURCE, WARNING_INVALID_VALUE, STRING_CONST("Failed to lookup: %.*s"), STRING_FORMAT(input.input_files[ifile])); result = RENDERCOMPILE_RESULT_INVALID_INPUT; break; } if (resource_compile(uuid, RESOURCE_PLATFORM_ALL)) { string_const_t uuidstr = string_from_uuid_static(uuid); log_infof(HASH_RESOURCE, STRING_CONST("Successfully compiled: %.*s (%.*s)"), STRING_FORMAT(uuidstr), STRING_FORMAT(input.input_files[ifile])); } else { string_const_t uuidstr = string_from_uuid_static(uuid); log_warnf(HASH_RESOURCE, WARNING_UNSUPPORTED, STRING_CONST("Failed to compile: %.*s (%.*s)"), STRING_FORMAT(uuidstr), STRING_FORMAT(input.input_files[ifile])); } }exit: array_deallocate(input.input_files); return result;}
开发者ID:ifzz,项目名称:render_lib,代码行数:49,
示例4: noit_poller_scheduleintnoit_poller_schedule(const char *target, const char *module, const char *name, const char *filterset, noit_hash_table *config, u_int32_t period, u_int32_t timeout, const char *oncheck, int flags, uuid_t in, uuid_t out) { noit_check_t *new_check; new_check = calloc(1, sizeof(*new_check)); if(!new_check) return -1; /* The module and the UUID can never be changed */ new_check->module = strdup(module); if(uuid_is_null(in)) uuid_generate(new_check->checkid); else uuid_copy(new_check->checkid, in); noit_check_update(new_check, target, name, filterset, config, period, timeout, oncheck, flags); assert(noit_hash_store(&polls, (char *)new_check->checkid, UUID_SIZE, new_check)); uuid_copy(out, new_check->checkid); return 0;}
开发者ID:easel,项目名称:reconnoiter,代码行数:32,
示例5: stobj_prune/*ARGSUSED*/intstobj_prune(char *mountpt, uuid_t *uuidp, time32_t prunetime, node_t *node, node_t *list){ data_t *d; stobjsess_t *stobj; invt_seshdr_t *stobj_header; invt_session_t *stobj_session; if(node == NULL || node->data == NULL) { return BOOL_FALSE; } d = (data_t *)(node->data); stobj = stobj_file[d->file_idx].data[d->data_idx]; stobj_header = stobj->header; stobj_session = stobj->session; if(stobj_header == NULL || stobj_session == NULL) { return BOOL_FALSE; } if(stobj_header->sh_pruned) { return BOOL_TRUE; } if(stobj_header->sh_time < prunetime) { if(mountpt != NULL && mntpnt_equal(mountpt, stobj_session->s_mountpt)) { return BOOL_TRUE; } if((!uuid_is_null(*uuidp)) && (uuid_compare(*uuidp, stobj_session->s_fsid) == 0)) { return BOOL_TRUE; } } return BOOL_FALSE;}
开发者ID:ystk,项目名称:debian-xfsdump,代码行数:35,
示例6: is_uuidintis_uuid(const char *value){ uuid_t id; char test_value[37]; if (strlen(value) < 36) { return 0; } if (uuid_is_null(id) < 0) { errno = EINVAL; return -1; } if (uuid_parse(value, id) < 0) { return 0; } memset(test_value, 0, sizeof(test_value)); uuid_unparse(id, test_value); if (strcasecmp(value, test_value)) { return 0; } return 1;}
开发者ID:ClusterLabs,项目名称:fence-virt,代码行数:28,
示例7: bptree_index_scan/*@ Procedure to read all nodes of a particular btree, but not do * anything in particular with them; the primary use of this is to ensure that * as much (usually all, if mem available) of the btree node keys become * cached on the node this is run from; this is useful for verification but also * for improving performance on cache nodes for certain tables * The procedure can restart from the last node it failed to read from on * multi-node configurations */int bptree_index_scan(bptree_session *bps,bptree_node *root, uuid_t failed_node, FILE *fp){ int rv; int nodes =0; bptree_node *n; bptree_key_val kv; char uuid_out[40]; if (!uuid_is_null(failed_node)) { n = read_node(bps, failed_node, &rv); if (rv != BPTREE_OP_NODE_FOUND) return rv; uuid_unparse(failed_node, uuid_out); printf("Previous failed node %s /n", uuid_out); bpnode_get_kv_ref(n,0,&kv); } else { // Use a 'null' key as our comparison point to grab everything // FIXME Implement proper size function here kv.ksize = bptree_get_key_length(bps); kv.vsize = 4; kv.k = malloc(kv.ksize); kv.v = malloc(kv.vsize); memset(kv.k,'/0',kv.ksize); memset(kv.v,'/0',kv.vsize); } rv = bptree_index_scan_recursive(bps, root, &kv, failed_node, &nodes, fp); if (rv == BPTREE_OP_SUCCESS) { fflush(stdout); } return rv;}
开发者ID:atomic77,项目名称:mosql-storage,代码行数:41,
示例8: get_ext2_infostatic void get_ext2_info(blkid_dev dev, struct blkid_magic *id, unsigned char *buf){ struct ext2_super_block *es = (struct ext2_super_block *) buf; const char *label = 0; DBG(DEBUG_PROBE, printf("ext2_sb.compat = %08X:%08X:%08X/n", blkid_le32(es->s_feature_compat), blkid_le32(es->s_feature_incompat), blkid_le32(es->s_feature_ro_compat))); if (strlen(es->s_volume_name)) label = es->s_volume_name; blkid_set_tag(dev, "LABEL", label, sizeof(es->s_volume_name)); set_uuid(dev, es->s_uuid, 0); if ((es->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) && !uuid_is_null(es->s_journal_uuid)) set_uuid(dev, es->s_journal_uuid, "EXT_JOURNAL"); if (strcmp(id->bim_type, "ext2") && ((blkid_le32(es->s_feature_incompat) & EXT2_FEATURE_INCOMPAT_UNSUPPORTED) == 0)) blkid_set_tag(dev, "SEC_TYPE", "ext2", sizeof("ext2"));}
开发者ID:DebdutBiswas,项目名称:WinFLASHTool,代码行数:26,
示例9: psivshmem_init_device_handlestaticvoid psivshmem_init_device_handle(ivshmem_pci_dev_t *dev){/* * This function initiates all required parameters to handle the shared memory access. * The first byte of the shared memory is used as a simple mutex to let the verry first * process initialize a pthread spinlock which is inter-vm thread safe. */ dev->first_byte = (volatile unsigned char*) dev->ivshmem_base; dev->spinlock = (volatile pthread_spinlock_t*)(dev->ivshmem_base + sizeof(char)); dev->uuid = (volatile uuid_t*)(dev->ivshmem_base + sizeof(char) + sizeof(pthread_spinlock_t)); dev->bitmap = dev->ivshmem_base + sizeof(char) + sizeof(pthread_spinlock_t) + sizeof(uuid_t); dev->frame_size = IVSHMEM_FRAME_SIZE; dev->num_of_frames = dev->mem_size_byte / IVSHMEM_FRAME_SIZE; dev->bitmap_length = dev->num_of_frames / (sizeof(char)*CHAR_BIT); dev->meta_data_size = (dev->bitmap - dev->ivshmem_base) + dev->bitmap_length * sizeof (char); unsigned long long n; // Assumption: unused device contains only zeros if (uuid_is_null(*((uuid_t*)dev->uuid)) && psivshmem_atomic_TestAndSet(dev->first_byte)){ pthread_spin_init(dev->spinlock, PTHREAD_PROCESS_SHARED); uuid_generate(*((uuid_t*)dev->uuid)); for(n =0; n< dev->bitmap_length; n++) SET_BIT(dev->bitmap,n); //mark all used frames in bitmap *(dev->first_byte) = IVSHMEM_DEVICE_MAGIC; //indicate PCI device to be used by ivshmem plugin } else { /* active waiting until other process has initialized the shared meta data * otherwise a device collision will be detected psivshmem_init_uio_device() */ psivshmem_init_wait(dev); } uuid_unparse_lower(*(uuid_t*)dev->uuid, dev->uuid_str); DPRINT(3,"ivshmem: my uuid: %s",dev->uuid_str);}
开发者ID:RWTH-OS,项目名称:pscom,代码行数:33,
示例10: e2fsck_fix_ext3_journal_hint/* * This function makes sure the superblock hint for the external * journal is correct. */int e2fsck_fix_ext3_journal_hint(e2fsck_t ctx){ struct ext2_super_block *sb = ctx->fs->super; struct problem_context pctx; char uuid[37], *journal_name; struct stat st; problem_t problem; int retval; if (!(sb->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) || uuid_is_null(sb->s_journal_uuid)) return 0; uuid_unparse(sb->s_journal_uuid, uuid); journal_name = blkid_get_devname(ctx->blkid, "UUID", uuid); if (!journal_name) return 0; if (stat(journal_name, &st) < 0) return 0; if (st.st_rdev != sb->s_journal_dev) { clear_problem_context(&pctx); pctx.num = st.st_rdev; if (fix_problem(ctx, PR_0_EXTERNAL_JOURNAL_HINT, &pctx)) { sb->s_journal_dev = st.st_rdev; ext2fs_mark_super_dirty(ctx->fs); } } free(journal_name); return 0;}
开发者ID:acassis,项目名称:emlinux-ssd1935,代码行数:37,
示例11: read_available_jobstatic char read_available_job(BANG_peer *self) { uuid_t auth, peer; read_uuid(self,auth); if (uuid_is_null(auth)) { return 0; } read_uuid(self,peer); if (uuid_is_null(peer)) { return 0; } BANG_route_assertion_of_authority(auth, peer); return 1;}
开发者ID:nikron,项目名称:bang-2009-eoh-project,代码行数:17,
示例12: read_request_jobstatic char read_request_job(BANG_peer *self) { uuid_t auth, peer; read_uuid(self,auth); if (uuid_is_null(auth)) { return 0; } read_uuid(self,peer); if (uuid_is_null(peer)) { return 0; } BANG_route_request_job(peer, auth); return 1;}
开发者ID:nikron,项目名称:bang-2009-eoh-project,代码行数:17,
示例13: uuid_is_nullbool IOGUIDPartitionScheme::isPartitionUsed(gpt_ent * partition){ // // Ask whether the given partition is used. // return uuid_is_null(partition->ent_type) ? false : true;}
开发者ID:Andromeda-OS,项目名称:PlatformKEXTs,代码行数:8,
示例14: ovl_can_decode_fh/* * Check if underlying fs supports file handles and try to determine encoding * type, in order to deduce maximum inode number used by fs. * * Return 0 if file handles are not supported. * Return 1 (FILEID_INO32_GEN) if fs uses the default 32bit inode encoding. * Return -1 if fs uses a non default encoding with unknown inode size. */int ovl_can_decode_fh(struct super_block *sb){ if (!sb->s_export_op || !sb->s_export_op->fh_to_dentry || uuid_is_null(&sb->s_uuid)) return 0; return sb->s_export_op->encode_fh ? -1 : FILEID_INO32_GEN;}
开发者ID:krzk,项目名称:linux,代码行数:16,
示例15: ext2fs_check_ext3_journal/* * This function makes sure that the superblock fields regarding the * journal are consistent. */errcode_t ext2fs_check_ext3_journal(ext2_filsys fs){ struct ext2_super_block *sb = fs->super; journal_t *journal; int recover = fs->super->s_feature_incompat & EXT3_FEATURE_INCOMPAT_RECOVER; errcode_t retval; /* If we don't have any journal features, don't do anything more */ if (!(sb->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) && !recover && sb->s_journal_inum == 0 && sb->s_journal_dev == 0 && uuid_is_null(sb->s_journal_uuid)) return 0; retval = ext2fs_get_journal(fs, &journal); if (retval) return retval; retval = ext2fs_journal_load(journal); if (retval) goto err; /* * We want to make the flags consistent here. We will not leave with * needs_recovery set but has_journal clear. We can't get in a loop * with -y, -n, or -p, only if a user isn't making up their mind. */ if (!(sb->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL)) { retval = EXT2_ET_JOURNAL_FLAGS_WRONG; goto err; } if (sb->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL && !(sb->s_feature_incompat & EXT3_FEATURE_INCOMPAT_RECOVER) && journal->j_superblock->s_start != 0) { retval = EXT2_ET_JOURNAL_FLAGS_WRONG; goto err; } /* * If we don't need to do replay the journal, check to see if * the journal's errno is set; if so, we need to mark the file * system as being corrupt and clear the journal's s_errno. */ if (!(sb->s_feature_incompat & EXT3_FEATURE_INCOMPAT_RECOVER) && journal->j_superblock->s_errno) { fs->super->s_state |= EXT2_ERROR_FS; ext2fs_mark_super_dirty(fs); journal->j_superblock->s_errno = 0; ext2fs_journal_sb_csum_set(journal, journal->j_superblock); mark_buffer_dirty(journal->j_sb_buffer); }err: ext2fs_journal_release(fs, journal, 0, retval ? 1 : 0); return retval;}
开发者ID:DebdutBiswas,项目名称:WinFLASHTool,代码行数:61,
示例16: set_uuidstatic void set_uuid(blkid_dev dev, uuid_t uuid, const char *tag){ char str[37]; if (!uuid_is_null(uuid)) { uuid_unparse(uuid, str); blkid_set_tag(dev, tag ? tag : "UUID", str, sizeof(str)); }}
开发者ID:DebdutBiswas,项目名称:WinFLASHTool,代码行数:9,
示例17: ida_fd_to_locint32_t ida_fd_to_loc(ida_local_t * local, loc_t * loc, fd_t * fd){ int32_t error; error = inode_path(fd->inode, NULL, (char **)&loc->path); if (unlikely(error < 0)) { return -error; } loc->name = strrchr(loc->path, '/'); if (loc->name != NULL) { loc->name++; } error = ida_inode_assign(local, &loc->inode, fd->inode); if (unlikely(error != 0)) { goto failed; } if (!uuid_is_null(loc->inode->gfid)) { uuid_copy(loc->gfid, loc->inode->gfid); } loc->parent = inode_parent(loc->inode, 0, NULL); if (loc->parent != NULL) { if (!uuid_is_null(loc->parent->gfid)) { uuid_copy(loc->pargfid, loc->parent->gfid); } } return 0;failed: GF_FREE((char *)loc->path); return ENOMEM;}
开发者ID:datalab-bcn,项目名称:glusterfs-ida,代码行数:42,
示例18: read_finished_jobstatic char read_finished_job(BANG_peer *self) { uuid_t auth, peer; read_uuid(self,auth); if (uuid_is_null(auth)) { return 0; } read_uuid(self,peer); if (uuid_is_null(peer)) { return 0; } BANG_job job; /* MAGIC NUMBER AGAIN */ int *job_number = (int*) read_message(self,4); if (job_number == NULL) { return 0; } job.job_number = *job_number; free(job_number); unsigned int *job_length = (unsigned int*) read_message(self,LENGTH_OF_LENGTHS); if (job_length == NULL) { return 0; } job.length = *job_length; free(job_length); job.data = read_message(self,job.length); if (job.data == NULL) { return 0; } BANG_route_finished_job(auth, peer, &job); return 1;}
开发者ID:nikron,项目名称:bang-2009-eoh-project,代码行数:41,
示例19: cl_uuid_is_nullintcl_uuid_is_null(cl_uuid_t* uu){ if (uu == NULL) { cl_log(LOG_ERR, "cl_uuid_is_null: " "wrong argument (uu is NULL)"); assert(0); } return uuid_is_null(uu->uuid);}
开发者ID:storm109212,项目名称:heartbeat,代码行数:12,
示例20: psivshmem_init_waitstaticvoid psivshmem_init_wait(ivshmem_pci_dev_t* dev){/* * This function provides variable, time-discreate active waiting * until another process has initialized the device or a time theshold expires. */ int n; const int wait_treshold = 500; // results in a max time waste of 500 x 100 mic-sec = 0.05 sec for(n=0; n<wait_treshold; n++){ usleep(100); //wait 100 microseconds if(!uuid_is_null(*((uuid_t*)dev->uuid)) && (*(dev->first_byte) == IVSHMEM_DEVICE_MAGIC)) return; }}
开发者ID:RWTH-OS,项目名称:pscom,代码行数:14,
示例21: check_sessionstatic int check_session(server *srv, connection *con, plugin_data *p, bits_packet_t packet_type){ int err; buffer *req_session_id; uuid_t req_session_uuid; char uuid_str[UUID_STR_LEN]; if (packet_type == BITS_PING || packet_type == BITS_CREATE_SESSION) { return 0; } if (uuid_is_null(p->session_id)) { LOG("s", "ERROR: No-one is logged in."); return -EINVAL; } uuid_clear(req_session_uuid); req_session_id = get_bits_session_id(srv, con); if (!req_session_id) { LOG("s", "ERROR: No session ID provided in request"); return -EINVAL; } if (strlen(req_session_id->ptr) != UUID_IN_BRACES_STR_LEN -1) { LOG("ss", "ERROR: session ID invalid:", req_session_id->ptr); return -EINVAL; } strncpy(uuid_str, req_session_id->ptr + 1, UUID_STR_LEN - 1); uuid_str[UUID_STR_LEN - 1] = '/0'; err = uuid_parse(uuid_str, req_session_uuid); if (err) { LOG("ss", "ERROR: session ID not a valid UUID:", uuid_str); return -EINVAL; } if (uuid_compare(p->session_id, req_session_uuid)) { char uuid_str2[UUID_STR_LEN]; uuid_unparse(p->session_id, uuid_str2); LOG("ssss", "ERROR: Wrong session ID:", req_session_id->ptr, "expect:", uuid_str2); return -EINVAL; } return 0;}
开发者ID:2xyo,项目名称:transfervm,代码行数:49,
示例22: dump_bptree_sequentialint dump_bptree_sequential(bptree_session *bps, uuid_t failed_node){ int ksize, vsize, rv; unsigned char k[BPTREE_MAX_VALUE_SIZE], v[BPTREE_MAX_VALUE_SIZE]; char uuid_out[40]; char s1[512]; char path[128]; sprintf(path, "/tmp/%d.out", bps->bpt_id); FILE *fp = fopen(path,"w"); //printf("Dumping bpt_id %d:/n",bps->bpt_id); //fflush(stdout); if (!uuid_is_null(failed_node)) { bps->cursor_node = read_node(bps, failed_node, &rv); if(rv == BPTREE_OP_TAPIOCA_NOT_READY) return rv; bps->cursor_pos = 0; rv = bptree_index_next(bps, k, &ksize, v, &vsize); if (rv != BPTREE_OP_KEY_FOUND) return rv; } else { bptree_index_first(bps, k, &ksize, v, &vsize); } for(rv = 0;;) { bptree_key_value_to_string(bps, k,v,ksize,vsize,s1); uuid_unparse(bpnode_get_id(bps->cursor_node), uuid_out); fprintf(fp, "Node->Cell %s -> %d /t Key: %s /n", uuid_out, bps->cursor_pos, s1); rv = bptree_index_next(bps, k, &ksize, v, &vsize); if (rv != BPTREE_OP_KEY_FOUND) break; } if (rv == BPTREE_OP_EOF) { fprintf(fp, "/n/n"); fflush(stdout); rv = BPTREE_OP_SUCCESS; } else if (rv == BPTREE_OP_TAPIOCA_NOT_READY) { uuid_copy(failed_node, bpnode_get_id(bps->cursor_node)); //uuid_copy(failed_node, bps->cursor_node->self_key); } return rv; fflush(fp); fclose(fp);}
开发者ID:atomic77,项目名称:mosql-storage,代码行数:48,
示例23: mainintmain(int argc, char *argv){ uuid_t buf, tst; char str[100]; unsigned char *cp; int i; int failed = 0; uuid_generate(buf); uuid_unparse(buf, str); printf("UUID string = %s/n", str); printf("UUID: "); for (i=0, cp = (unsigned char *) &buf; i < 16; i++) { printf("%02x", *cp++); } printf("/n"); uuid_parse(str, tst); if (uuid_compare(buf, tst)) printf("UUID parse and compare succeeded./n"); else { printf("UUID parse and compare failed!/n"); failed++; } uuid_clear(tst); if (uuid_is_null(tst)) printf("UUID clear and is null succeeded./n"); else { printf("UUID clear and is null failed!/n"); failed++; } uuid_copy(buf, tst); if (uuid_compare(buf, tst)) printf("UUID copy and compare succeeded./n"); else { printf("UUID copy and compare failed!/n"); failed++; } if (failed) { printf("%d failures./n", failed); exit(1); } return 0;}
开发者ID:kthxbyte,项目名称:KDE1-Linaro,代码行数:44,
示例24: cmd_killintcmd_kill(struct arguments *args){ int rc; struct db *db; char pass[MAX_PASS_LENGTH + 1]; rc = -1; db = NULL; if (uuid_is_null(args->uuid) || !args->dbfile) { fprintf(stderr, "missing arguments for kill/n"); goto out; } if (get_pass(PASS_PROMPT, pass, MAX_PASS_LENGTH + 1, stdin)) { fprintf(stderr, "%s/n", GET_PASS_FAIL); goto out; } if (!(db = pwsdb_open(pass, args->dbfile))) { fprintf(stderr, "couldn't open db/n"); goto out; } if (pwsdb_remove_record(db, args->uuid)) { fprintf(stderr, "failed to remove entry from db/n"); goto out; } if (pwsdb_save(db, pass, args->dbfile)) { fprintf(stderr, "couldn't save db"); goto out; } rc = 0; out: destroy_db(db); free(db); return rc;}
开发者ID:druzac,项目名称:pwdb,代码行数:42,
示例25: handle_create_sessionstatic void handle_create_session(server *srv, connection *con, void *plugindata){ plugin_data *data = (plugin_data *)plugindata; if (!uuid_is_null(data->session_id)) { DEBUGLOG("s", "Session changed"); reset_session(data); } uuid_generate(data->session_id); bits_create_session(srv, con, data->session_id); if (data->conf.sparse) { DEBUGLOG("s", "Backend target is sparse"); data->state.backend_sparse = 1; } else { data->state.zero_unalloc = 1; }}
开发者ID:2xyo,项目名称:transfervm,代码行数:20,
示例26: boot_acl_showstatic ssize_t boot_acl_show(struct device *dev, struct device_attribute *attr, char *buf){ struct tb *tb = container_of(dev, struct tb, dev); uuid_t *uuids; ssize_t ret; int i; uuids = kcalloc(tb->nboot_acl, sizeof(uuid_t), GFP_KERNEL); if (!uuids) return -ENOMEM; pm_runtime_get_sync(&tb->dev); if (mutex_lock_interruptible(&tb->lock)) { ret = -ERESTARTSYS; goto out; } ret = tb->cm_ops->get_boot_acl(tb, uuids, tb->nboot_acl); if (ret) { mutex_unlock(&tb->lock); goto out; } mutex_unlock(&tb->lock); for (ret = 0, i = 0; i < tb->nboot_acl; i++) { if (!uuid_is_null(&uuids[i])) ret += snprintf(buf + ret, PAGE_SIZE - ret, "%pUb", &uuids[i]); ret += snprintf(buf + ret, PAGE_SIZE - ret, "%s", i < tb->nboot_acl - 1 ? "," : "/n"); }out: pm_runtime_mark_last_busy(&tb->dev); pm_runtime_put_autosuspend(&tb->dev); kfree(uuids); return ret;}
开发者ID:Lyude,项目名称:linux,代码行数:41,
示例27: cmd_retrieveintcmd_retrieve(struct arguments *args){ int rc; struct db *db; char pass[MAX_PASS_LENGTH + 1], *fndpass; rc = -1; db = NULL; if (uuid_is_null(args->uuid) || !args->dbfile) { fprintf(stderr, "missing arguments for retrieve/n"); goto out; } if (get_pass(PASS_PROMPT, pass, MAX_PASS_LENGTH + 1, stdin)) { fprintf(stderr, "%s/n", GET_PASS_FAIL); goto out; } if (!(db = pwsdb_open(pass, args->dbfile))) { fprintf(stderr, "couldn't open db/n"); goto out; } if (!(fndpass = pwsdb_get_pass(db, args->uuid))) { fprintf(stderr, "couldn't find pass/n"); goto out; } pb_write(fndpass); rc = 0; out: destroy_db(db); free(db); return rc;}
开发者ID:druzac,项目名称:pwdb,代码行数:38,
示例28: store_to_dictstatic int store_to_dict(Msg *msg){ Msg *copy; Octstr *uuid_os; char id[UUID_STR_LEN + 1]; /* always set msg id and timestamp */ if (msg_type(msg) == sms && uuid_is_null(msg->sms.id)) uuid_generate(msg->sms.id); if (msg_type(msg) == sms && msg->sms.time == MSG_PARAM_UNDEFINED) time(&msg->sms.time); if (msg_type(msg) == sms) { copy = msg_duplicate(msg); uuid_unparse(copy->sms.id, id); uuid_os = octstr_create(id); dict_put(sms_dict, uuid_os, copy); octstr_destroy(uuid_os); last_dict_mod = time(NULL); } else if (msg_type(msg) == ack) { uuid_unparse(msg->ack.id, id); uuid_os = octstr_create(id); copy = dict_remove(sms_dict, uuid_os); octstr_destroy(uuid_os); if (copy == NULL) { warning(0, "bb_store: get ACK of message not found " "from store, strange?"); } else { msg_destroy(copy); last_dict_mod = time(NULL); } } else return -1; return 0;}
开发者ID:gburiticato,项目名称:kannel,代码行数:38,
示例29: ovl_get_fsid/* Get a unique fsid for the layer */static int ovl_get_fsid(struct ovl_fs *ofs, const struct path *path){ struct super_block *sb = path->mnt->mnt_sb; unsigned int i; dev_t dev; int err; /* fsid 0 is reserved for upper fs even with non upper overlay */ if (ofs->upper_mnt && ofs->upper_mnt->mnt_sb == sb) return 0; for (i = 0; i < ofs->numlowerfs; i++) { if (ofs->lower_fs[i].sb == sb) return i + 1; } if (!ovl_lower_uuid_ok(ofs, &sb->s_uuid)) { ofs->config.index = false; ofs->config.nfs_export = false; pr_warn("overlayfs: %s uuid detected in lower fs '%pd2', falling back to index=off,nfs_export=off./n", uuid_is_null(&sb->s_uuid) ? "null" : "conflicting", path->dentry); } err = get_anon_bdev(&dev); if (err) { pr_err("overlayfs: failed to get anonymous bdev for lowerpath/n"); return err; } ofs->lower_fs[ofs->numlowerfs].sb = sb; ofs->lower_fs[ofs->numlowerfs].pseudo_dev = dev; ofs->numlowerfs++; return ofs->numlowerfs;}
开发者ID:avagin,项目名称:linux,代码行数:37,
注:本文中的uuid_is_null函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ uuid_parse函数代码示例 C++ uuid_generate函数代码示例 |