Exemplo n.º 1
0
int main(int argc, char *argv[])
{
	char *type = NULL;
	int c;

	progname = argv[0];
	rwflag = MS_VERBOSE;

	do {
		c = getopt(argc, argv, "fhino:rt:w");
		if (c == EOF)
			break;
		switch (c) {
		case 'f':
			/* we can't edit /etc/mtab yet anyway; exit */
			exit(0);
		case 'i':
			/* ignore for now; no support for mount helpers */
			break;
		case 'h':
			usage();
		case 'n':
			/* no mtab writing */
			break;
		case 'o':
			rwflag = parse_mount_options(optarg, rwflag, &extra);
			break;
		case 'r':
			rwflag |= MS_RDONLY;
			break;
		case 't':
			type = optarg;
			break;
		case 'w':
			rwflag &= ~MS_RDONLY;
			break;
		case '?':
			fprintf(stderr, "%s: invalid option -%c\n",
				progname, optopt);
			exit(1);
		}
	} while (1);

	if (optind == argc)
		print_mount(type);

	/*
	 * If remount, bind or move was specified, then we don't
	 * have a "type" as such.  Use the dummy "none" type.
	 */
	if (rwflag & MS_TYPE)
		type = "none";

	if (optind + 2 != argc || type == NULL)
		usage();

	return do_mount(argv[optind], argv[optind + 1], type, rwflag,
			extra.str);
}
Exemplo n.º 2
0
static const char *print_a3(const char *val, const rnode *r)
{
	int machine = r->machine, syscall = r->syscall;
	const char *sys = audit_syscall_to_name(syscall, machine);
	if (sys) {
		if (strcmp(sys, "mmap") == 0)
			return print_mmap(val);
		else if (strcmp(sys, "mount") == 0)
			return print_mount(val);
                else if (strcmp(sys, "recv") == 0)
			return print_recv(val);
                else if (strcmp(sys, "recvfrom") == 0)
			return print_recv(val);
                else if (strcmp(sys, "recvmmsg") == 0)
			return print_recv(val);
	}
	return strdup(val);
}