コード例 #1
0
ファイル: vdir.c プロジェクト: laochailan/taisei
static bool vfs_vdir_mkdir(VFSNode *node, const char *subdir) {
	if(!subdir) {
		vfs_set_error("Virtual directory trying to create itself? How did you even get here?");
		return false;
	}

	VFSNode *subnode = vfs_alloc();
	vfs_vdir_init(subnode);
	vfs_vdir_mount(node, subdir, subnode);

	return true;
}
コード例 #2
0
ファイル: zipfile.c プロジェクト: laochailan/taisei
static VFSNode* vfs_zipfile_locate(VFSNode *node, const char *path) {
	VFSZipFileTLS *tls = vfs_zipfile_get_tls(node, true);
	VFSZipFileData *zdata = node->data1;
	int64_t idx;

	if(!ht_lookup(&zdata->pathmap, path, &idx)) {
		idx = zip_name_locate(tls->zip, path, 0);
	}

	if(idx < 0) {
		return NULL;
	}

	VFSNode *n = vfs_alloc();
	vfs_zippath_init(n, node, idx);
	return n;
}
コード例 #3
0
ファイル: syspath_public.c プロジェクト: laochailan/taisei
bool vfs_mount_syspath(const char *mountpoint, const char *fspath, uint flags) {
	VFSNode *rdir = vfs_alloc();

	if(!vfs_syspath_init(rdir, fspath)) {
		vfs_set_error("Can't initialize path: %s", vfs_get_error());
		vfs_decref(rdir);
		return false;
	}

	if((flags & VFS_SYSPATH_MOUNT_MKDIR) && !vfs_node_mkdir(rdir, NULL)) {
		vfs_set_error("Can't create directory: %s", vfs_get_error());
		vfs_decref(rdir);
		return false;
	}

	if(flags & VFS_SYSPATH_MOUNT_READONLY) {
		VFSNode *rdir_ro = vfs_ro_wrap(rdir);
		vfs_decref(rdir);
		rdir = rdir_ro;
	}

	return vfs_mount_or_decref(vfs_root, mountpoint, rdir);
}
コード例 #4
0
ファイル: union_public.c プロジェクト: nexAkari/taisei
bool vfs_create_union_mountpoint(const char *mountpoint) {
    VFSNode *unode = vfs_alloc();
    vfs_union_init(unode);
    return vfs_mount_or_decref(vfs_root, mountpoint, unode);
}