예제 #1
0
파일: sfs.c 프로젝트: dborca/mc
static const char *
sfs_redirect (struct vfs_class *me, const char *name)
{
    struct cachedfile *cur = head;
    char *cache;
    int handle;

    while (cur) {
	if (!strcmp (name, cur->name)) {
	    vfs_stamp (&vfs_sfs_ops, cur);
	    return cur->cache;
	}
	cur = cur->next;
    }

    handle = vfs_mkstemps (&cache, "sfs", name);

    if (handle == -1) {
	return "/SOMEONE_PLAYING_DIRTY_TMP_TRICKS_ON_US";
    }

    close (handle);

    if (!sfs_vfmake (me, name, cache)) {
	cur = g_new (struct cachedfile, 1);
	cur->name = g_strdup (name);
	cur->cache = cache;
	cur->next = head;
	head = cur;

	vfs_stamp_create (&vfs_sfs_ops, head);

	return cache;
    }
예제 #2
0
파일: gc.c 프로젝트: novacej/School_OSP
void
vfs_release_path (const char *dir)
{
    struct vfs_class *oldvfs;
    vfsid oldvfsid;

    oldvfs = vfs_get_class (dir);
    oldvfsid = vfs_getid (oldvfs, dir);
    vfs_stamp_create (oldvfs, oldvfsid);
}
예제 #3
0
파일: fish.c 프로젝트: dborca/mc
static int
fish_send_command(struct vfs_class *me, struct vfs_s_super *super, const char *cmd, int flags)
{
    int r;

    r = fish_command (me, super, WAIT_REPLY, "%s", cmd);
    vfs_stamp_create (&vfs_fish_ops, super);
    if (r != COMPLETE) ERRNOR (E_REMOTE, -1);
    if (flags & OPT_FLUSH)
	vfs_s_invalidate(me, super);
    return 0;
}
예제 #4
0
파일: direntry.c 프로젝트: dborca/mc
/*
 * Dissect the path and create corresponding superblock.  Note that inname
 * can be changed and the result may point inside the original string.
 */
const char *
vfs_s_get_path_mangle (struct vfs_class *me, char *inname,
		       struct vfs_s_super **archive, int flags)
{
    const char *retval;
    char *local, *op;
    const char *archive_name;
    int result = -1;
    struct vfs_s_super *super;
    void *cookie = NULL;

    archive_name = inname;
    vfs_split (inname, &local, &op);
    retval = (local) ? local : "";

    if (MEDATA->archive_check)
	if (!(cookie = MEDATA->archive_check (me, archive_name, op)))
	    return NULL;

    for (super = MEDATA->supers; super != NULL; super = super->next) {
	/* 0 == other, 1 == same, return it, 2 == other but stop scanning */
	int i;
	if ((i =
	     MEDATA->archive_same (me, super, archive_name, op, cookie))) {
	    if (i == 1)
		goto return_success;
	    else
		break;
	}
    }

    if (flags & FL_NO_OPEN)
	ERRNOR (EIO, NULL);

    super = vfs_s_new_super (me);
    result = MEDATA->open_archive (me, super, archive_name, op);
    if (result == -1) {
	vfs_s_free_super (me, super);
	ERRNOR (EIO, NULL);
    }
    if (!super->name)
	vfs_die ("You have to fill name\n");
    if (!super->root)
	vfs_die ("You have to fill root inode\n");

    vfs_s_insert_super (me, super);
    vfs_stamp_create (me, super);

  return_success:
    *archive = super;
    return retval;
}