Exemple #1
0
struct page *___toi_get_nonconflicting_page(int can_be_highmem)
{
	struct page *page;
	gfp_t flags = TOI_ATOMIC_GFP;
	if (can_be_highmem)
		flags |= __GFP_HIGHMEM;


	if (test_toi_state(TOI_LOADING_ALT_IMAGE) &&
			pageset2_map &&
			(ptoi_pfn != BM_END_OF_MAP)) {
		do {
			ptoi_pfn = memory_bm_next_pfn(pageset2_map);
			if (ptoi_pfn != BM_END_OF_MAP) {
				page = pfn_to_page(ptoi_pfn);
				if (!PagePageset1(page) &&
				    (can_be_highmem || !PageHighMem(page)))
					return page;
			}
		} while (ptoi_pfn != BM_END_OF_MAP);
	}

	do {
		page = toi_alloc_page(29, flags);
		if (!page) {
			printk(KERN_INFO "Failed to get nonconflicting "
					"page.\n");
			return NULL;
		}
		if (PagePageset1(page)) {
			struct page **next = (struct page **) kmap(page);
			*next = first_conflicting_page;
			first_conflicting_page = page;
			kunmap(page);
		}
	} while (PagePageset1(page));

	return page;
}
Exemple #2
0
void toi_early_boot_message(int message_detail, int default_answer,
	char *warning_reason, ...)
{
#if defined(CONFIG_VT) || defined(CONFIG_SERIAL_CONSOLE)
	unsigned long orig_state = get_toi_state(), continue_req = 0;
	unsigned long orig_loglevel = console_loglevel;
	int can_ask = 1;
#else
	int can_ask = 0;
#endif

	va_list args;
	int printed_len;

	if (!toi_wait) {
		set_toi_state(TOI_CONTINUE_REQ);
		can_ask = 0;
	}

	if (warning_reason) {
		va_start(args, warning_reason);
		printed_len = vsnprintf(local_printf_buf,
				sizeof(local_printf_buf),
				warning_reason,
				args);
		va_end(args);
	}

	if (!test_toi_state(TOI_BOOT_TIME)) {
		printk("TuxOnIce: %s\n", local_printf_buf);
		return;
	}

	if (!can_ask) {
		continue_req = !!default_answer;
		goto post_ask;
	}

#if defined(CONFIG_VT) || defined(CONFIG_SERIAL_CONSOLE)
	console_loglevel = 7;

	say("=== TuxOnIce ===\n\n");
	if (warning_reason) {
		say("BIG FAT WARNING!! %s\n\n", local_printf_buf);
		switch (message_detail) {
		case 0:
			say("If you continue booting, note that any image WILL"
				"NOT BE REMOVED.\nTuxOnIce is unable to do so "
				"because the appropriate modules aren't\n"
				"loaded. You should manually remove the image "
				"to avoid any\npossibility of corrupting your "
				"filesystem(s) later.\n");
			break;
		case 1:
			say("If you want to use the current TuxOnIce image, "
				"reboot and try\nagain with the same kernel "
				"that you hibernated from. If you want\n"
				"to forget that image, continue and the image "
				"will be erased.\n");
			break;
		}
		say("Press SPACE to reboot or C to continue booting with "
			"this kernel\n\n");
		if (toi_wait > 0)
			say("Default action if you don't select one in %d "
				"seconds is: %s.\n",
				toi_wait,
				default_answer == TOI_CONTINUE_REQ ?
				"continue booting" : "reboot");
	} else {
		say("BIG FAT WARNING!!\n\n"
			"You have tried to resume from this image before.\n"
			"If it failed once, it may well fail again.\n"
			"Would you like to remove the image and boot "
			"normally?\nThis will be equivalent to entering "
			"noresume on the\nkernel command line.\n\n"
			"Press SPACE to remove the image or C to continue "
			"resuming.\n\n");
		if (toi_wait > 0)
			say("Default action if you don't select one in %d "
				"seconds is: %s.\n", toi_wait,
				!!default_answer ?
				"continue resuming" : "remove the image");
	}
	console_loglevel = orig_loglevel;

	set_toi_state(TOI_SANITY_CHECK_PROMPT);
	clear_toi_state(TOI_CONTINUE_REQ);

	if (toi_wait_for_keypress(toi_wait) == 0) /* We timed out */
		continue_req = !!default_answer;
	else
		continue_req = test_toi_state(TOI_CONTINUE_REQ);

#endif /* CONFIG_VT or CONFIG_SERIAL_CONSOLE */

post_ask:
	if ((warning_reason) && (!continue_req))
		machine_restart(NULL);

	restore_toi_state(orig_state);
	if (continue_req)
		set_toi_state(TOI_CONTINUE_REQ);
}