Lines Matching +full:0 +full:- +full:9

2  * QTest testcase for VirtIO 9P
7 * See the COPYING file in the top-level directory.
11 * Not so fast! You might want to read the 9p developer docs first:
12 * https://wiki.qemu.org/Documentation/9p
17 #include "libqos/virtio-9p-client.h"
38 size_t tag_len = qvirtio_config_readw(v9p->vdev, 0); in pci_config()
45 for (i = 0; i < tag_len; i++) { in pci_config()
46 tag[i] = qvirtio_config_readb(v9p->vdev, i + 2); in pci_config()
54 return a[0] == b[0] && memcmp(&a[5], &b[5], 8) == 0; in is_same_qid()
78 for (i = 0; i < P9_MAXWELEM; i++) { in fs_walk()
84 .client = v9p, .fid = 0, .newfid = 1, in fs_walk()
91 for (i = 0; i < P9_MAXWELEM; i++) { in fs_walk()
98 for (; e; e = e->next) { in fs_dirents_contain_name()
99 if (!strcmp(e->name, name)) { in fs_dirents_contain_name()
119 .client = v9p, .fid = 0, .newfid = 1, in fs_readdir()
129 * submit count = msize - 11, because 11 is the header size of Rreaddir in fs_readdir()
132 .client = v9p, .fid = 1, .offset = 0, .count = P9_MAX_SIZE - 11, in fs_readdir()
153 for (int i = 0; i < QTEST_V9FS_SYNTH_READDIR_NFILES; ++i) { in fs_readdir()
160 g_free(wnames[0]); in fs_readdir()
177 offset = 0; in do_readdir_split()
179 nentries = 0; in do_readdir_split()
183 .client = v9p, .fid = 0, .newfid = fid, in do_readdir_split()
197 npartialentries = 0; in do_readdir_split()
207 if (npartialentries > 0 && partialentries) { in do_readdir_split()
213 tail->next = partialentries; in do_readdir_split()
216 while (tail->next) { in do_readdir_split()
217 tail = tail->next; in do_readdir_split()
219 offset = tail->offset; in do_readdir_split()
236 for (int i = 0; i < QTEST_V9FS_SYNTH_READDIR_NFILES; ++i) { in do_readdir_split()
244 g_free(wnames[0]); in do_readdir_split()
255 .client = v9p, .fid = 0, .newfid = 1, .nwname = 1, .wnames = wnames, in fs_walk_no_slash()
259 g_free(wnames[0]); in fs_walk_no_slash()
269 * The 9p2000 protocol spec says: "If the first element cannot be walked in fs_walk_nonexistent()
272 twalk({ .client = v9p, .path = "non-existent", .expectErr = ENOENT }); in fs_walk_nonexistent()
285 QTEST_V9FS_SYNTH_WALK_FILE "/non-existent", 0 in fs_walk_2nd_nonexistent()
294 * The 9p2000 protocol spec says: "nwqid is therefore either nwname or the in fs_walk_2nd_nonexistent()
299 /* returned QID wqid[0] is file ID of 1st subdir */ in fs_walk_2nd_nonexistent()
300 g_assert(wqid && wqid[0] && !is_same_qid(root_qid, wqid[0])); in fs_walk_2nd_nonexistent()
319 .client = v9p, .fid = 0, .n_uname = getuid(), in fs_walk_none()
324 .client = v9p, .fid = 0, .newfid = 1, .nwname = 0, .wnames = NULL, in fs_walk_none()
328 /* special case: no QID is returned if nwname=0 was sent */ in fs_walk_none()
349 .client = v9p, .fid = 0, .n_uname = getuid(), in fs_walk_dotdot()
354 .client = v9p, .fid = 0, .newfid = 1, .nwname = 1, .wnames = wnames, in fs_walk_dotdot()
358 g_assert_cmpmem(&root_qid, 13, wqid[0], 13); in fs_walk_dotdot()
360 g_free(wnames[0]); in fs_walk_dotdot()
371 .client = v9p, .fid = 0, .newfid = 1, .nwname = 1, .wnames = wnames in fs_lopen()
376 g_free(wnames[0]); in fs_lopen()
390 .client = v9p, .fid = 0, .newfid = 1, .nwname = 1, .wnames = wnames in fs_write()
396 .client = v9p, .fid = 1, .offset = 0, .count = write_count, in fs_write()
401 g_free(wnames[0]); in fs_write()
415 .client = v9p, .fid = 0, .newfid = 1, .nwname = 1, .wnames = wnames in fs_flush_success()
420 /* This will cause the 9p server to try to write data to the backend, in fs_flush_success()
425 .client = v9p, .fid = 1, .offset = 0, in fs_flush_success()
431 .client = v9p, .oldtag = req->tag, .tag = 1, .requestOnly = true in fs_flush_success()
438 g_assert_cmpint(reply_len, ==, 0); in fs_flush_success()
442 g_free(wnames[0]); in fs_flush_success()
456 .client = v9p, .fid = 0, .newfid = 1, .nwname = 1, .wnames = wnames in fs_flush_ignored()
464 should_block = 0; in fs_flush_ignored()
466 .client = v9p, .fid = 1, .offset = 0, in fs_flush_ignored()
472 .client = v9p, .oldtag = req->tag, .tag = 1, .requestOnly = true in fs_flush_ignored()
483 g_free(wnames[0]); in fs_flush_ignored()
508 /* tests using the 9pfs 'local' fs driver */
524 g_assert(stat(new_dir, &st) == 0); in fs_create_dir()
543 g_assert(stat(new_dir, &st) == 0); in fs_unlinkat_dir()
552 g_assert(stat(new_dir, &st) != 0); in fs_unlinkat_dir()
567 g_assert(stat(new_file, &st) == 0); in fs_create_file()
584 g_assert(stat(new_file, &st) == 0); in fs_unlinkat_file()
590 g_assert(stat(new_file, &st) != 0); in fs_unlinkat_file()
604 g_assert(stat(real_file, &st) == 0); in fs_symlink_file()
613 g_assert(stat(symlink_file, &st) == 0); in fs_symlink_file()
628 g_assert(stat(real_file, &st) == 0); in fs_unlinkat_symlink()
635 g_assert(stat(symlink_file, &st) == 0); in fs_unlinkat_symlink()
639 g_assert(stat(symlink_file, &st) != 0); in fs_unlinkat_symlink()
653 g_assert(stat(real_file, &st_real) == 0); in fs_hardlink_file()
662 g_assert(stat(hardlink_file, &st_link) == 0); in fs_hardlink_file()
681 g_assert(stat(real_file, &st_real) == 0); in fs_unlinkat_hardlink()
688 g_assert(stat(hardlink_file, &st_link) == 0); in fs_unlinkat_hardlink()
692 g_assert(stat(hardlink_file, &st_link) != 0); in fs_unlinkat_hardlink()
694 g_assert(stat(real_file, &st_real) == 0); in fs_unlinkat_hardlink()
715 g_assert(stat(real_file, &st_file) == 0); in fs_use_after_unlink()
720 .client = v9p, .fid = 0, .path = "09/doa_file" in fs_use_after_unlink()
722 g_assert(fid_file != 0); in fs_use_after_unlink()
735 .client = v9p, .fid = fid_file, .offset = 0, .count = write_count, in fs_use_after_unlink()
747 /* truncate apparently succeeded, let's double-check the size */ in fs_use_after_unlink()
766 virtio_9p_assign_local_driver(cmd_line, "security_model=mapped-xattr"); in assign_9p_local_driver()
778 /* 9pfs test cases using the 'synth' filesystem driver */ in register_virtio_9p_test()
779 qos_add_test("synth/config", "virtio-9p", pci_config, &opts); in register_virtio_9p_test()
780 qos_add_test("synth/version/basic", "virtio-9p", fs_version, &opts); in register_virtio_9p_test()
781 qos_add_test("synth/attach/basic", "virtio-9p", fs_attach, &opts); in register_virtio_9p_test()
782 qos_add_test("synth/walk/basic", "virtio-9p", fs_walk, &opts); in register_virtio_9p_test()
783 qos_add_test("synth/walk/no_slash", "virtio-9p", fs_walk_no_slash, in register_virtio_9p_test()
785 qos_add_test("synth/walk/none", "virtio-9p", fs_walk_none, &opts); in register_virtio_9p_test()
786 qos_add_test("synth/walk/dotdot_from_root", "virtio-9p", in register_virtio_9p_test()
788 qos_add_test("synth/walk/non_existent", "virtio-9p", fs_walk_nonexistent, in register_virtio_9p_test()
790 qos_add_test("synth/walk/2nd_non_existent", "virtio-9p", in register_virtio_9p_test()
792 qos_add_test("synth/lopen/basic", "virtio-9p", fs_lopen, &opts); in register_virtio_9p_test()
793 qos_add_test("synth/write/basic", "virtio-9p", fs_write, &opts); in register_virtio_9p_test()
794 qos_add_test("synth/flush/success", "virtio-9p", fs_flush_success, in register_virtio_9p_test()
796 qos_add_test("synth/flush/ignored", "virtio-9p", fs_flush_ignored, in register_virtio_9p_test()
798 qos_add_test("synth/readdir/basic", "virtio-9p", fs_readdir, &opts); in register_virtio_9p_test()
799 qos_add_test("synth/readdir/split_512", "virtio-9p", in register_virtio_9p_test()
801 qos_add_test("synth/readdir/split_256", "virtio-9p", in register_virtio_9p_test()
803 qos_add_test("synth/readdir/split_128", "virtio-9p", in register_virtio_9p_test()
807 /* 9pfs test cases using the 'local' filesystem driver */ in register_virtio_9p_test()
809 qos_add_test("local/config", "virtio-9p", pci_config, &opts); in register_virtio_9p_test()
810 qos_add_test("local/create_dir", "virtio-9p", fs_create_dir, &opts); in register_virtio_9p_test()
811 qos_add_test("local/unlinkat_dir", "virtio-9p", fs_unlinkat_dir, &opts); in register_virtio_9p_test()
812 qos_add_test("local/create_file", "virtio-9p", fs_create_file, &opts); in register_virtio_9p_test()
813 qos_add_test("local/unlinkat_file", "virtio-9p", fs_unlinkat_file, &opts); in register_virtio_9p_test()
814 qos_add_test("local/symlink_file", "virtio-9p", fs_symlink_file, &opts); in register_virtio_9p_test()
815 qos_add_test("local/unlinkat_symlink", "virtio-9p", fs_unlinkat_symlink, in register_virtio_9p_test()
817 qos_add_test("local/hardlink_file", "virtio-9p", fs_hardlink_file, &opts); in register_virtio_9p_test()
818 qos_add_test("local/unlinkat_hardlink", "virtio-9p", fs_unlinkat_hardlink, in register_virtio_9p_test()
820 qos_add_test("local/use_after_unlink", "virtio-9p", fs_use_after_unlink, in register_virtio_9p_test()