コード例 #1
0
ファイル: virtio-9p-test.c プロジェクト: 8tab/qemu
static void fs_walk(QVirtIO9P *v9p)
{
    char *wnames[P9_MAXWELEM], *paths[P9_MAXWELEM];
    char *last_path = v9p->test_share;
    uint16_t nwqid;
    v9fs_qid *wqid;
    int i;
    P9Req *req;

    for (i = 0; i < P9_MAXWELEM; i++) {
        wnames[i] = g_strdup_printf("%s%d", __func__, i);
        last_path = paths[i] = g_strdup_printf("%s/%s", last_path, wnames[i]);
        g_assert(!mkdir(paths[i], 0700));
    }

    fs_attach(v9p);
    req = v9fs_twalk(v9p, 0, 1, P9_MAXWELEM, wnames);
    v9fs_rwalk(req, &nwqid, &wqid);

    g_assert_cmpint(nwqid, ==, P9_MAXWELEM);

    for (i = 0; i < P9_MAXWELEM; i++) {
        rmdir(paths[P9_MAXWELEM - i - 1]);
        g_free(paths[P9_MAXWELEM - i - 1]);
        g_free(wnames[i]);
    }

    g_free(wqid);
}
コード例 #2
0
ファイル: virtio-9p-test.c プロジェクト: 8tab/qemu
static void fs_walk_no_slash(QVirtIO9P *v9p)
{
    char *const wnames[] = { g_strdup(" /") };
    P9Req *req;
    uint32_t err;

    fs_attach(v9p);
    req = v9fs_twalk(v9p, 0, 1, 1, wnames);
    v9fs_rlerror(req, &err);

    g_assert_cmpint(err, ==, ENOENT);

    g_free(wnames[0]);
}
コード例 #3
0
ファイル: command.c プロジェクト: Ninals-GitHub/TRON
/*
	attach command
*/
LOCAL	void	cmd_attach(INT ac, B *av[])
{
	ER	er;

	if (ac < 3) return;

	er = fs_attach(av[1], av[2], FIMP_FAT, 0, NULL);
	if (er >= E_OK) {
		P("attached '%s' at /'%s'\n", av[1], av[2]);
	} else {
		P("fs_attach(%s, %s, FIMP_FAT ..) ERR [%#x]\n",
						av[1], av[2], er);
	}
}