当前位置: 首页>>代码示例>>C++>>正文


C++ do_mount函数代码示例

本文整理汇总了C++中do_mount函数的典型用法代码示例。如果您正苦于以下问题:C++ do_mount函数的具体用法?C++ do_mount怎么用?C++ do_mount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了do_mount函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: do_mount_mainfs

void do_mount_mainfs(void)
{
#ifdef CONFIG_MTD
	struct mtd_info *mtd = NULL;
	char mtd_name[32];

	mtd = get_mtd_device_nm(CONFIG_RG_MAINFS_MTDPART_NAME);
	if (IS_ERR(mtd))
	{
	    panic("Can not find %s MTD partition",
		CONFIG_RG_MAINFS_MTDPART_NAME);
	}

	sprintf(mtd_name, "/dev/mtdblock%d", mtd->index);

	printk("Found device %s on mtdblock%d\n",
	    CONFIG_RG_MAINFS_MTDPART_NAME, mtd->index);

	if (do_mount(mtd_name, "/mnt/cramfs", "cramfs", MS_RDONLY, 0))
	    printk("Warning: unable to mount cramfs\n");
#else
	if (do_mount("cramfs", "/mnt/cramfs", "cramfs_mainfs", MS_RDONLY, 0))
	    printk("Warning: unable to mount cramfs\n");
#endif
}
开发者ID:DentonGentry,项目名称:gfiber-gfrg100,代码行数:25,代码来源:main.c

示例2: switch

void Mount::run_mount(const QString& name)
{
    const CryptTab::VolumeInfo vi = ctab.location(name);
    const QString location = vi.location;
    if (location.length()) {
        State state = mounts.state(location, name);
        switch(state) {
        case disconnected: {
            emit signal([&](){
                 QMessageBox msgBox;
                 msgBox.setWindowTitle("Fail to mount");
                 msgBox.setText("You can't mount a disconnected drive. Please, connect it first");
                 msgBox.exec();});
        }
        break;
        case connected: {
            QString text;

            if (vi.ask_pass) {    // ask password
                bool ok;
                QString cap("Unlocking");
                cap.append(' ');
                cap.append(name);
                QString msg ("Please, enter passphrase");
                emit (signal([&](){
                    text = QInputDialog::getText(parent,
                                                 cap,
                                                 msg,
                                                 QLineEdit::Password,
                                                 "",
                                                 &ok);
                }));
                if (!ok || text.isEmpty()) {
                    break;
                }
            }

            if(do_cryptdisk_start(name, vi, text))
            {
                do_mount(name);
            } else {
                emit (signal([&](){
                    QMessageBox msgBox;
                    msgBox.setWindowTitle("Fail to mount");
                    msgBox.setText("Wrong password");
                    msgBox.exec();
                }));
            }
        }
        break;
        case dm_started:
            do_mount(name);
        default: /* nothing to do here */
            ;;
        }
    }
}
开发者ID:urykhy,项目名称:qcryptdisk,代码行数:57,代码来源:util.cpp

示例3: do_mount_by_pattern

static int do_mount_by_pattern(struct libmnt_context *cxt, const char *pattern)
{
	int neg = pattern && strncmp(pattern, "no", 2) == 0;
	int rc = -EINVAL;
	char **filesystems, **fp;

	assert(cxt);
	assert((cxt->flags & MNT_FL_MOUNTFLAGS_MERGED));

	if (!neg && pattern) {
		/*
		 * try all types from the list
		 */
		char *p, *p0;

		DBG(CXT, mnt_debug_h(cxt, "trying to mount by FS pattern list"));

		p0 = p = strdup(pattern);
		if (!p)
			return -ENOMEM;
		do {
			char *end = strchr(p, ',');
			if (end)
				*end = '\0';
			rc = do_mount(cxt, p);
			p = end ? end + 1 : NULL;

		} while (!mnt_context_get_status(cxt) && p);

		free(p0);

		if (mnt_context_get_status(cxt))
			return rc;
	}

	/*
	 * try /etc/filesystems and /proc/filesystems
	 */
	DBG(CXT, mnt_debug_h(cxt, "trying to mount by filesystems lists"));

	rc = mnt_get_filesystems(&filesystems, neg ? pattern : NULL);
	if (rc)
		return rc;

	for (fp = filesystems; *fp; fp++) {
		rc = do_mount(cxt, *fp);
		if (mnt_context_get_status(cxt))
			break;
		if (mnt_context_get_syscall_errno(cxt) != EINVAL)
			break;
	}
	mnt_free_filesystems(filesystems);
	return rc;
}
开发者ID:bdwalton,项目名称:util-linux,代码行数:54,代码来源:context_mount.c

示例4: bootmgr_boot_sd

uint8_t bootmgr_boot_sd(void)
{
    bootmgr_set_lines_count(0);
    bootmgr_set_fills_count(0);

    char *path = (char*)malloc(200);
    if(selected == 2)
    {
        bootmgr_printf(-1, 20, WHITE, "Booting from SD-card...");
        sprintf(path, "/sdroot/multirom/rom");
    }
    else
    {
        sprintf(path, "/sdroot/multirom/backup/%s", backups[selected-5]);
        bootmgr_printf(-1, 20, WHITE, "Booting \"%s\"...", backups[selected-5]);
    }

    selected = -1;
    bootmgr_draw();

    char *p = (char*)malloc(200);
    char *s = (char*)malloc(50);
    sprintf(p, "%s/boot", path);
    bootmgr_import_boot(p);

    char * mount_args[] = { NULL, "ext4", p, s, "bind" };

    // /system
    sprintf(p, "%s/system", path);
    strcpy(s, "/system");
    if(do_mount(5, mount_args) < 0)
    {
        bootmgr_printf(-1, 20, WHITE, "Mount %s failed", mount_args[2]);
        bootmgr_draw();
        return 0;
    }

    // /data
    sprintf(p, "%s/data", path);
    strcpy(s, "/data");
    do_mount(5, mount_args);

    // /cache
    sprintf(p, "%s/cache", path);
    strcpy(s, "/cache");
    do_mount(5, mount_args);

    free(p);
    free(s);
    free(path);

    return 1;
}
开发者ID:bigsupersquid,项目名称:multirom,代码行数:53,代码来源:bootmgr.c

示例5: mount_fuse

static int mount_fuse(const char *mnt, const char *opts)
{
    int res;
    int fd;
    char *dev;
    struct stat stbuf;
    char *type = NULL;
    char *source = NULL;
    char *mnt_opts = NULL;
    const char *real_mnt = mnt;
    int currdir_fd = -1;
    int mountpoint_fd = -1;

    fd = open_fuse_device(&dev);
    if (fd == -1)
        return -1;

    if (getuid() != 0 && mount_max != -1) {
        if (count_fuse_fs() >= mount_max) {
            fprintf(stderr, "%s: too many mounted FUSE filesystems (%d+)\n",
		    progname, mount_max);
	    goto err;
        }
    }

    res = check_perm(&real_mnt, &stbuf, &currdir_fd, &mountpoint_fd);
    if (res != -1)
         res = do_mount(real_mnt, &type, stbuf.st_mode & S_IFMT, fd, opts, dev,
			&source, &mnt_opts);

    if (currdir_fd != -1) {
	 __attribute__((unused))int ignored_fchdir_status =
	        fchdir(currdir_fd);
        close(currdir_fd);
    }
开发者ID:AllardJ,项目名称:Tomato,代码行数:35,代码来源:fusermount.c

示例6: do_format

static bool do_format(const std::string &mountpoint)
{
    if (mountpoint == SYSTEM || mountpoint == CACHE) {
        // Need to mount the partition if we're using an image file and it
        // hasn't been mounted
        int needs_mount = (mountpoint == SYSTEM)
                && (access("/mb/system.img", F_OK) == 0)
                && (access(STAMP_FILE, F_OK) != 0);

        if (needs_mount && !do_mount(mountpoint)) {
            LOGE(TAG "Failed to mount {}", mountpoint);
            return false;
        }

        if (!wipe_directory(mountpoint, true)) {
            LOGE(TAG "Failed to wipe {}", mountpoint);
            return false;
        }

        if (needs_mount && !do_unmount(mountpoint)) {
            LOGE(TAG "Failed to unmount {}", mountpoint);
            return false;
        }
    } else if (mountpoint == DATA) {
        if (!wipe_directory(mountpoint, false)) {
            LOGE(TAG "Failed to wipe {}", mountpoint);
            return false;
        }
    }

    LOGD(TAG "Formatted {}", mountpoint);

    return true;
}
开发者ID:iebie,项目名称:DualBootPatcher,代码行数:34,代码来源:update_binary_tool.cpp

示例7: prepare_buffer

static int prepare_buffer(int argc, char * argv[]) 
{

	if (argc<2) {
		usage();
		return -1;
	}
	if (strncmp(argv[1],"mount",5)==0) {
		return do_mount(argc,argv);
	} else if (strncmp(argv[1],"resume",6)==0) {
		return do_resume(argc,argv);
	} else if (strncmp(argv[1],"suspend",7)==0) {
		return do_suspend(argc,argv);

	} else if (strncmp(argv[1],"status",6)==0) {
		return do_status(argc,argv);

	} else if (strncmp(argv[1],"unmount",7)==0) {
		return do_unmount(argc,argv);
	} else if (strncmp(argv[1],"exit",4)==0) {
		return do_exit(argc,argv);

	} else {
		usage();
		return -1;
	}

	return 0;
}
开发者ID:007,项目名称:afpfs-ng,代码行数:29,代码来源:client.c

示例8: do_fslogin

/*===========================================================================*
 *                              do_fslogin                                   *
 *===========================================================================*/
PUBLIC int do_fslogin()
{
  /* Login before mount request */
  if ((unsigned long)mount_m_in.m1_p3 != who_e) {
      last_login_fs_e = who_e;
      return SUSPEND;
  }
  /* Login after a suspended mount */
  else {
      /* Copy back original mount request message */
      m_in = mount_m_in;

      /* Set up last login FS */
      last_login_fs_e = who_e;

      /* Set up endpoint and call nr */
      who_e = m_in.m_source;
      who_p = _ENDPOINT_P(who_e);
      call_nr = m_in.m_type;
      fp = &fproc[who_p];       /* pointer to proc table struct */
      super_user = (fp->fp_effuid == SU_UID ? TRUE : FALSE);   /* su? */
      
      
      return do_mount();
  }
}
开发者ID:boostsup,项目名称:minix3,代码行数:29,代码来源:mount.c

示例9: do_format

static bool do_format(const char *mountpoint)
{
    if (!get_paths(mountpoint, nullptr, nullptr)) {
        LOGE(TAG "%s: Invalid mountpoint", mountpoint);
        return false;
    }

    bool needs_mount = !util::is_mounted(mountpoint);

    if (needs_mount && !do_mount(mountpoint)) {
        LOGE(TAG "%s: Failed to mount path", mountpoint);
        return false;
    }

    std::vector<std::string> exclusions;
    if (strcmp(mountpoint, DATA) == 0) {
        exclusions.push_back("media");
    }

    if (!wipe_directory(mountpoint, exclusions)) {
        LOGE(TAG "%s: Failed to wipe directory", mountpoint);
        return false;
    }

    if (needs_mount && !do_unmount(mountpoint)) {
        LOGE(TAG "%s: Failed to unmount path", mountpoint);
        return false;
    }

    LOGD(TAG "Successfully formatted %s", mountpoint);

    return true;
}
开发者ID:Caio99BR,项目名称:DualBootPatcher,代码行数:33,代码来源:update_binary_tool.cpp

示例10: main

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);
}
开发者ID:Agochka,项目名称:klibc,代码行数:59,代码来源:mount_main.c

示例11: sunos_nfs_mount

asmlinkage int sunos_nfs_mount(char *dir_name, int linux_flags, void *data)
{
	int  ret = -ENODEV, error;
	int  server_fd;
	char *the_name;
	struct nfs_mount_data linux_nfs_mount;
	struct sunos_nfs_mount_args *sunos_mount = data;
	dev_t dev;

	error = verify_area(VERIFY_READ, data, sizeof (struct sunos_nfs_mount_args));
	if (error)
		return error;
	/* Ok, here comes the fun part: Linux's nfs mount needs a
	 * socket connection to the server, but SunOS mount does not
	 * require this, so we use the information on the destination
	 * address to create a socket and bind it to a reserved
	 * port on this system
	 */
	server_fd = sys_socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
	if (server_fd < 0)
		return -ENXIO;

	if (!sunos_nfs_get_server_fd (server_fd, sunos_mount->addr)){
		sys_close (server_fd);
		return -ENXIO;
	}

	/* Now, bind it to a locally reserved port */
	linux_nfs_mount.version  = NFS_MOUNT_VERSION;
	linux_nfs_mount.flags    = sunos_mount->flags;
	linux_nfs_mount.addr     = *sunos_mount->addr;
	linux_nfs_mount.root     = *sunos_mount->fh;
	linux_nfs_mount.fd       = server_fd;
	
	linux_nfs_mount.rsize    = get_default (sunos_mount->rsize, 8192);
	linux_nfs_mount.wsize    = get_default (sunos_mount->wsize, 8192);
	linux_nfs_mount.timeo    = get_default (sunos_mount->timeo, 10);
	linux_nfs_mount.retrans  = sunos_mount->retrans;
	
	linux_nfs_mount.acregmin = sunos_mount->acregmin;
	linux_nfs_mount.acregmax = sunos_mount->acregmax;
	linux_nfs_mount.acdirmin = sunos_mount->acdirmin;
	linux_nfs_mount.acdirmax = sunos_mount->acdirmax;

	if (getname (sunos_mount->hostname, &the_name))
		return -EFAULT;

	strncpy (linux_nfs_mount.hostname, the_name, 254);
	linux_nfs_mount.hostname [255] = 0;
	putname (the_name);

	dev = get_unnamed_dev ();
	
	ret = do_mount (dev, "", dir_name, "nfs", linux_flags, &linux_nfs_mount);
	if (ret)
	    put_unnamed_dev(dev);

	return ret;
}
开发者ID:andreiw,项目名称:mkunity,代码行数:59,代码来源:sys_sunos.c

示例12: sys_mount

static uint32_t sys_mount(uint32_t arg[])
{
	const char *source = (const char *)arg[0];
	const char *target = (const char *)arg[1];
	const char *filesystemtype = (const char *)arg[2];
	const void *data = (const void *)arg[3];
	return do_mount(source, filesystemtype);
}
开发者ID:cty12,项目名称:ucore_plus,代码行数:8,代码来源:syscall.c

示例13: sunos_nfs_mount

/* XXXXXXXXXXXXXXXXXXXX */
static int sunos_nfs_mount(char *dir_name, int linux_flags, void *data)
{
	int  server_fd;
	char *the_name;
	struct nfs_mount_data linux_nfs_mount;
	struct sunos_nfs_mount_args sunos_mount;

	/* Ok, here comes the fun part: Linux's nfs mount needs a
	 * socket connection to the server, but SunOS mount does not
	 * require this, so we use the information on the destination
	 * address to create a socket and bind it to a reserved
	 * port on this system
	 */
	if (copy_from_user(&sunos_mount, data, sizeof(sunos_mount)))
		return -EFAULT;

	server_fd = sys_socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
	if (server_fd < 0)
		return -ENXIO;

	if (copy_from_user(&linux_nfs_mount.addr,sunos_mount.addr,
				sizeof(*sunos_mount.addr)) ||
	    copy_from_user(&linux_nfs_mount.root,sunos_mount.fh,
				sizeof(*sunos_mount.fh))) {
		sys_close (server_fd);
		return -EFAULT;
	}

	if (!sunos_nfs_get_server_fd (server_fd, &linux_nfs_mount.addr)){
		sys_close (server_fd);
		return -ENXIO;
	}

	/* Now, bind it to a locally reserved port */
	linux_nfs_mount.version  = NFS_MOUNT_VERSION;
	linux_nfs_mount.flags    = sunos_mount.flags;
	linux_nfs_mount.fd       = server_fd;
	
	linux_nfs_mount.rsize    = get_default (sunos_mount.rsize, 8192);
	linux_nfs_mount.wsize    = get_default (sunos_mount.wsize, 8192);
	linux_nfs_mount.timeo    = get_default (sunos_mount.timeo, 10);
	linux_nfs_mount.retrans  = sunos_mount.retrans;
	
	linux_nfs_mount.acregmin = sunos_mount.acregmin;
	linux_nfs_mount.acregmax = sunos_mount.acregmax;
	linux_nfs_mount.acdirmin = sunos_mount.acdirmin;
	linux_nfs_mount.acdirmax = sunos_mount.acdirmax;

	the_name = getname(sunos_mount.hostname);
	if(IS_ERR(the_name))
		return PTR_ERR(the_name);

	strlcpy(linux_nfs_mount.hostname, the_name,
		sizeof(linux_nfs_mount.hostname));
	putname (the_name);
	
	return do_mount ("", dir_name, "nfs", linux_flags, &linux_nfs_mount);
}
开发者ID:sarnobat,项目名称:knoppix,代码行数:59,代码来源:sys_sunos32.c

示例14: parse_mount

int parse_mount(struct autofs_point *ap, const char *name,
		int name_len, const char *mapent, void *context)
{
	char source[HESIOD_LEN + 1];
	char fstype[HESIOD_LEN + 1];
	char options[HESIOD_LEN + 1];
	char *q;
	const char *p;
	int ret;

	ap->entry->current = NULL;
	master_source_current_signal(ap->entry);

	p = mapent;
	q = fstype;

	/* Skip any initial whitespace... */
	while (isspace(*p))
		p++;

	/* Isolate the filesystem type... */
	while (!isspace(*p)) {
		*q++ = tolower(*p++);
	}
	*q = 0;

	/* If it's an error message... */
	if (!strcasecmp(fstype, "err")) {
		error(ap->logopt, MODPREFIX "%s", mapent);
		return 1;
	/* If it's an AFS fs... */
	} else if (!strcasecmp(fstype, "afs"))
		ret = parse_afs(ap, mapent, name, name_len,
				source, sizeof(source), options,
				sizeof(options));
	/* If it's NFS... */
	else if (!strcasecmp(fstype, "nfs"))
		ret = parse_nfs(ap, mapent, name, name_len,
				source, sizeof(source), options,
				sizeof(options));
	/* Punt. */
	else
		ret = parse_generic(ap, mapent, name, name_len,
				    source, sizeof(source), options,
				    sizeof(options));

	if (ret) {
		error(ap->logopt, MODPREFIX "failed to parse entry");
		return 1;
	} else {
		debug(ap->logopt,
		      MODPREFIX "mount %s is type %s from %s",
		      name, fstype, source);
	}

	return do_mount(ap, ap->path, name, name_len, source, fstype, options);
}
开发者ID:sigma,项目名称:docker-coreos-autofs,代码行数:57,代码来源:parse_hesiod.c

示例15: do_mount

/*
 * Unmount the device
 *
 * If timeout, wait until the unmount command returns 0.
 * If !timeout, try to unmount the device only once.
 */
bool win32_file_device::unmount_backend(DCR *dcr, int timeout)
{
   bool retval = true;

   if (requires_mount() && device->unmount_command) {
      retval = do_mount(dcr, false, timeout);
   }

   return retval;
}
开发者ID:karcaw,项目名称:bareos-contrib,代码行数:16,代码来源:win32_file_device.c


注:本文中的do_mount函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。