Пример #1
0
Файл: IoUUID.c Проект: ADTSH/io
IoObject *IoUUID_uuidRandom(IoUUID *self, IoObject *locals, IoMessage *m)
{
	/*doc UUID uuidRandom
	Returns a new random uuid (type 4) in string format.
	*/

	uuid_t buf;
	char str[200];

	uuid_generate_random(buf);
	uuid_unparse(buf, str);

	return IOSYMBOL(str);
}
Пример #2
0
static int print_subvol(const char *path, const u8 *uuid, u64 ctransid,
			void *user)
{
	struct recv_args *r = user;
	char uuid_str[128];

	r->full_subvol_path = path_cat(r->root_path, path);
	uuid_unparse(uuid, uuid_str);

	printf("subvol\t%s\t%llu\t%s\n", uuid_str,
	       (unsigned long long)ctransid, r->full_subvol_path);

	return 0;
}
Пример #3
0
NTSTATUS
SrvElementsInit(
    VOID
    )
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    int      iIter = 0;

    pthread_mutex_init(&gSrvElements.mutex, NULL);
    gSrvElements.pMutex = &gSrvElements.mutex;

    mt_init_genrand(&gSrvElements.randGen, time(NULL));

    ntStatus = SrvElementsConfigSetupInitial();
    BAIL_ON_NT_STATUS(ntStatus);

    gSrvElements.ulGlobalCreditLimit = SrvElementsConfigGetGlobalCreditLimit();

    ntStatus = SrvElementsResourcesInit();
    BAIL_ON_NT_STATUS(ntStatus);

    ntStatus = WireGetCurrentNTTime(&gSrvElements.llBootTime);
    BAIL_ON_NT_STATUS(ntStatus);

    while (!RAND_status() && (iIter++ < 10))
    {
        uuid_t uuid;
        CHAR   szUUID[37];

        memset(szUUID, 0, sizeof(szUUID));

        uuid_generate(uuid);
        uuid_unparse(uuid, szUUID);

        RAND_seed(szUUID, sizeof(szUUID));
    }

    ntStatus = SrvTimerInit(&gSrvElements.timer);
    BAIL_ON_NT_STATUS(ntStatus);

    pthread_rwlock_init(&gSrvElements.statsLock, NULL);
    gSrvElements.pStatsLock = &gSrvElements.statsLock;

    ntStatus = SrvAsyncCloseFileTrackerCreate(&gSrvElements.pAsyncCloseFileTracker);
    BAIL_ON_NT_STATUS(ntStatus);

error:

    return ntStatus;
}
Пример #4
0
//send message
bool activemq_sync_producer::send_message(const std::string& request, std::string& response, int time)
{
	try
	{
		char uuid_str[37];
		uuid_str[36] = 0;
		uuid_clear(_uuid);
		uuid_generate_time_safe(_uuid);
		uuid_unparse(_uuid, uuid_str);

		//发送消息
		std::auto_ptr<cms::TextMessage> ptr_message(_ptr_session->createTextMessage(request));
		ptr_message->setCMSReplyTo(_ptr_recv_queue.get());
		ptr_message->setCMSCorrelationID(uuid_str);
		_ptr_send_message->send(ptr_message.get());


		bool recv_data = false;
		while (1)
		{
			std::auto_ptr<cms::TextMessage> recv_message(dynamic_cast<cms::TextMessage*>(_ptr_recv_message->receive(time)));
			if (NULL != recv_message.get())
			{
				if (recv_message->getCMSCorrelationID().compare(uuid_str) == 0)
				{
					response = recv_message->getText();
					recv_data = true;
					break;
				}
				else
				{
					
				}				
			}
			else
			{
				break;
			}	
		}
		
		return recv_data;
	}
	catch (cms::CMSException& e)
	{
		printf("Producer run() CMSException \n");
		e.printStackTrace();

		return false;
	}
}
Пример #5
0
Файл: IoUUID.c Проект: ADTSH/io
IoObject *IoUUID_uuidTime(IoUUID *self, IoObject *locals, IoMessage *m)
{
	/*doc UUID uuidTime
	Returns a new time and mac uuid (type 1) in string format.
	*/

	uuid_t buf;
	char str[200];

	uuid_generate_time(buf);
	uuid_unparse(buf, str);

	return IOSYMBOL(str);
}
Пример #6
0
/*ARGSUSED*/
int
stobjsess_highlight(WINDOW *win, node_t *current, node_t *list)
{
    static char txt[256];
    char uuidstr[UUID_STR_LEN + 1];
    data_t *d;
    invt_seshdr_t *stobjhdr;
    invt_session_t *stobjses;

    if(current == NULL || current->data == NULL) {
	return 0;
    }
    d = (data_t *)(current->data);
    stobjhdr = ((stobjsess_t *)(stobj_file[d->file_idx].data[d->data_idx]))->header;
    stobjses = ((stobjsess_t *)(stobj_file[d->file_idx].data[d->data_idx]))->session;

    wclear(infowin);

    put_info_header("session entry");

    snprintf(txt, sizeof(txt), "pruned:  %s, flags: %#x, time: %s",
	    (stobjhdr->sh_pruned == BOOL_TRUE) ? "yes" : "no",
	    stobjhdr->sh_flag,
	    ctime32(&(stobjhdr->sh_time)));
    txt[strlen(txt)-1] = '\0';
    put_info_line(1, txt);

    uuid_unparse(stobjses->s_fsid, uuidstr);
    snprintf(txt, sizeof(txt), "mountpt: %s, fsid: %s", stobjses->s_mountpt, uuidstr);
    put_info_line(2, txt);

    uuid_unparse(stobjses->s_sesid, uuidstr);
    snprintf(txt, sizeof(txt), "device:  %s, sesid: %s", stobjses->s_devpath, uuidstr);
    put_info_line(3, txt);

    return FALSE;
}
Пример #7
0
static 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;
}
Пример #8
0
static void print_dev_item(struct extent_buffer *eb,
			   struct btrfs_dev_item *dev_item)
{
	char uuid_str[BTRFS_UUID_UNPARSED_SIZE];
	char fsid_str[BTRFS_UUID_UNPARSED_SIZE];
	u8 uuid[BTRFS_UUID_SIZE];
	u8 fsid[BTRFS_UUID_SIZE];

	read_extent_buffer(eb, uuid,
			   (unsigned long)btrfs_device_uuid(dev_item),
			   BTRFS_UUID_SIZE);
	uuid_unparse(uuid, uuid_str);
	read_extent_buffer(eb, fsid,
			   (unsigned long)btrfs_device_fsid(dev_item),
			   BTRFS_UUID_SIZE);
	uuid_unparse(fsid, fsid_str);
	printf("\t\tdevid %llu total_bytes %llu bytes_used %Lu\n"
	       "\t\tio_align %u io_width %u sector_size %u type %llu\n"
	       "\t\tgeneration %llu start_offset %llu dev_group %u\n"
	       "\t\tseek_speed %hhu bandwidth %hhu\n"
	       "\t\tuuid %s\n"
	       "\t\tfsid %s\n",
	       (unsigned long long)btrfs_device_id(eb, dev_item),
	       (unsigned long long)btrfs_device_total_bytes(eb, dev_item),
	       (unsigned long long)btrfs_device_bytes_used(eb, dev_item),
	       btrfs_device_io_align(eb, dev_item),
	       btrfs_device_io_width(eb, dev_item),
	       btrfs_device_sector_size(eb, dev_item),
	       (unsigned long long)btrfs_device_type(eb, dev_item),
	       (unsigned long long)btrfs_device_generation(eb, dev_item),
	       (unsigned long long)btrfs_device_start_offset(eb, dev_item),
	       btrfs_device_group(eb, dev_item),
	       btrfs_device_seek_speed(eb, dev_item),
	       btrfs_device_bandwidth(eb, dev_item),
	       uuid_str, fsid_str);
}
Пример #9
0
/*
 * Callback function that prints a message from the store
 */
static void print_msg(Msg *msg)
{
	char buf[UUID_STR_LEN + 1];
	counter++;
	if (counter > list_from && counter <= list_limit) {
		uuid_unparse(msg->sms.id, buf); \
		printf("| %-36s | %-10s | %-10s | %-14s | %-50s |\n",
			buf,
			octstr_get_cstr(msg->sms.sender),
			octstr_get_cstr(msg->sms.receiver),
			octstr_get_cstr(msg->sms.smsc_id),
			octstr_get_cstr(msg->sms.msgdata)
		);
	}
}
Пример #10
0
string create_temp_table(vector<table_column *> *t) {
    uuid_t out;
    char *uuid_str = new char[40];
    uuid_generate(out);
    uuid_unparse(out, uuid_str);
    create_table_stmt *cs = new create_table_stmt(uuid_str, t);


    xyzsql_process_create_table(cs);

    string res(uuid_str);
    delete[] uuid_str;

    return res;
}
Пример #11
0
int main(int argc, char **argv)
{
	bool udev = false;
	int i, o;
	extern char *optarg;
	struct cache_sb sb;
	char uuid[40];

	while ((o = getopt(argc, argv, "o:")) != EOF)
		switch (o) {
		case 'o':
			if (strcmp("udev", optarg)) {
				printf("Invalid output format %s\n", optarg);
				exit(EXIT_FAILURE);
			}
			udev = true;
			break;
		}


	argv += optind;
	argc -= optind;

	for (i = 0; i < argc; i++) {
		int fd = open(argv[i], O_RDONLY);
		if (fd == -1)
			continue;


		if (pread(fd, &sb, sizeof(sb), SB_START) != sizeof(sb))
			continue;

		if (memcmp(sb.magic, bcache_magic, 16))
			continue;

		uuid_unparse(sb.uuid, uuid);

		if (udev)
			printf("ID_FS_UUID=%s\n"
			       "ID_FS_UUID_ENC=%s\n"
			       "ID_FS_TYPE=bcache\n",
			       uuid, uuid);
		else
			printf("%s: UUID=\"\" TYPE=\"bcache\"\n", uuid);
	}

	return 0;
}
Пример #12
0
errcode_t ext2fs_create_icount_tdb(ext2_filsys fs, char *tdb_dir,
				   int flags, ext2_icount_t *ret)
{
	ext2_icount_t	icount;
	errcode_t	retval;
	char 		*fn, uuid[40];
	ext2_ino_t	num_inodes;
	int		fd;

	retval = alloc_icount(fs, flags,  &icount);
	if (retval)
		return retval;

	retval = ext2fs_get_mem(strlen(tdb_dir) + 64, &fn);
	if (retval)
		goto errout;
	uuid_unparse(fs->super->s_uuid, uuid);
	sprintf(fn, "%s/%s-icount-XXXXXX", tdb_dir, uuid);
	fd = mkstemp(fn);
	if (fd < 0)
		return fd;

	/*
	 * This is an overestimate of the size that we will need; the
	 * ideal value is the number of used inodes with a count
	 * greater than 1.  OTOH the times when we really need this is
	 * with the backup programs that use lots of hard links, in
	 * which case the number of inodes in use approaches the ideal
	 * value.
	 */
	num_inodes = fs->super->s_inodes_count - fs->super->s_free_inodes_count;

	icount->tdb_fn = fn;
	icount->tdb = tdb_open(fn, num_inodes, TDB_NOLOCK | TDB_NOSYNC,
			       O_RDWR | O_CREAT | O_TRUNC, 0600);
	if (icount->tdb) {
		close(fd);
		*ret = icount;
		return 0;
	}

	retval = errno;
	close(fd);

errout:
	ext2fs_free_icount(icount);
	return(retval);
}
Пример #13
0
int 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);
}
Пример #14
0
/* 
** Helper function to generate the desired type of UUID string 
*/
char* uuid_gen(int how)
{
  uuid_t r;
  char *buff = (char *) malloc(BUFFSIZE);
  if (buff == 0)
  {
    return "false";
  }
  else
  {
    (how == CMD_RANDOM) ? uuid_generate(r) : uuid_generate_time(r);
    uuid_unparse(r, buff);
  }

  return buff;
}
Пример #15
0
void RemoveThread::remove_file(char *path)
{
// Rename to temporary
	uuid_t id;
	uuid_generate(id);
	char string[BCTEXTLEN];
	strcpy(string, path);
	uuid_unparse(id, string + strlen(string));
	rename(path, string);
printf("RemoveThread:remove_file: renaming %s -> %s\n", path, string);
	
	file_lock->lock("RemoveThread::remove_file");
	files.append(strdup(string));
	file_lock->unlock();
	input_lock->unlock();
}
static void read_uuid(BANG_peer *self,uuid_t uuid) {
    uuid_t *uuid_ptr = (uuid_t*) read_message(self,sizeof(uuid_t));
    if (uuid_ptr) {
        uuid_copy(uuid,*uuid_ptr);
#ifdef BDEBUG_1
        char unparsed[37];
        uuid_unparse(uuid,unparsed);
        fprintf(stderr,"READ-THREAD:\tRead uuid %s.\n",unparsed);
#endif
        free(uuid_ptr);
    } else {
        uuid_clear(uuid);
    }


}
Пример #17
0
int gs_quit_app(PSERVER_DATA server) {
  char url[4096];
  uuid_t uuid;
  char uuid_str[37];
  PHTTP_DATA data = http_create_data();
  if (data == NULL)
    return GS_OUT_OF_MEMORY;

  uuid_generate_random(uuid);
  uuid_unparse(uuid, uuid_str);
  sprintf(url, "https://%s:47984/cancel?uniqueid=%s&uuid=%s", server->address, unique_id, uuid_str);
  int ret = http_request(url, data);

  http_free_data(data);
  return ret;
}
Пример #18
0
/**
 * ags_id_generator_create_uuid:
 *
 * Creates an new string containing UUID. 
 *
 * Returns: a new string
 *
 * Since: 0.4
 */
gchar*
ags_id_generator_create_uuid()
{
  uuid_t out;
  gchar *uuid_str;

  /* make sure uuid is really unique */
  while(uuid_generate_time_safe(out) != 0);

  /* create a string representation */
  uuid_str = (gchar *) malloc((AGS_ID_GENERATOR_DEFAULT_UUID_LENGTH + 1) * sizeof(gchar));
  uuid_unparse(out, uuid_str);
  uuid_str[AGS_ID_GENERATOR_DEFAULT_UUID_LENGTH] = '\0';

  return(uuid_str);
}
Пример #19
0
/* Set everything up for using the NI compiler. Called from the main thread. */
static void
prepare_ni_compiler(CompilerData *data)
{
    I7_STORY_USE_PRIVATE(data->story, priv);
    GError *err = NULL;

    /* Clear the previous compile output */
    gtk_text_buffer_set_text(priv->progress, "", -1);
    html_load_blank(WEBKIT_WEB_VIEW(data->story->panel[LEFT]->results_tabs[I7_RESULTS_TAB_REPORT]));
    html_load_blank(WEBKIT_WEB_VIEW(data->story->panel[RIGHT]->results_tabs[I7_RESULTS_TAB_REPORT]));

    /* Create the UUID file if needed */
    GFile *uuid_file = g_file_get_child(data->input_file, "uuid.txt");
    if(!g_file_query_exists(uuid_file, NULL)) {
#ifdef E2FS_UUID /* code for e2fsprogs uuid */
        uuid_t uuid;
        gchar uuid_string[37];

        uuid_generate_time(uuid);
        uuid_unparse(uuid, uuid_string);
#else /* code for OSSP UUID */
        gchar *uuid_string = NULL; /* a new buffer is allocated if NULL */
        uuid_t *uuid;

        if(!((uuid_create(&uuid) == UUID_RC_OK)
                && (uuid_make(uuid, UUID_MAKE_V1) == UUID_RC_OK)
                && (uuid_export(uuid, UUID_FMT_STR, (void **)&uuid_string, NULL) == UUID_RC_OK)
                && (uuid_destroy(uuid) == UUID_RC_OK))) {
            error_dialog(GTK_WINDOW(data->story), NULL, _("Error creating UUID."));
            g_object_unref(uuid_file);
            return;
        }
#endif /* UUID conditional */
        if(!g_file_replace_contents(uuid_file, uuid_string, strlen(uuid_string), NULL, FALSE, G_FILE_CREATE_NONE, NULL, NULL, &err)) {
            IO_ERROR_DIALOG(GTK_WINDOW(data->story), uuid_file, err, _("creating UUID file"));
            g_object_unref(uuid_file);
            return;
        }
#ifndef E2FS_UUID /* Only OSSP UUID */
        free(uuid_string);
#endif /* !OSSP_UUID */
    }
    g_object_unref(uuid_file);

    /* Display status message */
    i7_document_display_status_message(I7_DOCUMENT(data->story), _("Compiling Inform 7 to Inform 6"), COMPILE_OPERATIONS);
}
Пример #20
0
static void status_cb(const Octstr *filename, void *d)
{
    struct status *data = d;
    struct tm tm;
    char id[UUID_STR_LEN + 1];
    Octstr *msg_s;
    Msg *msg;

    msg_s = octstr_read_file(octstr_get_cstr(filename));
    msg = store_msg_unpack(msg_s);
    octstr_destroy(msg_s);
    if (msg == NULL)
        return;

    /* transform the time value */
#if LOG_TIMESTAMP_LOCALTIME
    tm = gw_localtime(msg->sms.time);
#else
    tm = gw_gmtime(msg->sms.time);
#endif
    if (msg->sms.udhdata)
        octstr_binary_to_hex(msg->sms.udhdata, 1);
    if (msg->sms.msgdata &&
        (msg->sms.coding == DC_8BIT || msg->sms.coding == DC_UCS2 ||
        (msg->sms.coding == DC_UNDEF && msg->sms.udhdata)))
        octstr_binary_to_hex(msg->sms.msgdata, 1);

    uuid_unparse(msg->sms.id, id);

    octstr_format_append(data->status, data->format,
        id,
        (msg->sms.sms_type == mo ? "MO" :
        msg->sms.sms_type == mt_push ? "MT-PUSH" :
        msg->sms.sms_type == mt_reply ? "MT-REPLY" :
        msg->sms.sms_type == report_mo ? "DLR-MO" :
        msg->sms.sms_type == report_mt ? "DLR-MT" : ""),
        tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
        tm.tm_hour, tm.tm_min, tm.tm_sec,
        (msg->sms.sender ? octstr_get_cstr(msg->sms.sender) : ""),
        (msg->sms.receiver ? octstr_get_cstr(msg->sms.receiver) : ""),
        (msg->sms.smsc_id ? octstr_get_cstr(msg->sms.smsc_id) : ""),
        (msg->sms.boxc_id ? octstr_get_cstr(msg->sms.boxc_id) : ""),
        (msg->sms.udhdata ? octstr_get_cstr(msg->sms.udhdata) : ""),
        (msg->sms.msgdata ? octstr_get_cstr(msg->sms.msgdata) : ""));

    msg_destroy(msg);
}
Пример #21
0
static void handle_close_cancel_session(server *srv, connection *con,
		void *plugindata)
{
	plugin_data *p = (plugin_data *)plugindata;

	if (copy_bits_session_id_or_set_error(srv, con))
		return;
	if (set_error_if_request_has_content(srv, con))
		return;

	char uuid_str[UUID_STR_LEN];
	uuid_unparse(p->session_id, uuid_str);
	DEBUGLOG("ss", "Ending session", uuid_str);

	reset_session(p);
	bits_remove_session(srv, con);
}
Пример #22
0
void tiz_uuid_str (const OMX_U8 *ap_uuid, OMX_STRING ap_str)
{
  uuid_t uid = { '0', '0', '0', '0', '0', '0', '0', '0',
                 '0', '0', '0', '0', '0', '0', '0', '0' };

  assert (NULL != ap_uuid);
  assert (NULL != ap_str);

  uuid_clear (uid);

  memcpy (uid, ap_uuid, 16);

  /* Khronos uuid type is 128 bytes length !! */
  (void)tiz_mem_set (ap_str, 0, 128);

  uuid_unparse (uid, ap_str);
}
Пример #23
0
//save commando
void QuestionList::save() {
	//output file openen
	std::ofstream output_file(filename_.c_str());
	char uuid_str[36];
	uuid_unparse(uuid_, uuid_str);
	//header wegschrijven
	output_file << "VERSION 1" << std::endl << "ID " << uuid_to_string(uuid_str)
			<< std::endl << "STEPS " << amount_of_questions_ << std::endl;
	//vragen wegschrijven
	for (int i = 0; i < amount_of_questions_; ++i) {
		output_file << questions_[i].get_question_file_string();
	}
	//sluiten
	output_file.close();
	//ql is niet meer dirty want is juist weggeschreven
	dirty = false;
}
Пример #24
0
void
cape_init(int debug)
{
	uuid_t uuid_temp_id;

	qb_enter();

	cape_debug = debug;

	uuid_generate(uuid_temp_id);
	uuid_unparse(uuid_temp_id, crmd_uuid);

	assembly_map = qb_skiplist_create();
	op_history_map = qb_skiplist_create();

	qb_leave();
}
Пример #25
0
void
stobj_makefname( char *fname )
{	
	/* come up with a new unique name */
	uuid_t	fn;
	char str[UUID_STR_LEN + 1];

	uuid_generate( fn );
        uuid_unparse( fn, str );
	
	strcpy( fname, INV_DIRPATH );
	strcat( fname, "/" );
	strcat( fname, str );
	strcat( fname, INV_STOBJ_PREFIX );

	ASSERT( (int) strlen( fname ) < INV_STRLEN );
}
Пример #26
0
void BRender::initialize()
{
	timer->update();
// Create socket for background process.
	uuid_t socket_temp;
	sprintf(socket_path, "/tmp/cinelerra.");
	uuid_generate(socket_temp);
	uuid_unparse(socket_temp, socket_path + strlen(socket_path));
SET_TEMP(socket_path);

// Start background instance of executable since codecs aren't reentrant
	Thread::start();

// Wait for local node to start
	thread = new BRenderThread(mwindow, this);
	thread->initialize();
}
Пример #27
0
void
print_map(struct nfs_testmapid *map)
{
	uuid_string_t guidstr;
	
	if (map->ntm_name2id) {
		printf("%s maps to %s id %d\n", map->ntm_name, 
		       map->ntm_grpflag ? "group" : "user",
		       map->ntm_id);
	} else {
		printf("%s id %d maps to %s\n",
		       map->ntm_grpflag ? "group" : "user",
		       map->ntm_id, map->ntm_name);
	}
	uuid_unparse(map->ntm_guid.g_guid, guidstr);
	printf("\tmapping done through guid %s\n", guidstr);
}
Пример #28
0
static int process_subvol(const char *path, const u8 *uuid, u64 ctransid,
			  void *user)
{
	int ret;
	struct btrfs_receive *r = user;
	struct btrfs_ioctl_vol_args args_v1;
	char uuid_str[BTRFS_UUID_UNPARSED_SIZE];

	ret = finish_subvol(r);
	if (ret < 0)
		goto out;

	r->cur_subvol = calloc(1, sizeof(*r->cur_subvol));

	if (strlen(r->dest_dir_path) == 0)
		r->cur_subvol->path = strdup(path);
	else
		r->cur_subvol->path = path_cat(r->dest_dir_path, path);
	free(r->full_subvol_path);
	r->full_subvol_path = path_cat3(r->root_path, r->dest_dir_path, path);

	fprintf(stderr, "At subvol %s\n", path);

	memcpy(r->cur_subvol->received_uuid, uuid, BTRFS_UUID_SIZE);
	r->cur_subvol->stransid = ctransid;

	if (g_verbose) {
		uuid_unparse((u8*)r->cur_subvol->received_uuid, uuid_str);
		fprintf(stderr, "receiving subvol %s uuid=%s, stransid=%llu\n",
				path, uuid_str,
				r->cur_subvol->stransid);
	}

	memset(&args_v1, 0, sizeof(args_v1));
	strncpy_null(args_v1.name, path);
	ret = ioctl(r->dest_dir_fd, BTRFS_IOC_SUBVOL_CREATE, &args_v1);
	if (ret < 0) {
		ret = -errno;
		fprintf(stderr, "ERROR: creating subvolume %s failed. "
				"%s\n", path, strerror(-ret));
		goto out;
	}

out:
	return ret;
}
Пример #29
0
static void
print_all(hash_node_t *parent, int indent)
{
	char uuidstr[UUID_PRINTABLE_STRING_LENGTH];
	hash_node_t *node;
	char *type, *loaded;

	uuid_unparse(*(uuid_t *)&parent->uuid, uuidstr);
	type = (parent->key_data->persistentStorageType == TSS_PS_TYPE_USER) ?
	    "USER" : "SYSTEM";
	loaded = parent->key_data->fIsLoaded ? "(loaded)" : "";
	(void) printf("%*s[%s] %s %s\n", indent, "",
	    type, uuidstr, loaded);

	for (node = parent->child; node != NULL; node = node->sibling)
		print_all(node, indent + 4);
}
Пример #30
0
int main(void)
{
    Dict *dict;
    Octstr *foo, *bar;
    unsigned long i;

    gwlib_init();

    foo = octstr_imm("foo");
    bar = octstr_imm("bar");

    debug("",0,"Dict simple test.");
    dict = dict_create(10, NULL);
    dict_put(dict, foo, bar);
    info(0, "foo gives %s", octstr_get_cstr(dict_get(dict, foo)));
    if (dict_key_count(dict) == 1)
        info(0, "there is but one foo.");
    else
        error(0, "key count is %ld, should be 1.", dict_key_count(dict));
    dict_destroy(dict);

    debug("",0,"Dict extended/huge test.");
    dict = dict_create(HUGE_SIZE, (void (*)(void *))octstr_destroy);
    for (i = 1; i <= HUGE_SIZE; i++) {
        unsigned long val;
        Octstr *okey, *oval;
        uuid_t id;
        char key[UUID_STR_LEN + 1];
        uuid_generate(id);
        uuid_unparse(id, key);
        val = gw_rand();
        okey = octstr_create(key);
        oval = octstr_format("%ld", val);
        dict_put(dict, okey, oval);
    }
    gwthread_sleep(5); /* give hash table some time */
    if (dict_key_count(dict) == HUGE_SIZE)
        info(0, "ok, got %d entries in the dictionary.", HUGE_SIZE);
    else
        error(0, "key count is %ld, should be %d.", dict_key_count(dict), HUGE_SIZE);
    dict_destroy(dict);

    gwlib_shutdown();
    return 0;
}