Пример #1
0
int 
cos_init(void)
{
	char *tar_file;
	int tar_sz, tot = 0;

	lock_static_init(&fs_lock);
	torlib_init();

	fs_init_root(&root);
	root_torrent.data = &root;
	root.flags = TOR_READ | TOR_SPLIT;
	
	/* FIXME: should map in the tar file rather than copy it. */
	tar_sz = initf_size();
	tar_file = malloc(tar_sz);
	if (!tar_file) {
		printc("Tar file of size %d cannot be read\n", tar_sz);
		return -1;
	}
	while (tot < tar_sz) tot += initf_read(tot, &tar_file[tot], tar_sz-tot);
	tar_parse_file(tar_file, &root);

	return 0;
}
Пример #2
0
void cos_init(void)
{
	static volatile int first = 1;
	
	union sched_param sp;

	if (first) {
		first = 0;
		torlib_init();
	}
}
Пример #3
0
int cos_init(void)
{
	int i;

	lock_static_init(&l);
	torlib_init();
	for (i = 0 ; i < COS_TRANS_SERVICE_MAX ; i++) {
		channel_init(i);
	}

	return 0;
}
Пример #4
0
void cos_init(void *arg)
{
	torlib_init();
	lock_static_init(&h_lock);

	if (periodic_wake_create(cos_spd_id(), HTTP_REPORT_FREQ)) BUG();
	while (1) {
		periodic_wake_wait(cos_spd_id());
		printc("HTTP conns %ld, reqs %ld\n", http_conn_cnt, http_req_cnt);
		http_conn_cnt = http_req_cnt = 0;
	}
	
	return;
}
Пример #5
0
static int init(void) 
{
	int cnt = 0;
#ifdef LWIP_STATS
	int stats_cnt = 0;
#endif

	lock_static_init(&net_lock);
	/* printc("netlock id %d\n", net_lock.lock_id); */
	NET_LOCK_TAKE();

	torlib_init();
	net_conn_init();
	cos_net_create_netif_thd();
	init_lwip();

	NET_LOCK_RELEASE();
	/* Start the tcp timer */
	while (1) {
		/* Sleep for a quarter of seconds as prescribed by lwip */
		NET_LOCK_TAKE();

		if (++cnt == 4) {
#ifdef TEST_TIMING
			timing_output();
#endif
		}
#ifdef LWIP_STATS
		if (++stats_cnt == 20) {
			stats_cnt = 0;
			stats_display();
		}
#endif
		tcp_tmr();
		NET_LOCK_RELEASE();
		timed_event_block(cos_spd_id(), 25); /* expressed in ticks currently */
		/* printc("use timer to tcp debug thread here...\n"); */
		cos_mpd_update();
	}

	prints("net: Error -- returning from init!!!");
	BUG();
	return 0;
}
Пример #6
0
static int init(void) 
{
	unsigned short int i;
	void *b;

	torlib_init();
	lock_static_init(&netif_lock);

	NET_LOCK_TAKE();

	cos_vect_init_static(&tmap);
	
	rb_init(&rb1_md_wildcard, &rb1);
	rb_init(&rb2_md, &rb2);

	/* Setup the region from which headers will be transmitted. */
	if (cos_buff_mgmt(COS_BM_XMIT_REGION, &xmit_headers, sizeof(xmit_headers), 0)) {
		prints("net: error setting up xmit region.");
	}

	/* Wildcard upcall */
	if (cos_net_create_net_brand(0, &rb1_md_wildcard)) BUG();
	
	for (i = 0 ; i < NUM_WILDCARD_BUFFS ; i++) {
		if(!(b = alloc_rb_buff(&rb1_md_wildcard))) {
			prints("net: could not allocate the ring buffer.");
		}
		if(rb_add_buff(&rb1_md_wildcard, b, MTU)) {
			prints("net: could not populate the ring with buffer");
		}
	}

	NET_LOCK_RELEASE();

	return 0;
}
Пример #7
0
void cos_init(void)
{
	torlib_init();
}