src/sys/mm/rmem/main.c
/**
 * @brief Initializes the remote memory server.
 *
 * @returns Upon successful completion zero is returned. Upon failure,
 * a negative error code is returned instead.
 */
@brief Initializes the remote memory server.
@returns Upon successful completion zero is returned. Upon failure,
a negative error code is returned instead.
@brief Initializes the remote memory server . @returns Upon successful completion zero is returned . Upon failure a negative error code is returned instead .
static int do_rmem_startup(void)
{
	int ret;
	const char *servername;
	uassert(sizeof(struct rmem_message) <= MAILBOX_MSG_SIZE);
	uassert(sizeof(rpage_t) >= sizeof(bitmap_t));
	umemset(
		blocks,
		0,
		(RMEM_NUM_BLOCKS/BITMAP_WORD_LENGTH)*sizeof(bitmap_t)
	);
	stats.nblocks++;
	bitmap_set(blocks, 0);
	for (unsigned long i = 0; i < RMEM_NUM_BLOCKS; i++)
		umemset(&rmem[i][0], 0, RMEM_BLOCK_SIZE);
	nodenum = knode_get_num();
	inbox = stdinbox_get();
	inportal = stdinportal_get();
	serverid = rmem_server_get_id();
	servername = rmem_server_get_name();
	if ((ret = name_link(nodenum, servername)) < 0)
		return (ret);
	uprintf("[nanvix][rmem] server alive");
	uprintf("[nanvix][rmem] attached to node %d", knode_get_num());
	uprintf("[nanvix][rmem] listening to mailbox %d", inbox);
	uprintf("[nanvix][rmem] listening to portal %d", inportal);
	uprintf("[nanvix][rmem] syncing in sync %d", stdsync_get());
	return (0);
}
static int do_rmem_startup ( void ) { int ret ; const char * servername ; uassert ( sizeof ( struct rmem_message ) <= MAILBOX_MSG_SIZE ) ; uassert ( sizeof ( rpage_t ) >= sizeof ( bitmap_t ) ) ; umemset ( blocks , 0 , ( RMEM_NUM_BLOCKS / BITMAP_WORD_LENGTH ) * sizeof ( bitmap_t ) ) ; stats . nblocks ++ ; bitmap_set ( blocks , 0 ) ; for ( unsigned long i = 0 ; i < RMEM_NUM_BLOCKS ; i ++ ) umemset ( & rmem [ i ] [ 0 ] , 0 , RMEM_BLOCK_SIZE ) ; nodenum = knode_get_num ( ) ; inbox = stdinbox_get ( ) ; inportal = stdinportal_get ( ) ; serverid = rmem_server_get_id ( ) ; servername = rmem_server_get_name ( ) ; if ( ( ret = name_link ( nodenum , servername ) ) < 0 ) return ( ret ) ; uprintf ( " " ) ; uprintf ( " " , knode_get_num ( ) ) ; uprintf ( " " , inbox ) ; uprintf ( " " , inportal ) ; uprintf ( " " , stdsync_get ( ) ) ; return ( 0 ) ; }
@brief Initializes the remote memory server.
@brief Initializes the remote memory server .
/* Messages should be small enough. */ /* Bitmap word should be large enough. */ /* Clean bitmap. */ /* Fist block is special. */ /* Clean all blocks. */ /* Assign input mailbox. */ /* Assign input portal. */ /* Link name. */ /* Unblock spawner. */