diff options
Diffstat (limited to 'net/9p/conv.c')
-rw-r--r-- | net/9p/conv.c | 128 |
1 files changed, 127 insertions, 1 deletions
diff --git a/net/9p/conv.c b/net/9p/conv.c index 3fe35d532c8..44547201f5b 100644 --- a/net/9p/conv.c +++ b/net/9p/conv.c | |||
@@ -197,7 +197,7 @@ static void buf_get_qid(struct cbuf *bufp, struct p9_qid *qid) | |||
197 | 197 | ||
198 | /** | 198 | /** |
199 | * p9_size_wstat - calculate the size of a variable length stat struct | 199 | * p9_size_wstat - calculate the size of a variable length stat struct |
200 | * @stat: metadata (stat) structure | 200 | * @wstat: metadata (stat) structure |
201 | * @dotu: non-zero if 9P2000.u | 201 | * @dotu: non-zero if 9P2000.u |
202 | * | 202 | * |
203 | */ | 203 | */ |
@@ -511,6 +511,12 @@ p9_create_common(struct cbuf *bufp, u32 size, u8 id) | |||
511 | return fc; | 511 | return fc; |
512 | } | 512 | } |
513 | 513 | ||
514 | /** | ||
515 | * p9_set_tag - set the tag field of an &p9_fcall structure | ||
516 | * @fc: fcall structure to set tag within | ||
517 | * @tag: tag id to set | ||
518 | */ | ||
519 | |||
514 | void p9_set_tag(struct p9_fcall *fc, u16 tag) | 520 | void p9_set_tag(struct p9_fcall *fc, u16 tag) |
515 | { | 521 | { |
516 | fc->tag = tag; | 522 | fc->tag = tag; |
@@ -518,6 +524,12 @@ void p9_set_tag(struct p9_fcall *fc, u16 tag) | |||
518 | } | 524 | } |
519 | EXPORT_SYMBOL(p9_set_tag); | 525 | EXPORT_SYMBOL(p9_set_tag); |
520 | 526 | ||
527 | /** | ||
528 | * p9_create_tversion - allocates and creates a T_VERSION request | ||
529 | * @msize: requested maximum data size | ||
530 | * @version: version string to negotiate | ||
531 | * | ||
532 | */ | ||
521 | struct p9_fcall *p9_create_tversion(u32 msize, char *version) | 533 | struct p9_fcall *p9_create_tversion(u32 msize, char *version) |
522 | { | 534 | { |
523 | int size; | 535 | int size; |
@@ -542,6 +554,16 @@ error: | |||
542 | } | 554 | } |
543 | EXPORT_SYMBOL(p9_create_tversion); | 555 | EXPORT_SYMBOL(p9_create_tversion); |
544 | 556 | ||
557 | /** | ||
558 | * p9_create_tauth - allocates and creates a T_AUTH request | ||
559 | * @afid: handle to use for authentication protocol | ||
560 | * @uname: user name attempting to authenticate | ||
561 | * @aname: mount specifier for remote server | ||
562 | * @n_uname: numeric id for user attempting to authneticate | ||
563 | * @dotu: 9P2000.u extension flag | ||
564 | * | ||
565 | */ | ||
566 | |||
545 | struct p9_fcall *p9_create_tauth(u32 afid, char *uname, char *aname, | 567 | struct p9_fcall *p9_create_tauth(u32 afid, char *uname, char *aname, |
546 | u32 n_uname, int dotu) | 568 | u32 n_uname, int dotu) |
547 | { | 569 | { |
@@ -580,6 +602,18 @@ error: | |||
580 | } | 602 | } |
581 | EXPORT_SYMBOL(p9_create_tauth); | 603 | EXPORT_SYMBOL(p9_create_tauth); |
582 | 604 | ||
605 | /** | ||
606 | * p9_create_tattach - allocates and creates a T_ATTACH request | ||
607 | * @fid: handle to use for the new mount point | ||
608 | * @afid: handle to use for authentication protocol | ||
609 | * @uname: user name attempting to attach | ||
610 | * @aname: mount specifier for remote server | ||
611 | * @n_uname: numeric id for user attempting to attach | ||
612 | * @n_uname: numeric id for user attempting to attach | ||
613 | * @dotu: 9P2000.u extension flag | ||
614 | * | ||
615 | */ | ||
616 | |||
583 | struct p9_fcall * | 617 | struct p9_fcall * |
584 | p9_create_tattach(u32 fid, u32 afid, char *uname, char *aname, | 618 | p9_create_tattach(u32 fid, u32 afid, char *uname, char *aname, |
585 | u32 n_uname, int dotu) | 619 | u32 n_uname, int dotu) |
@@ -616,6 +650,12 @@ error: | |||
616 | } | 650 | } |
617 | EXPORT_SYMBOL(p9_create_tattach); | 651 | EXPORT_SYMBOL(p9_create_tattach); |
618 | 652 | ||
653 | /** | ||
654 | * p9_create_tflush - allocates and creates a T_FLUSH request | ||
655 | * @oldtag: tag id for the transaction we are attempting to cancel | ||
656 | * | ||
657 | */ | ||
658 | |||
619 | struct p9_fcall *p9_create_tflush(u16 oldtag) | 659 | struct p9_fcall *p9_create_tflush(u16 oldtag) |
620 | { | 660 | { |
621 | int size; | 661 | int size; |
@@ -639,6 +679,15 @@ error: | |||
639 | } | 679 | } |
640 | EXPORT_SYMBOL(p9_create_tflush); | 680 | EXPORT_SYMBOL(p9_create_tflush); |
641 | 681 | ||
682 | /** | ||
683 | * p9_create_twalk - allocates and creates a T_FLUSH request | ||
684 | * @fid: handle we are traversing from | ||
685 | * @newfid: a new handle for this transaction | ||
686 | * @nwname: number of path elements to traverse | ||
687 | * @wnames: array of path elements | ||
688 | * | ||
689 | */ | ||
690 | |||
642 | struct p9_fcall *p9_create_twalk(u32 fid, u32 newfid, u16 nwname, | 691 | struct p9_fcall *p9_create_twalk(u32 fid, u32 newfid, u16 nwname, |
643 | char **wnames) | 692 | char **wnames) |
644 | { | 693 | { |
@@ -677,6 +726,13 @@ error: | |||
677 | } | 726 | } |
678 | EXPORT_SYMBOL(p9_create_twalk); | 727 | EXPORT_SYMBOL(p9_create_twalk); |
679 | 728 | ||
729 | /** | ||
730 | * p9_create_topen - allocates and creates a T_OPEN request | ||
731 | * @fid: handle we are trying to open | ||
732 | * @mode: what mode we are trying to open the file in | ||
733 | * | ||
734 | */ | ||
735 | |||
680 | struct p9_fcall *p9_create_topen(u32 fid, u8 mode) | 736 | struct p9_fcall *p9_create_topen(u32 fid, u8 mode) |
681 | { | 737 | { |
682 | int size; | 738 | int size; |
@@ -701,6 +757,19 @@ error: | |||
701 | } | 757 | } |
702 | EXPORT_SYMBOL(p9_create_topen); | 758 | EXPORT_SYMBOL(p9_create_topen); |
703 | 759 | ||
760 | /** | ||
761 | * p9_create_tcreate - allocates and creates a T_CREATE request | ||
762 | * @fid: handle of directory we are trying to create in | ||
763 | * @name: name of the file we are trying to create | ||
764 | * @perm: permissions for the file we are trying to create | ||
765 | * @mode: what mode we are trying to open the file in | ||
766 | * @extension: 9p2000.u extension string (for special files) | ||
767 | * @dotu: 9p2000.u enabled flag | ||
768 | * | ||
769 | * Note: Plan 9 create semantics include opening the resulting file | ||
770 | * which is why mode is included. | ||
771 | */ | ||
772 | |||
704 | struct p9_fcall *p9_create_tcreate(u32 fid, char *name, u32 perm, u8 mode, | 773 | struct p9_fcall *p9_create_tcreate(u32 fid, char *name, u32 perm, u8 mode, |
705 | char *extension, int dotu) | 774 | char *extension, int dotu) |
706 | { | 775 | { |
@@ -736,6 +805,13 @@ error: | |||
736 | } | 805 | } |
737 | EXPORT_SYMBOL(p9_create_tcreate); | 806 | EXPORT_SYMBOL(p9_create_tcreate); |
738 | 807 | ||
808 | /** | ||
809 | * p9_create_tread - allocates and creates a T_READ request | ||
810 | * @fid: handle of the file we are trying to read | ||
811 | * @offset: offset to start reading from | ||
812 | * @count: how many bytes to read | ||
813 | */ | ||
814 | |||
739 | struct p9_fcall *p9_create_tread(u32 fid, u64 offset, u32 count) | 815 | struct p9_fcall *p9_create_tread(u32 fid, u64 offset, u32 count) |
740 | { | 816 | { |
741 | int size; | 817 | int size; |
@@ -761,6 +837,17 @@ error: | |||
761 | } | 837 | } |
762 | EXPORT_SYMBOL(p9_create_tread); | 838 | EXPORT_SYMBOL(p9_create_tread); |
763 | 839 | ||
840 | /** | ||
841 | * p9_create_twrite - allocates and creates a T_WRITE request from the kernel | ||
842 | * @fid: handle of the file we are trying to write | ||
843 | * @offset: offset to start writing at | ||
844 | * @count: how many bytes to write | ||
845 | * @data: data to write | ||
846 | * | ||
847 | * This function will create a requst with data buffers from the kernel | ||
848 | * such as the page cache. | ||
849 | */ | ||
850 | |||
764 | struct p9_fcall *p9_create_twrite(u32 fid, u64 offset, u32 count, | 851 | struct p9_fcall *p9_create_twrite(u32 fid, u64 offset, u32 count, |
765 | const char *data) | 852 | const char *data) |
766 | { | 853 | { |
@@ -794,6 +881,16 @@ error: | |||
794 | } | 881 | } |
795 | EXPORT_SYMBOL(p9_create_twrite); | 882 | EXPORT_SYMBOL(p9_create_twrite); |
796 | 883 | ||
884 | /** | ||
885 | * p9_create_twrite_u - allocates and creates a T_WRITE request from userspace | ||
886 | * @fid: handle of the file we are trying to write | ||
887 | * @offset: offset to start writing at | ||
888 | * @count: how many bytes to write | ||
889 | * @data: data to write | ||
890 | * | ||
891 | * This function will create a request with data buffers from userspace | ||
892 | */ | ||
893 | |||
797 | struct p9_fcall *p9_create_twrite_u(u32 fid, u64 offset, u32 count, | 894 | struct p9_fcall *p9_create_twrite_u(u32 fid, u64 offset, u32 count, |
798 | const char __user *data) | 895 | const char __user *data) |
799 | { | 896 | { |
@@ -827,6 +924,14 @@ error: | |||
827 | } | 924 | } |
828 | EXPORT_SYMBOL(p9_create_twrite_u); | 925 | EXPORT_SYMBOL(p9_create_twrite_u); |
829 | 926 | ||
927 | /** | ||
928 | * p9_create_tclunk - allocate a request to forget about a file handle | ||
929 | * @fid: handle of the file we closing or forgetting about | ||
930 | * | ||
931 | * clunk is used both to close open files and to discard transient handles | ||
932 | * which may be created during meta-data operations and hierarchy traversal. | ||
933 | */ | ||
934 | |||
830 | struct p9_fcall *p9_create_tclunk(u32 fid) | 935 | struct p9_fcall *p9_create_tclunk(u32 fid) |
831 | { | 936 | { |
832 | int size; | 937 | int size; |
@@ -850,6 +955,12 @@ error: | |||
850 | } | 955 | } |
851 | EXPORT_SYMBOL(p9_create_tclunk); | 956 | EXPORT_SYMBOL(p9_create_tclunk); |
852 | 957 | ||
958 | /** | ||
959 | * p9_create_tremove - allocate and create a request to remove a file | ||
960 | * @fid: handle of the file or directory we are removing | ||
961 | * | ||
962 | */ | ||
963 | |||
853 | struct p9_fcall *p9_create_tremove(u32 fid) | 964 | struct p9_fcall *p9_create_tremove(u32 fid) |
854 | { | 965 | { |
855 | int size; | 966 | int size; |
@@ -873,6 +984,12 @@ error: | |||
873 | } | 984 | } |
874 | EXPORT_SYMBOL(p9_create_tremove); | 985 | EXPORT_SYMBOL(p9_create_tremove); |
875 | 986 | ||
987 | /** | ||
988 | * p9_create_tstat - allocate and populate a request for attributes | ||
989 | * @fid: handle of the file or directory we are trying to get the attributes of | ||
990 | * | ||
991 | */ | ||
992 | |||
876 | struct p9_fcall *p9_create_tstat(u32 fid) | 993 | struct p9_fcall *p9_create_tstat(u32 fid) |
877 | { | 994 | { |
878 | int size; | 995 | int size; |
@@ -896,6 +1013,14 @@ error: | |||
896 | } | 1013 | } |
897 | EXPORT_SYMBOL(p9_create_tstat); | 1014 | EXPORT_SYMBOL(p9_create_tstat); |
898 | 1015 | ||
1016 | /** | ||
1017 | * p9_create_tstat - allocate and populate a request to change attributes | ||
1018 | * @fid: handle of the file or directory we are trying to change | ||
1019 | * @wstat: &p9_stat structure with attributes we wish to set | ||
1020 | * @dotu: 9p2000.u enabled flag | ||
1021 | * | ||
1022 | */ | ||
1023 | |||
899 | struct p9_fcall *p9_create_twstat(u32 fid, struct p9_wstat *wstat, | 1024 | struct p9_fcall *p9_create_twstat(u32 fid, struct p9_wstat *wstat, |
900 | int dotu) | 1025 | int dotu) |
901 | { | 1026 | { |
@@ -922,3 +1047,4 @@ error: | |||
922 | return fc; | 1047 | return fc; |
923 | } | 1048 | } |
924 | EXPORT_SYMBOL(p9_create_twstat); | 1049 | EXPORT_SYMBOL(p9_create_twstat); |
1050 | |||