Пример #1
0
void domain_poweroff(void)
{
	printk("\nBye\n");
	console_done();	// flushes and restores terminal mode

	struct sched_shutdown op;
	op.reason = SHUTDOWN_poweroff;
	HYPERVISOR_sched_op(SCHEDOP_shutdown, &op);
}
Пример #2
0
int cmd_cp(char **argv)
{
	unsigned int argc, verbose = 0;
	int buffer = 0, recursive = 0;
	int force = 0, interactive = 0;
	int c, opt_ind;
	int64_t ret;

	con = console_init(stdin, stdout);
	argc = cli_count_args(argv);

	for (c = 0, optreset = 1, optind = 0, opt_ind = 0; c != -1;) {
		c = getopt_long(argc, argv, "hvVfirb:", long_options, &opt_ind);
		switch (c) { 
		case 'h':
			help_cmd_cp(1);
			return CMD_SUCCESS;
		case 'v':
			printf("%s\n", CP_VERSION);
			return CMD_SUCCESS;
		case 'V':
			verbose = 1;
			break;
		case 'f':
			interactive = 0;
			force = 1;
			break;
		case 'i':
			force = 0;
			interactive = 1;
			break;
		case 'r':
			recursive = 1;
			break;
		case 'b':
			if (-1 == (buffer = strtoint(optarg))) {
				printf("%s: Invalid buffer specification, "
				    "(should be a number greater than zero)\n",
				    cmdname);
				console_done(con);
				return CMD_FAILURE;
			}
			if (verbose)
				printf("Buffer = %d\n", buffer);
			break;
		}
	}

	if (buffer == 0)
		buffer = CP_DEFAULT_BUFLEN;

	argc -= optind;

	if (argc != 2) {
		printf("%s: invalid number of arguments. Try %s --help\n",
		    cmdname, cmdname);
		console_done(con);
		return CMD_FAILURE;
	}

	ret = do_copy(argv[optind], argv[optind + 1], buffer, verbose,
	    recursive, force, interactive);

	console_done(con);

	if (ret == 0)
		return CMD_SUCCESS;
	else
		return CMD_FAILURE;
}