Lines Matching full:opt
295 TVersionRes v9fs_tversion(TVersionOpt opt) in v9fs_tversion() argument
304 g_assert(opt.client); in v9fs_tversion()
306 if (!opt.msize) { in v9fs_tversion()
307 opt.msize = P9_MAX_SIZE; in v9fs_tversion()
310 if (!opt.tag) { in v9fs_tversion()
311 opt.tag = P9_NOTAG; in v9fs_tversion()
314 if (!opt.version) { in v9fs_tversion()
315 opt.version = "9P2000.L"; in v9fs_tversion()
318 string_size = v9fs_string_size(opt.version); in v9fs_tversion()
321 req = v9fs_req_init(opt.client, body_size, P9_TVERSION, opt.tag); in v9fs_tversion()
323 v9fs_uint32_write(req, opt.msize); in v9fs_tversion()
324 v9fs_string_write(req, opt.version); in v9fs_tversion()
327 if (!opt.requestOnly) { in v9fs_tversion()
329 if (opt.expectErr) { in v9fs_tversion()
331 g_assert_cmpint(err, ==, opt.expectErr); in v9fs_tversion()
335 opt.version, strlen(opt.version)); in v9fs_tversion()
363 TAttachRes v9fs_tattach(TAttachOpt opt) in v9fs_tattach() argument
369 g_assert(opt.client); in v9fs_tattach()
371 g_assert(!opt.expectErr || !opt.rattach.qid); in v9fs_tattach()
373 if (!opt.requestOnly) { in v9fs_tattach()
374 v9fs_tversion((TVersionOpt) { .client = opt.client }); in v9fs_tattach()
377 if (!opt.n_uname) { in v9fs_tattach()
378 opt.n_uname = getuid(); in v9fs_tattach()
381 P9Req *req = v9fs_req_init(opt.client, 4 + 4 + 2 + 2 + 4, P9_TATTACH, in v9fs_tattach()
382 opt.tag); in v9fs_tattach()
384 v9fs_uint32_write(req, opt.fid); in v9fs_tattach()
388 v9fs_uint32_write(req, opt.n_uname); in v9fs_tattach()
391 if (!opt.requestOnly) { in v9fs_tattach()
393 if (opt.expectErr) { in v9fs_tattach()
395 g_assert_cmpint(err, ==, opt.expectErr); in v9fs_tattach()
397 v9fs_rattach(req, opt.rattach.qid); in v9fs_tattach()
418 TWalkRes v9fs_twalk(TWalkOpt opt) in v9fs_twalk() argument
426 g_assert(opt.client); in v9fs_twalk()
428 g_assert(!opt.path || !(opt.nwname || opt.wnames)); in v9fs_twalk()
430 g_assert(!opt.expectErr || !(opt.rwalk.nwqid || opt.rwalk.wqid)); in v9fs_twalk()
432 if (!opt.newfid) { in v9fs_twalk()
433 opt.newfid = genfid(); in v9fs_twalk()
436 if (opt.path) { in v9fs_twalk()
437 opt.nwname = split(opt.path, "/", &wnames); in v9fs_twalk()
438 opt.wnames = wnames; in v9fs_twalk()
441 for (i = 0; i < opt.nwname; i++) { in v9fs_twalk()
442 uint16_t wname_size = v9fs_string_size(opt.wnames[i]); in v9fs_twalk()
447 req = v9fs_req_init(opt.client, body_size, P9_TWALK, opt.tag); in v9fs_twalk()
448 v9fs_uint32_write(req, opt.fid); in v9fs_twalk()
449 v9fs_uint32_write(req, opt.newfid); in v9fs_twalk()
450 v9fs_uint16_write(req, opt.nwname); in v9fs_twalk()
451 for (i = 0; i < opt.nwname; i++) { in v9fs_twalk()
452 v9fs_string_write(req, opt.wnames[i]); in v9fs_twalk()
456 if (!opt.requestOnly) { in v9fs_twalk()
458 if (opt.expectErr) { in v9fs_twalk()
460 g_assert_cmpint(err, ==, opt.expectErr); in v9fs_twalk()
462 v9fs_rwalk(req, opt.rwalk.nwqid, opt.rwalk.wqid); in v9fs_twalk()
470 .newfid = opt.newfid, in v9fs_twalk()
493 TGetAttrRes v9fs_tgetattr(TGetAttrOpt opt) in v9fs_tgetattr() argument
498 g_assert(opt.client); in v9fs_tgetattr()
500 g_assert(!opt.expectErr || !opt.rgetattr.attr); in v9fs_tgetattr()
502 if (!opt.request_mask) { in v9fs_tgetattr()
503 opt.request_mask = P9_GETATTR_ALL; in v9fs_tgetattr()
506 req = v9fs_req_init(opt.client, 4 + 8, P9_TGETATTR, opt.tag); in v9fs_tgetattr()
507 v9fs_uint32_write(req, opt.fid); in v9fs_tgetattr()
508 v9fs_uint64_write(req, opt.request_mask); in v9fs_tgetattr()
511 if (!opt.requestOnly) { in v9fs_tgetattr()
513 if (opt.expectErr) { in v9fs_tgetattr()
515 g_assert_cmpint(err, ==, opt.expectErr); in v9fs_tgetattr()
517 v9fs_rgetattr(req, opt.rgetattr.attr); in v9fs_tgetattr()
561 TReadDirRes v9fs_treaddir(TReadDirOpt opt) in v9fs_treaddir() argument
566 g_assert(opt.client); in v9fs_treaddir()
568 g_assert(!opt.expectErr || !(opt.rreaddir.count || in v9fs_treaddir()
569 opt.rreaddir.nentries || opt.rreaddir.entries)); in v9fs_treaddir()
571 req = v9fs_req_init(opt.client, 4 + 8 + 4, P9_TREADDIR, opt.tag); in v9fs_treaddir()
572 v9fs_uint32_write(req, opt.fid); in v9fs_treaddir()
573 v9fs_uint64_write(req, opt.offset); in v9fs_treaddir()
574 v9fs_uint32_write(req, opt.count); in v9fs_treaddir()
577 if (!opt.requestOnly) { in v9fs_treaddir()
579 if (opt.expectErr) { in v9fs_treaddir()
581 g_assert_cmpint(err, ==, opt.expectErr); in v9fs_treaddir()
583 v9fs_rreaddir(req, opt.rreaddir.count, opt.rreaddir.nentries, in v9fs_treaddir()
584 opt.rreaddir.entries); in v9fs_treaddir()
652 TLOpenRes v9fs_tlopen(TLOpenOpt opt) in v9fs_tlopen() argument
657 g_assert(opt.client); in v9fs_tlopen()
659 g_assert(!opt.expectErr || !(opt.rlopen.qid || opt.rlopen.iounit)); in v9fs_tlopen()
661 req = v9fs_req_init(opt.client, 4 + 4, P9_TLOPEN, opt.tag); in v9fs_tlopen()
662 v9fs_uint32_write(req, opt.fid); in v9fs_tlopen()
663 v9fs_uint32_write(req, opt.flags); in v9fs_tlopen()
666 if (!opt.requestOnly) { in v9fs_tlopen()
668 if (opt.expectErr) { in v9fs_tlopen()
670 g_assert_cmpint(err, ==, opt.expectErr); in v9fs_tlopen()
672 v9fs_rlopen(req, opt.rlopen.qid, opt.rlopen.iounit); in v9fs_tlopen()
696 TWriteRes v9fs_twrite(TWriteOpt opt) in v9fs_twrite() argument
703 g_assert(opt.client); in v9fs_twrite()
705 g_assert_cmpint(body_size, <=, UINT32_MAX - opt.count); in v9fs_twrite()
706 body_size += opt.count; in v9fs_twrite()
707 req = v9fs_req_init(opt.client, body_size, P9_TWRITE, opt.tag); in v9fs_twrite()
708 v9fs_uint32_write(req, opt.fid); in v9fs_twrite()
709 v9fs_uint64_write(req, opt.offset); in v9fs_twrite()
710 v9fs_uint32_write(req, opt.count); in v9fs_twrite()
711 v9fs_memwrite(req, opt.data, opt.count); in v9fs_twrite()
714 if (!opt.requestOnly) { in v9fs_twrite()
716 if (opt.expectErr) { in v9fs_twrite()
718 g_assert_cmpint(err, ==, opt.expectErr); in v9fs_twrite()
742 TFlushRes v9fs_tflush(TFlushOpt opt) in v9fs_tflush() argument
747 g_assert(opt.client); in v9fs_tflush()
749 req = v9fs_req_init(opt.client, 2, P9_TFLUSH, opt.tag); in v9fs_tflush()
750 v9fs_uint32_write(req, opt.oldtag); in v9fs_tflush()
753 if (!opt.requestOnly) { in v9fs_tflush()
755 if (opt.expectErr) { in v9fs_tflush()
757 g_assert_cmpint(err, ==, opt.expectErr); in v9fs_tflush()
775 TMkdirRes v9fs_tmkdir(TMkdirOpt opt) in v9fs_tmkdir() argument
780 g_assert(opt.client); in v9fs_tmkdir()
782 g_assert(!opt.atPath || !opt.dfid); in v9fs_tmkdir()
784 g_assert(!opt.expectErr || !opt.rmkdir.qid); in v9fs_tmkdir()
786 if (opt.atPath) { in v9fs_tmkdir()
787 opt.dfid = v9fs_twalk((TWalkOpt) { .client = opt.client, in v9fs_tmkdir()
788 .path = opt.atPath }).newfid; in v9fs_tmkdir()
791 if (!opt.mode) { in v9fs_tmkdir()
792 opt.mode = 0750; in v9fs_tmkdir()
796 uint16_t string_size = v9fs_string_size(opt.name); in v9fs_tmkdir()
801 req = v9fs_req_init(opt.client, body_size, P9_TMKDIR, opt.tag); in v9fs_tmkdir()
802 v9fs_uint32_write(req, opt.dfid); in v9fs_tmkdir()
803 v9fs_string_write(req, opt.name); in v9fs_tmkdir()
804 v9fs_uint32_write(req, opt.mode); in v9fs_tmkdir()
805 v9fs_uint32_write(req, opt.gid); in v9fs_tmkdir()
808 if (!opt.requestOnly) { in v9fs_tmkdir()
810 if (opt.expectErr) { in v9fs_tmkdir()
812 g_assert_cmpint(err, ==, opt.expectErr); in v9fs_tmkdir()
814 v9fs_rmkdir(req, opt.rmkdir.qid); in v9fs_tmkdir()
835 TlcreateRes v9fs_tlcreate(TlcreateOpt opt) in v9fs_tlcreate() argument
840 g_assert(opt.client); in v9fs_tlcreate()
842 g_assert(!opt.atPath || !opt.fid); in v9fs_tlcreate()
844 g_assert(!opt.expectErr || !(opt.rlcreate.qid || opt.rlcreate.iounit)); in v9fs_tlcreate()
846 if (opt.atPath) { in v9fs_tlcreate()
847 opt.fid = v9fs_twalk((TWalkOpt) { .client = opt.client, in v9fs_tlcreate()
848 .path = opt.atPath }).newfid; in v9fs_tlcreate()
851 if (!opt.mode) { in v9fs_tlcreate()
852 opt.mode = 0750; in v9fs_tlcreate()
856 uint16_t string_size = v9fs_string_size(opt.name); in v9fs_tlcreate()
861 req = v9fs_req_init(opt.client, body_size, P9_TLCREATE, opt.tag); in v9fs_tlcreate()
862 v9fs_uint32_write(req, opt.fid); in v9fs_tlcreate()
863 v9fs_string_write(req, opt.name); in v9fs_tlcreate()
864 v9fs_uint32_write(req, opt.flags); in v9fs_tlcreate()
865 v9fs_uint32_write(req, opt.mode); in v9fs_tlcreate()
866 v9fs_uint32_write(req, opt.gid); in v9fs_tlcreate()
869 if (!opt.requestOnly) { in v9fs_tlcreate()
871 if (opt.expectErr) { in v9fs_tlcreate()
873 g_assert_cmpint(err, ==, opt.expectErr); in v9fs_tlcreate()
875 v9fs_rlcreate(req, opt.rlcreate.qid, opt.rlcreate.iounit); in v9fs_tlcreate()
899 TsymlinkRes v9fs_tsymlink(TsymlinkOpt opt) in v9fs_tsymlink() argument
904 g_assert(opt.client); in v9fs_tsymlink()
906 g_assert(!opt.atPath || !opt.fid); in v9fs_tsymlink()
908 g_assert(!opt.expectErr || !opt.rsymlink.qid); in v9fs_tsymlink()
910 if (opt.atPath) { in v9fs_tsymlink()
911 opt.fid = v9fs_twalk((TWalkOpt) { .client = opt.client, in v9fs_tsymlink()
912 .path = opt.atPath }).newfid; in v9fs_tsymlink()
916 uint16_t string_size = v9fs_string_size(opt.name) + in v9fs_tsymlink()
917 v9fs_string_size(opt.symtgt); in v9fs_tsymlink()
922 req = v9fs_req_init(opt.client, body_size, P9_TSYMLINK, opt.tag); in v9fs_tsymlink()
923 v9fs_uint32_write(req, opt.fid); in v9fs_tsymlink()
924 v9fs_string_write(req, opt.name); in v9fs_tsymlink()
925 v9fs_string_write(req, opt.symtgt); in v9fs_tsymlink()
926 v9fs_uint32_write(req, opt.gid); in v9fs_tsymlink()
929 if (!opt.requestOnly) { in v9fs_tsymlink()
931 if (opt.expectErr) { in v9fs_tsymlink()
933 g_assert_cmpint(err, ==, opt.expectErr); in v9fs_tsymlink()
935 v9fs_rsymlink(req, opt.rsymlink.qid); in v9fs_tsymlink()
956 TlinkRes v9fs_tlink(TlinkOpt opt) in v9fs_tlink() argument
961 g_assert(opt.client); in v9fs_tlink()
963 g_assert(!opt.atPath || !opt.dfid); in v9fs_tlink()
965 g_assert(!opt.toPath || !opt.fid); in v9fs_tlink()
967 if (opt.atPath) { in v9fs_tlink()
968 opt.dfid = v9fs_twalk((TWalkOpt) { .client = opt.client, in v9fs_tlink()
969 .path = opt.atPath }).newfid; in v9fs_tlink()
971 if (opt.toPath) { in v9fs_tlink()
972 opt.fid = v9fs_twalk((TWalkOpt) { .client = opt.client, in v9fs_tlink()
973 .path = opt.toPath }).newfid; in v9fs_tlink()
977 uint16_t string_size = v9fs_string_size(opt.name); in v9fs_tlink()
982 req = v9fs_req_init(opt.client, body_size, P9_TLINK, opt.tag); in v9fs_tlink()
983 v9fs_uint32_write(req, opt.dfid); in v9fs_tlink()
984 v9fs_uint32_write(req, opt.fid); in v9fs_tlink()
985 v9fs_string_write(req, opt.name); in v9fs_tlink()
988 if (!opt.requestOnly) { in v9fs_tlink()
990 if (opt.expectErr) { in v9fs_tlink()
992 g_assert_cmpint(err, ==, opt.expectErr); in v9fs_tlink()
1010 TunlinkatRes v9fs_tunlinkat(TunlinkatOpt opt) in v9fs_tunlinkat() argument
1015 g_assert(opt.client); in v9fs_tunlinkat()
1017 g_assert(!opt.atPath || !opt.dirfd); in v9fs_tunlinkat()
1019 if (opt.atPath) { in v9fs_tunlinkat()
1020 opt.dirfd = v9fs_twalk((TWalkOpt) { .client = opt.client, in v9fs_tunlinkat()
1021 .path = opt.atPath }).newfid; in v9fs_tunlinkat()
1025 uint16_t string_size = v9fs_string_size(opt.name); in v9fs_tunlinkat()
1030 req = v9fs_req_init(opt.client, body_size, P9_TUNLINKAT, opt.tag); in v9fs_tunlinkat()
1031 v9fs_uint32_write(req, opt.dirfd); in v9fs_tunlinkat()
1032 v9fs_string_write(req, opt.name); in v9fs_tunlinkat()
1033 v9fs_uint32_write(req, opt.flags); in v9fs_tunlinkat()
1036 if (!opt.requestOnly) { in v9fs_tunlinkat()
1038 if (opt.expectErr) { in v9fs_tunlinkat()
1040 g_assert_cmpint(err, ==, opt.expectErr); in v9fs_tunlinkat()