fsclient.c (781070551c26def14784ce5ca14194d7ca234b04) | fsclient.c (87182759cd6f94875d6aaaac74eaa52aa6aa6f98) |
---|---|
1/* AFS File Server client stubs 2 * 3 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved. 4 * Written by David Howells (dhowells@redhat.com) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version --- 378 unchanged lines hidden (view full) --- 387 *_bp = bp; 388} 389 390/* 391 * deliver reply data to an FS.FetchStatus 392 */ 393static int afs_deliver_fs_fetch_status_vnode(struct afs_call *call) 394{ | 1/* AFS File Server client stubs 2 * 3 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved. 4 * Written by David Howells (dhowells@redhat.com) 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License 8 * as published by the Free Software Foundation; either version --- 378 unchanged lines hidden (view full) --- 387 *_bp = bp; 388} 389 390/* 391 * deliver reply data to an FS.FetchStatus 392 */ 393static int afs_deliver_fs_fetch_status_vnode(struct afs_call *call) 394{ |
395 struct afs_vnode *vnode = call->reply[0]; | 395 struct afs_vnode *vnode = call->xvnode; |
396 const __be32 *bp; 397 int ret; 398 399 ret = afs_transfer_reply(call); 400 if (ret < 0) 401 return ret; 402 403 _enter("{%llx:%llu}", vnode->fid.vid, vnode->fid.vnode); 404 405 /* unmarshall the reply once we've received all of it */ 406 bp = call->buffer; 407 ret = afs_decode_status(call, &bp, &vnode->status, vnode, 408 &call->expected_version, NULL); 409 if (ret < 0) 410 return ret; 411 xdr_decode_AFSCallBack(call, vnode, &bp); | 396 const __be32 *bp; 397 int ret; 398 399 ret = afs_transfer_reply(call); 400 if (ret < 0) 401 return ret; 402 403 _enter("{%llx:%llu}", vnode->fid.vid, vnode->fid.vnode); 404 405 /* unmarshall the reply once we've received all of it */ 406 bp = call->buffer; 407 ret = afs_decode_status(call, &bp, &vnode->status, vnode, 408 &call->expected_version, NULL); 409 if (ret < 0) 410 return ret; 411 xdr_decode_AFSCallBack(call, vnode, &bp); |
412 xdr_decode_AFSVolSync(&bp, call->reply[1]); | 412 xdr_decode_AFSVolSync(&bp, call->out_volsync); |
413 414 _leave(" = 0 [done]"); 415 return 0; 416} 417 418/* 419 * FS.FetchStatus operation type 420 */ --- 24 unchanged lines hidden (view full) --- 445 call = afs_alloc_flat_call(net, &afs_RXFSFetchStatus_vnode, 446 16, (21 + 3 + 6) * 4); 447 if (!call) { 448 fc->ac.error = -ENOMEM; 449 return -ENOMEM; 450 } 451 452 call->key = fc->key; | 413 414 _leave(" = 0 [done]"); 415 return 0; 416} 417 418/* 419 * FS.FetchStatus operation type 420 */ --- 24 unchanged lines hidden (view full) --- 445 call = afs_alloc_flat_call(net, &afs_RXFSFetchStatus_vnode, 446 16, (21 + 3 + 6) * 4); 447 if (!call) { 448 fc->ac.error = -ENOMEM; 449 return -ENOMEM; 450 } 451 452 call->key = fc->key; |
453 call->reply[0] = vnode; 454 call->reply[1] = volsync; | 453 call->xvnode = vnode; 454 call->out_volsync = volsync; |
455 call->expected_version = new_inode ? 1 : vnode->status.data_version; 456 call->want_reply_time = true; 457 458 /* marshall the parameters */ 459 bp = call->request; 460 bp[0] = htonl(FSFETCHSTATUS); 461 bp[1] = htonl(vnode->fid.vid); 462 bp[2] = htonl(vnode->fid.vnode); --- 8 unchanged lines hidden (view full) --- 471 return afs_wait_for_call_to_complete(call, &fc->ac); 472} 473 474/* 475 * deliver reply data to an FS.FetchData 476 */ 477static int afs_deliver_fs_fetch_data(struct afs_call *call) 478{ | 455 call->expected_version = new_inode ? 1 : vnode->status.data_version; 456 call->want_reply_time = true; 457 458 /* marshall the parameters */ 459 bp = call->request; 460 bp[0] = htonl(FSFETCHSTATUS); 461 bp[1] = htonl(vnode->fid.vid); 462 bp[2] = htonl(vnode->fid.vnode); --- 8 unchanged lines hidden (view full) --- 471 return afs_wait_for_call_to_complete(call, &fc->ac); 472} 473 474/* 475 * deliver reply data to an FS.FetchData 476 */ 477static int afs_deliver_fs_fetch_data(struct afs_call *call) 478{ |
479 struct afs_vnode *vnode = call->reply[0]; 480 struct afs_read *req = call->reply[2]; | 479 struct afs_vnode *vnode = call->xvnode; 480 struct afs_read *req = call->read_request; |
481 const __be32 *bp; 482 unsigned int size; 483 int ret; 484 485 _enter("{%u,%zu/%llu}", 486 call->unmarshall, iov_iter_count(&call->iter), req->actual_len); 487 488 switch (call->unmarshall) { --- 84 unchanged lines hidden (view full) --- 573 return ret; 574 575 bp = call->buffer; 576 ret = afs_decode_status(call, &bp, &vnode->status, vnode, 577 &vnode->status.data_version, req); 578 if (ret < 0) 579 return ret; 580 xdr_decode_AFSCallBack(call, vnode, &bp); | 481 const __be32 *bp; 482 unsigned int size; 483 int ret; 484 485 _enter("{%u,%zu/%llu}", 486 call->unmarshall, iov_iter_count(&call->iter), req->actual_len); 487 488 switch (call->unmarshall) { --- 84 unchanged lines hidden (view full) --- 573 return ret; 574 575 bp = call->buffer; 576 ret = afs_decode_status(call, &bp, &vnode->status, vnode, 577 &vnode->status.data_version, req); 578 if (ret < 0) 579 return ret; 580 xdr_decode_AFSCallBack(call, vnode, &bp); |
581 xdr_decode_AFSVolSync(&bp, call->reply[1]); | 581 xdr_decode_AFSVolSync(&bp, call->out_volsync); |
582 583 call->unmarshall++; 584 585 case 5: 586 break; 587 } 588 589 for (; req->index < req->nr_pages; req->index++) { --- 6 unchanged lines hidden (view full) --- 596 } 597 598 _leave(" = 0 [done]"); 599 return 0; 600} 601 602static void afs_fetch_data_destructor(struct afs_call *call) 603{ | 582 583 call->unmarshall++; 584 585 case 5: 586 break; 587 } 588 589 for (; req->index < req->nr_pages; req->index++) { --- 6 unchanged lines hidden (view full) --- 596 } 597 598 _leave(" = 0 [done]"); 599 return 0; 600} 601 602static void afs_fetch_data_destructor(struct afs_call *call) 603{ |
604 struct afs_read *req = call->reply[2]; | 604 struct afs_read *req = call->read_request; |
605 606 afs_put_read(req); 607 afs_flat_call_destructor(call); 608} 609 610/* 611 * FS.FetchData operation type 612 */ --- 23 unchanged lines hidden (view full) --- 636 637 _enter(""); 638 639 call = afs_alloc_flat_call(net, &afs_RXFSFetchData64, 32, (21 + 3 + 6) * 4); 640 if (!call) 641 return -ENOMEM; 642 643 call->key = fc->key; | 605 606 afs_put_read(req); 607 afs_flat_call_destructor(call); 608} 609 610/* 611 * FS.FetchData operation type 612 */ --- 23 unchanged lines hidden (view full) --- 636 637 _enter(""); 638 639 call = afs_alloc_flat_call(net, &afs_RXFSFetchData64, 32, (21 + 3 + 6) * 4); 640 if (!call) 641 return -ENOMEM; 642 643 call->key = fc->key; |
644 call->reply[0] = vnode; 645 call->reply[1] = NULL; /* volsync */ 646 call->reply[2] = req; | 644 call->xvnode = vnode; 645 call->out_volsync = NULL; 646 call->read_request = req; |
647 call->expected_version = vnode->status.data_version; 648 call->want_reply_time = true; 649 650 /* marshall the parameters */ 651 bp = call->request; 652 bp[0] = htonl(FSFETCHDATA64); 653 bp[1] = htonl(vnode->fid.vid); 654 bp[2] = htonl(vnode->fid.vnode); --- 32 unchanged lines hidden (view full) --- 687 688 _enter(""); 689 690 call = afs_alloc_flat_call(net, &afs_RXFSFetchData, 24, (21 + 3 + 6) * 4); 691 if (!call) 692 return -ENOMEM; 693 694 call->key = fc->key; | 647 call->expected_version = vnode->status.data_version; 648 call->want_reply_time = true; 649 650 /* marshall the parameters */ 651 bp = call->request; 652 bp[0] = htonl(FSFETCHDATA64); 653 bp[1] = htonl(vnode->fid.vid); 654 bp[2] = htonl(vnode->fid.vnode); --- 32 unchanged lines hidden (view full) --- 687 688 _enter(""); 689 690 call = afs_alloc_flat_call(net, &afs_RXFSFetchData, 24, (21 + 3 + 6) * 4); 691 if (!call) 692 return -ENOMEM; 693 694 call->key = fc->key; |
695 call->reply[0] = vnode; 696 call->reply[1] = NULL; /* volsync */ 697 call->reply[2] = req; | 695 call->xvnode = vnode; 696 call->out_volsync = NULL; 697 call->read_request = req; |
698 call->expected_version = vnode->status.data_version; 699 call->want_reply_time = true; 700 701 /* marshall the parameters */ 702 bp = call->request; 703 bp[0] = htonl(FSFETCHDATA); 704 bp[1] = htonl(vnode->fid.vid); 705 bp[2] = htonl(vnode->fid.vnode); --- 10 unchanged lines hidden (view full) --- 716 return afs_wait_for_call_to_complete(call, &fc->ac); 717} 718 719/* 720 * deliver reply data to an FS.CreateFile or an FS.MakeDir 721 */ 722static int afs_deliver_fs_create_vnode(struct afs_call *call) 723{ | 698 call->expected_version = vnode->status.data_version; 699 call->want_reply_time = true; 700 701 /* marshall the parameters */ 702 bp = call->request; 703 bp[0] = htonl(FSFETCHDATA); 704 bp[1] = htonl(vnode->fid.vid); 705 bp[2] = htonl(vnode->fid.vnode); --- 10 unchanged lines hidden (view full) --- 716 return afs_wait_for_call_to_complete(call, &fc->ac); 717} 718 719/* 720 * deliver reply data to an FS.CreateFile or an FS.MakeDir 721 */ 722static int afs_deliver_fs_create_vnode(struct afs_call *call) 723{ |
724 struct afs_vnode *vnode = call->reply[0]; | 724 struct afs_vnode *dvnode = call->dvnode; |
725 const __be32 *bp; 726 int ret; 727 728 _enter("{%u}", call->unmarshall); 729 730 ret = afs_transfer_reply(call); 731 if (ret < 0) 732 return ret; 733 734 /* unmarshall the reply once we've received all of it */ 735 bp = call->buffer; | 725 const __be32 *bp; 726 int ret; 727 728 _enter("{%u}", call->unmarshall); 729 730 ret = afs_transfer_reply(call); 731 if (ret < 0) 732 return ret; 733 734 /* unmarshall the reply once we've received all of it */ 735 bp = call->buffer; |
736 xdr_decode_AFSFid(&bp, call->reply[1]); 737 ret = afs_decode_status(call, &bp, call->reply[2], NULL, NULL, NULL); | 736 xdr_decode_AFSFid(&bp, call->out_fid); 737 ret = afs_decode_status(call, &bp, call->out_extra_status, NULL, NULL, NULL); |
738 if (ret < 0) 739 return ret; | 738 if (ret < 0) 739 return ret; |
740 ret = afs_decode_status(call, &bp, &vnode->status, vnode, | 740 ret = afs_decode_status(call, &bp, &dvnode->status, dvnode, |
741 &call->expected_version, NULL); 742 if (ret < 0) 743 return ret; | 741 &call->expected_version, NULL); 742 if (ret < 0) 743 return ret; |
744 xdr_decode_AFSCallBack_raw(call, call->reply[3], &bp); 745 /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */ | 744 xdr_decode_AFSCallBack_raw(call, call->out_cb, &bp); 745 xdr_decode_AFSVolSync(&bp, call->out_volsync); |
746 747 _leave(" = 0 [done]"); 748 return 0; 749} 750 751/* 752 * FS.CreateFile and FS.MakeDir operation type 753 */ --- 17 unchanged lines hidden (view full) --- 771int afs_fs_create(struct afs_fs_cursor *fc, 772 const char *name, 773 umode_t mode, 774 u64 current_data_version, 775 struct afs_fid *newfid, 776 struct afs_file_status *newstatus, 777 struct afs_callback *newcb) 778{ | 746 747 _leave(" = 0 [done]"); 748 return 0; 749} 750 751/* 752 * FS.CreateFile and FS.MakeDir operation type 753 */ --- 17 unchanged lines hidden (view full) --- 771int afs_fs_create(struct afs_fs_cursor *fc, 772 const char *name, 773 umode_t mode, 774 u64 current_data_version, 775 struct afs_fid *newfid, 776 struct afs_file_status *newstatus, 777 struct afs_callback *newcb) 778{ |
779 struct afs_vnode *vnode = fc->vnode; | 779 struct afs_vnode *dvnode = fc->vnode; |
780 struct afs_call *call; | 780 struct afs_call *call; |
781 struct afs_net *net = afs_v2net(vnode); | 781 struct afs_net *net = afs_v2net(dvnode); |
782 size_t namesz, reqsz, padsz; 783 __be32 *bp; 784 785 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags)){ 786 if (S_ISDIR(mode)) 787 return yfs_fs_make_dir(fc, name, mode, current_data_version, 788 newfid, newstatus, newcb); 789 else --- 9 unchanged lines hidden (view full) --- 799 800 call = afs_alloc_flat_call( 801 net, S_ISDIR(mode) ? &afs_RXFSMakeDir : &afs_RXFSCreateFile, 802 reqsz, (3 + 21 + 21 + 3 + 6) * 4); 803 if (!call) 804 return -ENOMEM; 805 806 call->key = fc->key; | 782 size_t namesz, reqsz, padsz; 783 __be32 *bp; 784 785 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags)){ 786 if (S_ISDIR(mode)) 787 return yfs_fs_make_dir(fc, name, mode, current_data_version, 788 newfid, newstatus, newcb); 789 else --- 9 unchanged lines hidden (view full) --- 799 800 call = afs_alloc_flat_call( 801 net, S_ISDIR(mode) ? &afs_RXFSMakeDir : &afs_RXFSCreateFile, 802 reqsz, (3 + 21 + 21 + 3 + 6) * 4); 803 if (!call) 804 return -ENOMEM; 805 806 call->key = fc->key; |
807 call->reply[0] = vnode; 808 call->reply[1] = newfid; 809 call->reply[2] = newstatus; 810 call->reply[3] = newcb; | 807 call->dvnode = dvnode; 808 call->out_fid = newfid; 809 call->out_extra_status = newstatus; 810 call->out_cb = newcb; |
811 call->expected_version = current_data_version + 1; 812 call->want_reply_time = true; 813 814 /* marshall the parameters */ 815 bp = call->request; 816 *bp++ = htonl(S_ISDIR(mode) ? FSMAKEDIR : FSCREATEFILE); | 811 call->expected_version = current_data_version + 1; 812 call->want_reply_time = true; 813 814 /* marshall the parameters */ 815 bp = call->request; 816 *bp++ = htonl(S_ISDIR(mode) ? FSMAKEDIR : FSCREATEFILE); |
817 *bp++ = htonl(vnode->fid.vid); 818 *bp++ = htonl(vnode->fid.vnode); 819 *bp++ = htonl(vnode->fid.unique); | 817 *bp++ = htonl(dvnode->fid.vid); 818 *bp++ = htonl(dvnode->fid.vnode); 819 *bp++ = htonl(dvnode->fid.unique); |
820 *bp++ = htonl(namesz); 821 memcpy(bp, name, namesz); 822 bp = (void *) bp + namesz; 823 if (padsz > 0) { 824 memset(bp, 0, padsz); 825 bp = (void *) bp + padsz; 826 } 827 *bp++ = htonl(AFS_SET_MODE | AFS_SET_MTIME); | 820 *bp++ = htonl(namesz); 821 memcpy(bp, name, namesz); 822 bp = (void *) bp + namesz; 823 if (padsz > 0) { 824 memset(bp, 0, padsz); 825 bp = (void *) bp + padsz; 826 } 827 *bp++ = htonl(AFS_SET_MODE | AFS_SET_MTIME); |
828 *bp++ = htonl(vnode->vfs_inode.i_mtime.tv_sec); /* mtime */ | 828 *bp++ = htonl(dvnode->vfs_inode.i_mtime.tv_sec); /* mtime */ |
829 *bp++ = 0; /* owner */ 830 *bp++ = 0; /* group */ 831 *bp++ = htonl(mode & S_IALLUGO); /* unix mode */ 832 *bp++ = 0; /* segment size */ 833 834 afs_use_fs_server(call, fc->cbi); | 829 *bp++ = 0; /* owner */ 830 *bp++ = 0; /* group */ 831 *bp++ = htonl(mode & S_IALLUGO); /* unix mode */ 832 *bp++ = 0; /* segment size */ 833 834 afs_use_fs_server(call, fc->cbi); |
835 trace_afs_make_fs_call1(call, &vnode->fid, name); | 835 trace_afs_make_fs_call1(call, &dvnode->fid, name); |
836 afs_set_fc_call(call, fc); 837 afs_make_call(&fc->ac, call, GFP_NOFS); 838 return afs_wait_for_call_to_complete(call, &fc->ac); 839} 840 841/* | 836 afs_set_fc_call(call, fc); 837 afs_make_call(&fc->ac, call, GFP_NOFS); 838 return afs_wait_for_call_to_complete(call, &fc->ac); 839} 840 841/* |
842 * Deliver reply data to any operation that returns file status and volume | 842 * Deliver reply data to any operation that returns directory status and volume |
843 * sync. 844 */ | 843 * sync. 844 */ |
845static int afs_deliver_fs_status_and_vol(struct afs_call *call) | 845static int afs_deliver_fs_dir_status_and_vol(struct afs_call *call) |
846{ | 846{ |
847 struct afs_vnode *vnode = call->reply[0]; | 847 struct afs_vnode *dvnode = call->dvnode; |
848 const __be32 *bp; 849 int ret; 850 851 _enter("{%u}", call->unmarshall); 852 853 ret = afs_transfer_reply(call); 854 if (ret < 0) 855 return ret; 856 857 /* unmarshall the reply once we've received all of it */ 858 bp = call->buffer; | 848 const __be32 *bp; 849 int ret; 850 851 _enter("{%u}", call->unmarshall); 852 853 ret = afs_transfer_reply(call); 854 if (ret < 0) 855 return ret; 856 857 /* unmarshall the reply once we've received all of it */ 858 bp = call->buffer; |
859 ret = afs_decode_status(call, &bp, &vnode->status, vnode, | 859 ret = afs_decode_status(call, &bp, &dvnode->status, dvnode, |
860 &call->expected_version, NULL); 861 if (ret < 0) 862 return ret; | 860 &call->expected_version, NULL); 861 if (ret < 0) 862 return ret; |
863 /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */ | 863 xdr_decode_AFSVolSync(&bp, call->out_volsync); |
864 865 _leave(" = 0 [done]"); 866 return 0; 867} 868 869/* 870 * FS.RemoveDir/FS.RemoveFile operation type 871 */ 872static const struct afs_call_type afs_RXFSRemoveFile = { 873 .name = "FS.RemoveFile", 874 .op = afs_FS_RemoveFile, | 864 865 _leave(" = 0 [done]"); 866 return 0; 867} 868 869/* 870 * FS.RemoveDir/FS.RemoveFile operation type 871 */ 872static const struct afs_call_type afs_RXFSRemoveFile = { 873 .name = "FS.RemoveFile", 874 .op = afs_FS_RemoveFile, |
875 .deliver = afs_deliver_fs_status_and_vol, | 875 .deliver = afs_deliver_fs_dir_status_and_vol, |
876 .destructor = afs_flat_call_destructor, 877}; 878 879static const struct afs_call_type afs_RXFSRemoveDir = { 880 .name = "FS.RemoveDir", 881 .op = afs_FS_RemoveDir, | 876 .destructor = afs_flat_call_destructor, 877}; 878 879static const struct afs_call_type afs_RXFSRemoveDir = { 880 .name = "FS.RemoveDir", 881 .op = afs_FS_RemoveDir, |
882 .deliver = afs_deliver_fs_status_and_vol, | 882 .deliver = afs_deliver_fs_dir_status_and_vol, |
883 .destructor = afs_flat_call_destructor, 884}; 885 886/* 887 * remove a file or directory 888 */ 889int afs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode, 890 const char *name, bool isdir, u64 current_data_version) --- 15 unchanged lines hidden (view full) --- 906 907 call = afs_alloc_flat_call( 908 net, isdir ? &afs_RXFSRemoveDir : &afs_RXFSRemoveFile, 909 reqsz, (21 + 6) * 4); 910 if (!call) 911 return -ENOMEM; 912 913 call->key = fc->key; | 883 .destructor = afs_flat_call_destructor, 884}; 885 886/* 887 * remove a file or directory 888 */ 889int afs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode, 890 const char *name, bool isdir, u64 current_data_version) --- 15 unchanged lines hidden (view full) --- 906 907 call = afs_alloc_flat_call( 908 net, isdir ? &afs_RXFSRemoveDir : &afs_RXFSRemoveFile, 909 reqsz, (21 + 6) * 4); 910 if (!call) 911 return -ENOMEM; 912 913 call->key = fc->key; |
914 call->reply[0] = dvnode; 915 call->reply[1] = vnode; | 914 call->dvnode = dvnode; 915 call->xvnode = vnode; |
916 call->expected_version = current_data_version + 1; 917 918 /* marshall the parameters */ 919 bp = call->request; 920 *bp++ = htonl(isdir ? FSREMOVEDIR : FSREMOVEFILE); 921 *bp++ = htonl(dvnode->fid.vid); 922 *bp++ = htonl(dvnode->fid.vnode); 923 *bp++ = htonl(dvnode->fid.unique); --- 12 unchanged lines hidden (view full) --- 936 return afs_wait_for_call_to_complete(call, &fc->ac); 937} 938 939/* 940 * deliver reply data to an FS.Link 941 */ 942static int afs_deliver_fs_link(struct afs_call *call) 943{ | 916 call->expected_version = current_data_version + 1; 917 918 /* marshall the parameters */ 919 bp = call->request; 920 *bp++ = htonl(isdir ? FSREMOVEDIR : FSREMOVEFILE); 921 *bp++ = htonl(dvnode->fid.vid); 922 *bp++ = htonl(dvnode->fid.vnode); 923 *bp++ = htonl(dvnode->fid.unique); --- 12 unchanged lines hidden (view full) --- 936 return afs_wait_for_call_to_complete(call, &fc->ac); 937} 938 939/* 940 * deliver reply data to an FS.Link 941 */ 942static int afs_deliver_fs_link(struct afs_call *call) 943{ |
944 struct afs_vnode *dvnode = call->reply[0], *vnode = call->reply[1]; | 944 struct afs_vnode *dvnode = call->dvnode, *vnode = call->xvnode; |
945 const __be32 *bp; 946 int ret; 947 948 _enter("{%u}", call->unmarshall); 949 950 ret = afs_transfer_reply(call); 951 if (ret < 0) 952 return ret; 953 954 /* unmarshall the reply once we've received all of it */ 955 bp = call->buffer; 956 ret = afs_decode_status(call, &bp, &vnode->status, vnode, NULL, NULL); 957 if (ret < 0) 958 return ret; 959 ret = afs_decode_status(call, &bp, &dvnode->status, dvnode, 960 &call->expected_version, NULL); 961 if (ret < 0) 962 return ret; | 945 const __be32 *bp; 946 int ret; 947 948 _enter("{%u}", call->unmarshall); 949 950 ret = afs_transfer_reply(call); 951 if (ret < 0) 952 return ret; 953 954 /* unmarshall the reply once we've received all of it */ 955 bp = call->buffer; 956 ret = afs_decode_status(call, &bp, &vnode->status, vnode, NULL, NULL); 957 if (ret < 0) 958 return ret; 959 ret = afs_decode_status(call, &bp, &dvnode->status, dvnode, 960 &call->expected_version, NULL); 961 if (ret < 0) 962 return ret; |
963 /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */ | 963 xdr_decode_AFSVolSync(&bp, call->out_volsync); |
964 965 _leave(" = 0 [done]"); 966 return 0; 967} 968 969/* 970 * FS.Link operation type 971 */ --- 25 unchanged lines hidden (view full) --- 997 padsz = (4 - (namesz & 3)) & 3; 998 reqsz = (5 * 4) + namesz + padsz + (3 * 4); 999 1000 call = afs_alloc_flat_call(net, &afs_RXFSLink, reqsz, (21 + 21 + 6) * 4); 1001 if (!call) 1002 return -ENOMEM; 1003 1004 call->key = fc->key; | 964 965 _leave(" = 0 [done]"); 966 return 0; 967} 968 969/* 970 * FS.Link operation type 971 */ --- 25 unchanged lines hidden (view full) --- 997 padsz = (4 - (namesz & 3)) & 3; 998 reqsz = (5 * 4) + namesz + padsz + (3 * 4); 999 1000 call = afs_alloc_flat_call(net, &afs_RXFSLink, reqsz, (21 + 21 + 6) * 4); 1001 if (!call) 1002 return -ENOMEM; 1003 1004 call->key = fc->key; |
1005 call->reply[0] = dvnode; 1006 call->reply[1] = vnode; | 1005 call->dvnode = dvnode; 1006 call->xvnode = vnode; |
1007 call->expected_version = current_data_version + 1; 1008 1009 /* marshall the parameters */ 1010 bp = call->request; 1011 *bp++ = htonl(FSLINK); 1012 *bp++ = htonl(dvnode->fid.vid); 1013 *bp++ = htonl(dvnode->fid.vnode); 1014 *bp++ = htonl(dvnode->fid.unique); --- 15 unchanged lines hidden (view full) --- 1030 return afs_wait_for_call_to_complete(call, &fc->ac); 1031} 1032 1033/* 1034 * deliver reply data to an FS.Symlink 1035 */ 1036static int afs_deliver_fs_symlink(struct afs_call *call) 1037{ | 1007 call->expected_version = current_data_version + 1; 1008 1009 /* marshall the parameters */ 1010 bp = call->request; 1011 *bp++ = htonl(FSLINK); 1012 *bp++ = htonl(dvnode->fid.vid); 1013 *bp++ = htonl(dvnode->fid.vnode); 1014 *bp++ = htonl(dvnode->fid.unique); --- 15 unchanged lines hidden (view full) --- 1030 return afs_wait_for_call_to_complete(call, &fc->ac); 1031} 1032 1033/* 1034 * deliver reply data to an FS.Symlink 1035 */ 1036static int afs_deliver_fs_symlink(struct afs_call *call) 1037{ |
1038 struct afs_vnode *vnode = call->reply[0]; | 1038 struct afs_vnode *dvnode = call->dvnode; |
1039 const __be32 *bp; 1040 int ret; 1041 1042 _enter("{%u}", call->unmarshall); 1043 1044 ret = afs_transfer_reply(call); 1045 if (ret < 0) 1046 return ret; 1047 1048 /* unmarshall the reply once we've received all of it */ 1049 bp = call->buffer; | 1039 const __be32 *bp; 1040 int ret; 1041 1042 _enter("{%u}", call->unmarshall); 1043 1044 ret = afs_transfer_reply(call); 1045 if (ret < 0) 1046 return ret; 1047 1048 /* unmarshall the reply once we've received all of it */ 1049 bp = call->buffer; |
1050 xdr_decode_AFSFid(&bp, call->reply[1]); 1051 ret = afs_decode_status(call, &bp, call->reply[2], NULL, NULL, NULL); | 1050 xdr_decode_AFSFid(&bp, call->out_fid); 1051 ret = afs_decode_status(call, &bp, call->out_extra_status, NULL, NULL, NULL); |
1052 if (ret < 0) 1053 return ret; | 1052 if (ret < 0) 1053 return ret; |
1054 ret = afs_decode_status(call, &bp, &vnode->status, vnode, | 1054 ret = afs_decode_status(call, &bp, &dvnode->status, dvnode, |
1055 &call->expected_version, NULL); 1056 if (ret < 0) 1057 return ret; | 1055 &call->expected_version, NULL); 1056 if (ret < 0) 1057 return ret; |
1058 /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */ | 1058 xdr_decode_AFSVolSync(&bp, call->out_volsync); |
1059 1060 _leave(" = 0 [done]"); 1061 return 0; 1062} 1063 1064/* 1065 * FS.Symlink operation type 1066 */ --- 9 unchanged lines hidden (view full) --- 1076 */ 1077int afs_fs_symlink(struct afs_fs_cursor *fc, 1078 const char *name, 1079 const char *contents, 1080 u64 current_data_version, 1081 struct afs_fid *newfid, 1082 struct afs_file_status *newstatus) 1083{ | 1059 1060 _leave(" = 0 [done]"); 1061 return 0; 1062} 1063 1064/* 1065 * FS.Symlink operation type 1066 */ --- 9 unchanged lines hidden (view full) --- 1076 */ 1077int afs_fs_symlink(struct afs_fs_cursor *fc, 1078 const char *name, 1079 const char *contents, 1080 u64 current_data_version, 1081 struct afs_fid *newfid, 1082 struct afs_file_status *newstatus) 1083{ |
1084 struct afs_vnode *vnode = fc->vnode; | 1084 struct afs_vnode *dvnode = fc->vnode; |
1085 struct afs_call *call; | 1085 struct afs_call *call; |
1086 struct afs_net *net = afs_v2net(vnode); | 1086 struct afs_net *net = afs_v2net(dvnode); |
1087 size_t namesz, reqsz, padsz, c_namesz, c_padsz; 1088 __be32 *bp; 1089 1090 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags)) 1091 return yfs_fs_symlink(fc, name, contents, current_data_version, 1092 newfid, newstatus); 1093 1094 _enter(""); --- 7 unchanged lines hidden (view full) --- 1102 reqsz = (6 * 4) + namesz + padsz + c_namesz + c_padsz + (6 * 4); 1103 1104 call = afs_alloc_flat_call(net, &afs_RXFSSymlink, reqsz, 1105 (3 + 21 + 21 + 6) * 4); 1106 if (!call) 1107 return -ENOMEM; 1108 1109 call->key = fc->key; | 1087 size_t namesz, reqsz, padsz, c_namesz, c_padsz; 1088 __be32 *bp; 1089 1090 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags)) 1091 return yfs_fs_symlink(fc, name, contents, current_data_version, 1092 newfid, newstatus); 1093 1094 _enter(""); --- 7 unchanged lines hidden (view full) --- 1102 reqsz = (6 * 4) + namesz + padsz + c_namesz + c_padsz + (6 * 4); 1103 1104 call = afs_alloc_flat_call(net, &afs_RXFSSymlink, reqsz, 1105 (3 + 21 + 21 + 6) * 4); 1106 if (!call) 1107 return -ENOMEM; 1108 1109 call->key = fc->key; |
1110 call->reply[0] = vnode; 1111 call->reply[1] = newfid; 1112 call->reply[2] = newstatus; | 1110 call->dvnode = dvnode; 1111 call->out_fid = newfid; 1112 call->out_extra_status = newstatus; |
1113 call->expected_version = current_data_version + 1; 1114 1115 /* marshall the parameters */ 1116 bp = call->request; 1117 *bp++ = htonl(FSSYMLINK); | 1113 call->expected_version = current_data_version + 1; 1114 1115 /* marshall the parameters */ 1116 bp = call->request; 1117 *bp++ = htonl(FSSYMLINK); |
1118 *bp++ = htonl(vnode->fid.vid); 1119 *bp++ = htonl(vnode->fid.vnode); 1120 *bp++ = htonl(vnode->fid.unique); | 1118 *bp++ = htonl(dvnode->fid.vid); 1119 *bp++ = htonl(dvnode->fid.vnode); 1120 *bp++ = htonl(dvnode->fid.unique); |
1121 *bp++ = htonl(namesz); 1122 memcpy(bp, name, namesz); 1123 bp = (void *) bp + namesz; 1124 if (padsz > 0) { 1125 memset(bp, 0, padsz); 1126 bp = (void *) bp + padsz; 1127 } 1128 *bp++ = htonl(c_namesz); 1129 memcpy(bp, contents, c_namesz); 1130 bp = (void *) bp + c_namesz; 1131 if (c_padsz > 0) { 1132 memset(bp, 0, c_padsz); 1133 bp = (void *) bp + c_padsz; 1134 } 1135 *bp++ = htonl(AFS_SET_MODE | AFS_SET_MTIME); | 1121 *bp++ = htonl(namesz); 1122 memcpy(bp, name, namesz); 1123 bp = (void *) bp + namesz; 1124 if (padsz > 0) { 1125 memset(bp, 0, padsz); 1126 bp = (void *) bp + padsz; 1127 } 1128 *bp++ = htonl(c_namesz); 1129 memcpy(bp, contents, c_namesz); 1130 bp = (void *) bp + c_namesz; 1131 if (c_padsz > 0) { 1132 memset(bp, 0, c_padsz); 1133 bp = (void *) bp + c_padsz; 1134 } 1135 *bp++ = htonl(AFS_SET_MODE | AFS_SET_MTIME); |
1136 *bp++ = htonl(vnode->vfs_inode.i_mtime.tv_sec); /* mtime */ | 1136 *bp++ = htonl(dvnode->vfs_inode.i_mtime.tv_sec); /* mtime */ |
1137 *bp++ = 0; /* owner */ 1138 *bp++ = 0; /* group */ 1139 *bp++ = htonl(S_IRWXUGO); /* unix mode */ 1140 *bp++ = 0; /* segment size */ 1141 1142 afs_use_fs_server(call, fc->cbi); | 1137 *bp++ = 0; /* owner */ 1138 *bp++ = 0; /* group */ 1139 *bp++ = htonl(S_IRWXUGO); /* unix mode */ 1140 *bp++ = 0; /* segment size */ 1141 1142 afs_use_fs_server(call, fc->cbi); |
1143 trace_afs_make_fs_call1(call, &vnode->fid, name); | 1143 trace_afs_make_fs_call1(call, &dvnode->fid, name); |
1144 afs_set_fc_call(call, fc); 1145 afs_make_call(&fc->ac, call, GFP_NOFS); 1146 return afs_wait_for_call_to_complete(call, &fc->ac); 1147} 1148 1149/* 1150 * deliver reply data to an FS.Rename 1151 */ 1152static int afs_deliver_fs_rename(struct afs_call *call) 1153{ | 1144 afs_set_fc_call(call, fc); 1145 afs_make_call(&fc->ac, call, GFP_NOFS); 1146 return afs_wait_for_call_to_complete(call, &fc->ac); 1147} 1148 1149/* 1150 * deliver reply data to an FS.Rename 1151 */ 1152static int afs_deliver_fs_rename(struct afs_call *call) 1153{ |
1154 struct afs_vnode *orig_dvnode = call->reply[0], *new_dvnode = call->reply[1]; | 1154 struct afs_vnode *orig_dvnode = call->dvnode, *new_dvnode = call->xvnode; |
1155 const __be32 *bp; 1156 int ret; 1157 1158 _enter("{%u}", call->unmarshall); 1159 1160 ret = afs_transfer_reply(call); 1161 if (ret < 0) 1162 return ret; --- 5 unchanged lines hidden (view full) --- 1168 if (ret < 0) 1169 return ret; 1170 if (new_dvnode != orig_dvnode) { 1171 ret = afs_decode_status(call, &bp, &new_dvnode->status, new_dvnode, 1172 &call->expected_version_2, NULL); 1173 if (ret < 0) 1174 return ret; 1175 } | 1155 const __be32 *bp; 1156 int ret; 1157 1158 _enter("{%u}", call->unmarshall); 1159 1160 ret = afs_transfer_reply(call); 1161 if (ret < 0) 1162 return ret; --- 5 unchanged lines hidden (view full) --- 1168 if (ret < 0) 1169 return ret; 1170 if (new_dvnode != orig_dvnode) { 1171 ret = afs_decode_status(call, &bp, &new_dvnode->status, new_dvnode, 1172 &call->expected_version_2, NULL); 1173 if (ret < 0) 1174 return ret; 1175 } |
1176 /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */ | 1176 xdr_decode_AFSVolSync(&bp, call->out_volsync); |
1177 1178 _leave(" = 0 [done]"); 1179 return 0; 1180} 1181 1182/* 1183 * FS.Rename operation type 1184 */ --- 39 unchanged lines hidden (view full) --- 1224 (3 * 4) + 1225 4 + n_namesz + n_padsz; 1226 1227 call = afs_alloc_flat_call(net, &afs_RXFSRename, reqsz, (21 + 21 + 6) * 4); 1228 if (!call) 1229 return -ENOMEM; 1230 1231 call->key = fc->key; | 1177 1178 _leave(" = 0 [done]"); 1179 return 0; 1180} 1181 1182/* 1183 * FS.Rename operation type 1184 */ --- 39 unchanged lines hidden (view full) --- 1224 (3 * 4) + 1225 4 + n_namesz + n_padsz; 1226 1227 call = afs_alloc_flat_call(net, &afs_RXFSRename, reqsz, (21 + 21 + 6) * 4); 1228 if (!call) 1229 return -ENOMEM; 1230 1231 call->key = fc->key; |
1232 call->reply[0] = orig_dvnode; 1233 call->reply[1] = new_dvnode; | 1232 call->dvnode = orig_dvnode; 1233 call->xvnode = new_dvnode; |
1234 call->expected_version = current_orig_data_version + 1; 1235 call->expected_version_2 = current_new_data_version + 1; 1236 1237 /* marshall the parameters */ 1238 bp = call->request; 1239 *bp++ = htonl(FSRENAME); 1240 *bp++ = htonl(orig_dvnode->fid.vid); 1241 *bp++ = htonl(orig_dvnode->fid.vnode); --- 24 unchanged lines hidden (view full) --- 1266 return afs_wait_for_call_to_complete(call, &fc->ac); 1267} 1268 1269/* 1270 * deliver reply data to an FS.StoreData 1271 */ 1272static int afs_deliver_fs_store_data(struct afs_call *call) 1273{ | 1234 call->expected_version = current_orig_data_version + 1; 1235 call->expected_version_2 = current_new_data_version + 1; 1236 1237 /* marshall the parameters */ 1238 bp = call->request; 1239 *bp++ = htonl(FSRENAME); 1240 *bp++ = htonl(orig_dvnode->fid.vid); 1241 *bp++ = htonl(orig_dvnode->fid.vnode); --- 24 unchanged lines hidden (view full) --- 1266 return afs_wait_for_call_to_complete(call, &fc->ac); 1267} 1268 1269/* 1270 * deliver reply data to an FS.StoreData 1271 */ 1272static int afs_deliver_fs_store_data(struct afs_call *call) 1273{ |
1274 struct afs_vnode *vnode = call->reply[0]; | 1274 struct afs_vnode *vnode = call->xvnode; |
1275 const __be32 *bp; 1276 int ret; 1277 1278 _enter(""); 1279 1280 ret = afs_transfer_reply(call); 1281 if (ret < 0) 1282 return ret; 1283 1284 /* unmarshall the reply once we've received all of it */ 1285 bp = call->buffer; 1286 ret = afs_decode_status(call, &bp, &vnode->status, vnode, 1287 &call->expected_version, NULL); 1288 if (ret < 0) 1289 return ret; | 1275 const __be32 *bp; 1276 int ret; 1277 1278 _enter(""); 1279 1280 ret = afs_transfer_reply(call); 1281 if (ret < 0) 1282 return ret; 1283 1284 /* unmarshall the reply once we've received all of it */ 1285 bp = call->buffer; 1286 ret = afs_decode_status(call, &bp, &vnode->status, vnode, 1287 &call->expected_version, NULL); 1288 if (ret < 0) 1289 return ret; |
1290 /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */ | 1290 xdr_decode_AFSVolSync(&bp, call->out_volsync); |
1291 1292 afs_pages_written_back(vnode, call); 1293 1294 _leave(" = 0 [done]"); 1295 return 0; 1296} 1297 1298/* --- 33 unchanged lines hidden (view full) --- 1332 call = afs_alloc_flat_call(net, &afs_RXFSStoreData64, 1333 (4 + 6 + 3 * 2) * 4, 1334 (21 + 6) * 4); 1335 if (!call) 1336 return -ENOMEM; 1337 1338 call->key = fc->key; 1339 call->mapping = mapping; | 1291 1292 afs_pages_written_back(vnode, call); 1293 1294 _leave(" = 0 [done]"); 1295 return 0; 1296} 1297 1298/* --- 33 unchanged lines hidden (view full) --- 1332 call = afs_alloc_flat_call(net, &afs_RXFSStoreData64, 1333 (4 + 6 + 3 * 2) * 4, 1334 (21 + 6) * 4); 1335 if (!call) 1336 return -ENOMEM; 1337 1338 call->key = fc->key; 1339 call->mapping = mapping; |
1340 call->reply[0] = vnode; | 1340 call->xvnode = vnode; |
1341 call->first = first; 1342 call->last = last; 1343 call->first_offset = offset; 1344 call->last_to = to; 1345 call->send_pages = true; 1346 call->expected_version = vnode->status.data_version + 1; 1347 1348 /* marshall the parameters */ --- 63 unchanged lines hidden (view full) --- 1412 call = afs_alloc_flat_call(net, &afs_RXFSStoreData, 1413 (4 + 6 + 3) * 4, 1414 (21 + 6) * 4); 1415 if (!call) 1416 return -ENOMEM; 1417 1418 call->key = fc->key; 1419 call->mapping = mapping; | 1341 call->first = first; 1342 call->last = last; 1343 call->first_offset = offset; 1344 call->last_to = to; 1345 call->send_pages = true; 1346 call->expected_version = vnode->status.data_version + 1; 1347 1348 /* marshall the parameters */ --- 63 unchanged lines hidden (view full) --- 1412 call = afs_alloc_flat_call(net, &afs_RXFSStoreData, 1413 (4 + 6 + 3) * 4, 1414 (21 + 6) * 4); 1415 if (!call) 1416 return -ENOMEM; 1417 1418 call->key = fc->key; 1419 call->mapping = mapping; |
1420 call->reply[0] = vnode; | 1420 call->xvnode = vnode; |
1421 call->first = first; 1422 call->last = last; 1423 call->first_offset = offset; 1424 call->last_to = to; 1425 call->send_pages = true; 1426 call->expected_version = vnode->status.data_version + 1; 1427 1428 /* marshall the parameters */ --- 21 unchanged lines hidden (view full) --- 1450 return afs_wait_for_call_to_complete(call, &fc->ac); 1451} 1452 1453/* 1454 * deliver reply data to an FS.StoreStatus 1455 */ 1456static int afs_deliver_fs_store_status(struct afs_call *call) 1457{ | 1421 call->first = first; 1422 call->last = last; 1423 call->first_offset = offset; 1424 call->last_to = to; 1425 call->send_pages = true; 1426 call->expected_version = vnode->status.data_version + 1; 1427 1428 /* marshall the parameters */ --- 21 unchanged lines hidden (view full) --- 1450 return afs_wait_for_call_to_complete(call, &fc->ac); 1451} 1452 1453/* 1454 * deliver reply data to an FS.StoreStatus 1455 */ 1456static int afs_deliver_fs_store_status(struct afs_call *call) 1457{ |
1458 struct afs_vnode *vnode = call->reply[0]; | 1458 struct afs_vnode *vnode = call->xvnode; |
1459 const __be32 *bp; 1460 int ret; 1461 1462 _enter(""); 1463 1464 ret = afs_transfer_reply(call); 1465 if (ret < 0) 1466 return ret; 1467 1468 /* unmarshall the reply once we've received all of it */ 1469 bp = call->buffer; 1470 ret = afs_decode_status(call, &bp, &vnode->status, vnode, 1471 &call->expected_version, NULL); 1472 if (ret < 0) 1473 return ret; | 1459 const __be32 *bp; 1460 int ret; 1461 1462 _enter(""); 1463 1464 ret = afs_transfer_reply(call); 1465 if (ret < 0) 1466 return ret; 1467 1468 /* unmarshall the reply once we've received all of it */ 1469 bp = call->buffer; 1470 ret = afs_decode_status(call, &bp, &vnode->status, vnode, 1471 &call->expected_version, NULL); 1472 if (ret < 0) 1473 return ret; |
1474 /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */ | 1474 xdr_decode_AFSVolSync(&bp, call->out_volsync); |
1475 1476 _leave(" = 0 [done]"); 1477 return 0; 1478} 1479 1480/* 1481 * FS.StoreStatus operation type 1482 */ --- 36 unchanged lines hidden (view full) --- 1519 1520 call = afs_alloc_flat_call(net, &afs_RXFSStoreData64_as_Status, 1521 (4 + 6 + 3 * 2) * 4, 1522 (21 + 6) * 4); 1523 if (!call) 1524 return -ENOMEM; 1525 1526 call->key = fc->key; | 1475 1476 _leave(" = 0 [done]"); 1477 return 0; 1478} 1479 1480/* 1481 * FS.StoreStatus operation type 1482 */ --- 36 unchanged lines hidden (view full) --- 1519 1520 call = afs_alloc_flat_call(net, &afs_RXFSStoreData64_as_Status, 1521 (4 + 6 + 3 * 2) * 4, 1522 (21 + 6) * 4); 1523 if (!call) 1524 return -ENOMEM; 1525 1526 call->key = fc->key; |
1527 call->reply[0] = vnode; | 1527 call->xvnode = vnode; |
1528 call->expected_version = vnode->status.data_version + 1; 1529 1530 /* marshall the parameters */ 1531 bp = call->request; 1532 *bp++ = htonl(FSSTOREDATA64); 1533 *bp++ = htonl(vnode->fid.vid); 1534 *bp++ = htonl(vnode->fid.vnode); 1535 *bp++ = htonl(vnode->fid.unique); --- 34 unchanged lines hidden (view full) --- 1570 1571 call = afs_alloc_flat_call(net, &afs_RXFSStoreData_as_Status, 1572 (4 + 6 + 3) * 4, 1573 (21 + 6) * 4); 1574 if (!call) 1575 return -ENOMEM; 1576 1577 call->key = fc->key; | 1528 call->expected_version = vnode->status.data_version + 1; 1529 1530 /* marshall the parameters */ 1531 bp = call->request; 1532 *bp++ = htonl(FSSTOREDATA64); 1533 *bp++ = htonl(vnode->fid.vid); 1534 *bp++ = htonl(vnode->fid.vnode); 1535 *bp++ = htonl(vnode->fid.unique); --- 34 unchanged lines hidden (view full) --- 1570 1571 call = afs_alloc_flat_call(net, &afs_RXFSStoreData_as_Status, 1572 (4 + 6 + 3) * 4, 1573 (21 + 6) * 4); 1574 if (!call) 1575 return -ENOMEM; 1576 1577 call->key = fc->key; |
1578 call->reply[0] = vnode; | 1578 call->xvnode = vnode; |
1579 call->expected_version = vnode->status.data_version + 1; 1580 1581 /* marshall the parameters */ 1582 bp = call->request; 1583 *bp++ = htonl(FSSTOREDATA); 1584 *bp++ = htonl(vnode->fid.vid); 1585 *bp++ = htonl(vnode->fid.vnode); 1586 *bp++ = htonl(vnode->fid.unique); --- 33 unchanged lines hidden (view full) --- 1620 1621 call = afs_alloc_flat_call(net, &afs_RXFSStoreStatus, 1622 (4 + 6) * 4, 1623 (21 + 6) * 4); 1624 if (!call) 1625 return -ENOMEM; 1626 1627 call->key = fc->key; | 1579 call->expected_version = vnode->status.data_version + 1; 1580 1581 /* marshall the parameters */ 1582 bp = call->request; 1583 *bp++ = htonl(FSSTOREDATA); 1584 *bp++ = htonl(vnode->fid.vid); 1585 *bp++ = htonl(vnode->fid.vnode); 1586 *bp++ = htonl(vnode->fid.unique); --- 33 unchanged lines hidden (view full) --- 1620 1621 call = afs_alloc_flat_call(net, &afs_RXFSStoreStatus, 1622 (4 + 6) * 4, 1623 (21 + 6) * 4); 1624 if (!call) 1625 return -ENOMEM; 1626 1627 call->key = fc->key; |
1628 call->reply[0] = vnode; | 1628 call->xvnode = vnode; |
1629 call->expected_version = vnode->status.data_version; 1630 1631 /* marshall the parameters */ 1632 bp = call->request; 1633 *bp++ = htonl(FSSTORESTATUS); 1634 *bp++ = htonl(vnode->fid.vid); 1635 *bp++ = htonl(vnode->fid.vnode); 1636 *bp++ = htonl(vnode->fid.unique); --- 27 unchanged lines hidden (view full) --- 1664 /* Fall through - and extract the returned status record */ 1665 case 1: 1666 _debug("extract status"); 1667 ret = afs_extract_data(call, true); 1668 if (ret < 0) 1669 return ret; 1670 1671 bp = call->buffer; | 1629 call->expected_version = vnode->status.data_version; 1630 1631 /* marshall the parameters */ 1632 bp = call->request; 1633 *bp++ = htonl(FSSTORESTATUS); 1634 *bp++ = htonl(vnode->fid.vid); 1635 *bp++ = htonl(vnode->fid.vnode); 1636 *bp++ = htonl(vnode->fid.unique); --- 27 unchanged lines hidden (view full) --- 1664 /* Fall through - and extract the returned status record */ 1665 case 1: 1666 _debug("extract status"); 1667 ret = afs_extract_data(call, true); 1668 if (ret < 0) 1669 return ret; 1670 1671 bp = call->buffer; |
1672 xdr_decode_AFSFetchVolumeStatus(&bp, call->reply[1]); | 1672 xdr_decode_AFSFetchVolumeStatus(&bp, call->out_volstatus); |
1673 call->unmarshall++; 1674 afs_extract_to_tmp(call); 1675 1676 /* Fall through - and extract the volume name length */ 1677 case 2: 1678 ret = afs_extract_data(call, true); 1679 if (ret < 0) 1680 return ret; 1681 1682 call->count = ntohl(call->tmp); 1683 _debug("volname length: %u", call->count); 1684 if (call->count >= AFSNAMEMAX) 1685 return afs_protocol_error(call, -EBADMSG, 1686 afs_eproto_volname_len); 1687 size = (call->count + 3) & ~3; /* It's padded */ | 1673 call->unmarshall++; 1674 afs_extract_to_tmp(call); 1675 1676 /* Fall through - and extract the volume name length */ 1677 case 2: 1678 ret = afs_extract_data(call, true); 1679 if (ret < 0) 1680 return ret; 1681 1682 call->count = ntohl(call->tmp); 1683 _debug("volname length: %u", call->count); 1684 if (call->count >= AFSNAMEMAX) 1685 return afs_protocol_error(call, -EBADMSG, 1686 afs_eproto_volname_len); 1687 size = (call->count + 3) & ~3; /* It's padded */ |
1688 afs_extract_begin(call, call->reply[2], size); | 1688 afs_extract_to_buf(call, size); |
1689 call->unmarshall++; 1690 1691 /* Fall through - and extract the volume name */ 1692 case 3: 1693 _debug("extract volname"); 1694 ret = afs_extract_data(call, true); 1695 if (ret < 0) 1696 return ret; 1697 | 1689 call->unmarshall++; 1690 1691 /* Fall through - and extract the volume name */ 1692 case 3: 1693 _debug("extract volname"); 1694 ret = afs_extract_data(call, true); 1695 if (ret < 0) 1696 return ret; 1697 |
1698 p = call->reply[2]; | 1698 p = call->buffer; |
1699 p[call->count] = 0; 1700 _debug("volname '%s'", p); 1701 afs_extract_to_tmp(call); 1702 call->unmarshall++; 1703 1704 /* Fall through - and extract the offline message length */ 1705 case 4: 1706 ret = afs_extract_data(call, true); 1707 if (ret < 0) 1708 return ret; 1709 1710 call->count = ntohl(call->tmp); 1711 _debug("offline msg length: %u", call->count); 1712 if (call->count >= AFSNAMEMAX) 1713 return afs_protocol_error(call, -EBADMSG, 1714 afs_eproto_offline_msg_len); 1715 size = (call->count + 3) & ~3; /* It's padded */ | 1699 p[call->count] = 0; 1700 _debug("volname '%s'", p); 1701 afs_extract_to_tmp(call); 1702 call->unmarshall++; 1703 1704 /* Fall through - and extract the offline message length */ 1705 case 4: 1706 ret = afs_extract_data(call, true); 1707 if (ret < 0) 1708 return ret; 1709 1710 call->count = ntohl(call->tmp); 1711 _debug("offline msg length: %u", call->count); 1712 if (call->count >= AFSNAMEMAX) 1713 return afs_protocol_error(call, -EBADMSG, 1714 afs_eproto_offline_msg_len); 1715 size = (call->count + 3) & ~3; /* It's padded */ |
1716 afs_extract_begin(call, call->reply[2], size); | 1716 afs_extract_to_buf(call, size); |
1717 call->unmarshall++; 1718 1719 /* Fall through - and extract the offline message */ 1720 case 5: 1721 _debug("extract offline"); 1722 ret = afs_extract_data(call, true); 1723 if (ret < 0) 1724 return ret; 1725 | 1717 call->unmarshall++; 1718 1719 /* Fall through - and extract the offline message */ 1720 case 5: 1721 _debug("extract offline"); 1722 ret = afs_extract_data(call, true); 1723 if (ret < 0) 1724 return ret; 1725 |
1726 p = call->reply[2]; | 1726 p = call->buffer; |
1727 p[call->count] = 0; 1728 _debug("offline '%s'", p); 1729 1730 afs_extract_to_tmp(call); 1731 call->unmarshall++; 1732 1733 /* Fall through - and extract the message of the day length */ 1734 case 6: 1735 ret = afs_extract_data(call, true); 1736 if (ret < 0) 1737 return ret; 1738 1739 call->count = ntohl(call->tmp); 1740 _debug("motd length: %u", call->count); 1741 if (call->count >= AFSNAMEMAX) 1742 return afs_protocol_error(call, -EBADMSG, 1743 afs_eproto_motd_len); 1744 size = (call->count + 3) & ~3; /* It's padded */ | 1727 p[call->count] = 0; 1728 _debug("offline '%s'", p); 1729 1730 afs_extract_to_tmp(call); 1731 call->unmarshall++; 1732 1733 /* Fall through - and extract the message of the day length */ 1734 case 6: 1735 ret = afs_extract_data(call, true); 1736 if (ret < 0) 1737 return ret; 1738 1739 call->count = ntohl(call->tmp); 1740 _debug("motd length: %u", call->count); 1741 if (call->count >= AFSNAMEMAX) 1742 return afs_protocol_error(call, -EBADMSG, 1743 afs_eproto_motd_len); 1744 size = (call->count + 3) & ~3; /* It's padded */ |
1745 afs_extract_begin(call, call->reply[2], size); | 1745 afs_extract_to_buf(call, size); |
1746 call->unmarshall++; 1747 1748 /* Fall through - and extract the message of the day */ 1749 case 7: 1750 _debug("extract motd"); 1751 ret = afs_extract_data(call, false); 1752 if (ret < 0) 1753 return ret; 1754 | 1746 call->unmarshall++; 1747 1748 /* Fall through - and extract the message of the day */ 1749 case 7: 1750 _debug("extract motd"); 1751 ret = afs_extract_data(call, false); 1752 if (ret < 0) 1753 return ret; 1754 |
1755 p = call->reply[2]; | 1755 p = call->buffer; |
1756 p[call->count] = 0; 1757 _debug("motd '%s'", p); 1758 1759 call->unmarshall++; 1760 1761 case 8: 1762 break; 1763 } 1764 1765 _leave(" = 0 [done]"); 1766 return 0; 1767} 1768 1769/* | 1756 p[call->count] = 0; 1757 _debug("motd '%s'", p); 1758 1759 call->unmarshall++; 1760 1761 case 8: 1762 break; 1763 } 1764 1765 _leave(" = 0 [done]"); 1766 return 0; 1767} 1768 1769/* |
1770 * destroy an FS.GetVolumeStatus call 1771 */ 1772static void afs_get_volume_status_call_destructor(struct afs_call *call) 1773{ 1774 kfree(call->reply[2]); 1775 call->reply[2] = NULL; 1776 afs_flat_call_destructor(call); 1777} 1778 1779/* | |
1780 * FS.GetVolumeStatus operation type 1781 */ 1782static const struct afs_call_type afs_RXFSGetVolumeStatus = { 1783 .name = "FS.GetVolumeStatus", 1784 .op = afs_FS_GetVolumeStatus, 1785 .deliver = afs_deliver_fs_get_volume_status, | 1770 * FS.GetVolumeStatus operation type 1771 */ 1772static const struct afs_call_type afs_RXFSGetVolumeStatus = { 1773 .name = "FS.GetVolumeStatus", 1774 .op = afs_FS_GetVolumeStatus, 1775 .deliver = afs_deliver_fs_get_volume_status, |
1786 .destructor = afs_get_volume_status_call_destructor, | 1776 .destructor = afs_flat_call_destructor, |
1787}; 1788 1789/* 1790 * fetch the status of a volume 1791 */ 1792int afs_fs_get_volume_status(struct afs_fs_cursor *fc, 1793 struct afs_volume_status *vs) 1794{ 1795 struct afs_vnode *vnode = fc->vnode; 1796 struct afs_call *call; 1797 struct afs_net *net = afs_v2net(vnode); 1798 __be32 *bp; | 1777}; 1778 1779/* 1780 * fetch the status of a volume 1781 */ 1782int afs_fs_get_volume_status(struct afs_fs_cursor *fc, 1783 struct afs_volume_status *vs) 1784{ 1785 struct afs_vnode *vnode = fc->vnode; 1786 struct afs_call *call; 1787 struct afs_net *net = afs_v2net(vnode); 1788 __be32 *bp; |
1799 void *tmpbuf; | |
1800 1801 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags)) 1802 return yfs_fs_get_volume_status(fc, vs); 1803 1804 _enter(""); 1805 | 1789 1790 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags)) 1791 return yfs_fs_get_volume_status(fc, vs); 1792 1793 _enter(""); 1794 |
1806 tmpbuf = kmalloc(AFSOPAQUEMAX, GFP_KERNEL); 1807 if (!tmpbuf) | 1795 call = afs_alloc_flat_call(net, &afs_RXFSGetVolumeStatus, 2 * 4, 1796 max(12 * 4, AFSOPAQUEMAX + 1)); 1797 if (!call) |
1808 return -ENOMEM; 1809 | 1798 return -ENOMEM; 1799 |
1810 call = afs_alloc_flat_call(net, &afs_RXFSGetVolumeStatus, 2 * 4, 12 * 4); 1811 if (!call) { 1812 kfree(tmpbuf); 1813 return -ENOMEM; 1814 } 1815 | |
1816 call->key = fc->key; | 1800 call->key = fc->key; |
1817 call->reply[0] = vnode; 1818 call->reply[1] = vs; 1819 call->reply[2] = tmpbuf; | 1801 call->out_volstatus = vs; |
1820 1821 /* marshall the parameters */ 1822 bp = call->request; 1823 bp[0] = htonl(FSGETVOLUMESTATUS); 1824 bp[1] = htonl(vnode->fid.vid); 1825 1826 afs_use_fs_server(call, fc->cbi); 1827 trace_afs_make_fs_call(call, &vnode->fid); --- 13 unchanged lines hidden (view full) --- 1841 _enter("{%u}", call->unmarshall); 1842 1843 ret = afs_transfer_reply(call); 1844 if (ret < 0) 1845 return ret; 1846 1847 /* unmarshall the reply once we've received all of it */ 1848 bp = call->buffer; | 1802 1803 /* marshall the parameters */ 1804 bp = call->request; 1805 bp[0] = htonl(FSGETVOLUMESTATUS); 1806 bp[1] = htonl(vnode->fid.vid); 1807 1808 afs_use_fs_server(call, fc->cbi); 1809 trace_afs_make_fs_call(call, &vnode->fid); --- 13 unchanged lines hidden (view full) --- 1823 _enter("{%u}", call->unmarshall); 1824 1825 ret = afs_transfer_reply(call); 1826 if (ret < 0) 1827 return ret; 1828 1829 /* unmarshall the reply once we've received all of it */ 1830 bp = call->buffer; |
1849 /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */ | 1831 xdr_decode_AFSVolSync(&bp, call->out_volsync); |
1850 1851 _leave(" = 0 [done]"); 1852 return 0; 1853} 1854 1855/* 1856 * FS.SetLock operation type 1857 */ --- 41 unchanged lines hidden (view full) --- 1899 1900 _enter(""); 1901 1902 call = afs_alloc_flat_call(net, &afs_RXFSSetLock, 5 * 4, 6 * 4); 1903 if (!call) 1904 return -ENOMEM; 1905 1906 call->key = fc->key; | 1832 1833 _leave(" = 0 [done]"); 1834 return 0; 1835} 1836 1837/* 1838 * FS.SetLock operation type 1839 */ --- 41 unchanged lines hidden (view full) --- 1881 1882 _enter(""); 1883 1884 call = afs_alloc_flat_call(net, &afs_RXFSSetLock, 5 * 4, 6 * 4); 1885 if (!call) 1886 return -ENOMEM; 1887 1888 call->key = fc->key; |
1907 call->reply[0] = vnode; | 1889 call->xvnode = vnode; |
1908 call->want_reply_time = true; 1909 1910 /* marshall the parameters */ 1911 bp = call->request; 1912 *bp++ = htonl(FSSETLOCK); 1913 *bp++ = htonl(vnode->fid.vid); 1914 *bp++ = htonl(vnode->fid.vnode); 1915 *bp++ = htonl(vnode->fid.unique); --- 21 unchanged lines hidden (view full) --- 1937 1938 _enter(""); 1939 1940 call = afs_alloc_flat_call(net, &afs_RXFSExtendLock, 4 * 4, 6 * 4); 1941 if (!call) 1942 return -ENOMEM; 1943 1944 call->key = fc->key; | 1890 call->want_reply_time = true; 1891 1892 /* marshall the parameters */ 1893 bp = call->request; 1894 *bp++ = htonl(FSSETLOCK); 1895 *bp++ = htonl(vnode->fid.vid); 1896 *bp++ = htonl(vnode->fid.vnode); 1897 *bp++ = htonl(vnode->fid.unique); --- 21 unchanged lines hidden (view full) --- 1919 1920 _enter(""); 1921 1922 call = afs_alloc_flat_call(net, &afs_RXFSExtendLock, 4 * 4, 6 * 4); 1923 if (!call) 1924 return -ENOMEM; 1925 1926 call->key = fc->key; |
1945 call->reply[0] = vnode; | 1927 call->xvnode = vnode; |
1946 call->want_reply_time = true; 1947 1948 /* marshall the parameters */ 1949 bp = call->request; 1950 *bp++ = htonl(FSEXTENDLOCK); 1951 *bp++ = htonl(vnode->fid.vid); 1952 *bp++ = htonl(vnode->fid.vnode); 1953 *bp++ = htonl(vnode->fid.unique); --- 20 unchanged lines hidden (view full) --- 1974 1975 _enter(""); 1976 1977 call = afs_alloc_flat_call(net, &afs_RXFSReleaseLock, 4 * 4, 6 * 4); 1978 if (!call) 1979 return -ENOMEM; 1980 1981 call->key = fc->key; | 1928 call->want_reply_time = true; 1929 1930 /* marshall the parameters */ 1931 bp = call->request; 1932 *bp++ = htonl(FSEXTENDLOCK); 1933 *bp++ = htonl(vnode->fid.vid); 1934 *bp++ = htonl(vnode->fid.vnode); 1935 *bp++ = htonl(vnode->fid.unique); --- 20 unchanged lines hidden (view full) --- 1956 1957 _enter(""); 1958 1959 call = afs_alloc_flat_call(net, &afs_RXFSReleaseLock, 4 * 4, 6 * 4); 1960 if (!call) 1961 return -ENOMEM; 1962 1963 call->key = fc->key; |
1982 call->reply[0] = vnode; | 1964 call->xvnode = vnode; |
1983 1984 /* marshall the parameters */ 1985 bp = call->request; 1986 *bp++ = htonl(FSRELEASELOCK); 1987 *bp++ = htonl(vnode->fid.vid); 1988 *bp++ = htonl(vnode->fid.vnode); 1989 *bp++ = htonl(vnode->fid.unique); 1990 --- 89 unchanged lines hidden (view full) --- 2080 call->unmarshall++; 2081 break; 2082 } 2083 2084 _leave(" = 0 [done]"); 2085 return 0; 2086} 2087 | 1965 1966 /* marshall the parameters */ 1967 bp = call->request; 1968 *bp++ = htonl(FSRELEASELOCK); 1969 *bp++ = htonl(vnode->fid.vid); 1970 *bp++ = htonl(vnode->fid.vnode); 1971 *bp++ = htonl(vnode->fid.unique); 1972 --- 89 unchanged lines hidden (view full) --- 2062 call->unmarshall++; 2063 break; 2064 } 2065 2066 _leave(" = 0 [done]"); 2067 return 0; 2068} 2069 |
2088static void afs_destroy_fs_get_capabilities(struct afs_call *call) 2089{ 2090 struct afs_server *server = call->reply[0]; 2091 2092 afs_put_server(call->net, server); 2093 afs_flat_call_destructor(call); 2094} 2095 | |
2096/* 2097 * FS.GetCapabilities operation type 2098 */ 2099static const struct afs_call_type afs_RXFSGetCapabilities = { 2100 .name = "FS.GetCapabilities", 2101 .op = afs_FS_GetCapabilities, 2102 .deliver = afs_deliver_fs_get_capabilities, 2103 .done = afs_fileserver_probe_result, | 2070/* 2071 * FS.GetCapabilities operation type 2072 */ 2073static const struct afs_call_type afs_RXFSGetCapabilities = { 2074 .name = "FS.GetCapabilities", 2075 .op = afs_FS_GetCapabilities, 2076 .deliver = afs_deliver_fs_get_capabilities, 2077 .done = afs_fileserver_probe_result, |
2104 .destructor = afs_destroy_fs_get_capabilities, | 2078 .destructor = afs_flat_call_destructor, |
2105}; 2106 2107/* 2108 * Probe a fileserver for the capabilities that it supports. This can 2109 * return up to 196 words. 2110 */ 2111struct afs_call *afs_fs_get_capabilities(struct afs_net *net, 2112 struct afs_server *server, --- 6 unchanged lines hidden (view full) --- 2119 2120 _enter(""); 2121 2122 call = afs_alloc_flat_call(net, &afs_RXFSGetCapabilities, 1 * 4, 16 * 4); 2123 if (!call) 2124 return ERR_PTR(-ENOMEM); 2125 2126 call->key = key; | 2079}; 2080 2081/* 2082 * Probe a fileserver for the capabilities that it supports. This can 2083 * return up to 196 words. 2084 */ 2085struct afs_call *afs_fs_get_capabilities(struct afs_net *net, 2086 struct afs_server *server, --- 6 unchanged lines hidden (view full) --- 2093 2094 _enter(""); 2095 2096 call = afs_alloc_flat_call(net, &afs_RXFSGetCapabilities, 1 * 4, 16 * 4); 2097 if (!call) 2098 return ERR_PTR(-ENOMEM); 2099 2100 call->key = key; |
2127 call->reply[0] = afs_get_server(server); 2128 call->reply[1] = (void *)(long)server_index; | 2101 call->server = afs_get_server(server); 2102 call->server_index = server_index; |
2129 call->upgrade = true; 2130 call->want_reply_time = true; 2131 call->async = true; 2132 call->max_lifespan = AFS_PROBE_MAX_LIFESPAN; 2133 2134 /* marshall the parameters */ 2135 bp = call->request; 2136 *bp++ = htonl(FSGETCAPABILITIES); --- 4 unchanged lines hidden (view full) --- 2141 return call; 2142} 2143 2144/* 2145 * Deliver reply data to an FS.FetchStatus with no vnode. 2146 */ 2147static int afs_deliver_fs_fetch_status(struct afs_call *call) 2148{ | 2103 call->upgrade = true; 2104 call->want_reply_time = true; 2105 call->async = true; 2106 call->max_lifespan = AFS_PROBE_MAX_LIFESPAN; 2107 2108 /* marshall the parameters */ 2109 bp = call->request; 2110 *bp++ = htonl(FSGETCAPABILITIES); --- 4 unchanged lines hidden (view full) --- 2115 return call; 2116} 2117 2118/* 2119 * Deliver reply data to an FS.FetchStatus with no vnode. 2120 */ 2121static int afs_deliver_fs_fetch_status(struct afs_call *call) 2122{ |
2149 struct afs_file_status *status = call->reply[1]; 2150 struct afs_callback *callback = call->reply[2]; 2151 struct afs_volsync *volsync = call->reply[3]; 2152 struct afs_fid *fid = call->reply[0]; | 2123 struct afs_file_status *status = call->out_vnode_status; 2124 struct afs_callback *callback = call->out_cb; 2125 struct afs_volsync *volsync = call->out_volsync; 2126 struct afs_fid *fid = call->out_fid; |
2153 const __be32 *bp; 2154 int ret; 2155 2156 ret = afs_transfer_reply(call); 2157 if (ret < 0) 2158 return ret; 2159 2160 _enter("{%llx:%llu}", fid->vid, fid->vnode); --- 42 unchanged lines hidden (view full) --- 2203 2204 call = afs_alloc_flat_call(net, &afs_RXFSFetchStatus, 16, (21 + 3 + 6) * 4); 2205 if (!call) { 2206 fc->ac.error = -ENOMEM; 2207 return -ENOMEM; 2208 } 2209 2210 call->key = fc->key; | 2127 const __be32 *bp; 2128 int ret; 2129 2130 ret = afs_transfer_reply(call); 2131 if (ret < 0) 2132 return ret; 2133 2134 _enter("{%llx:%llu}", fid->vid, fid->vnode); --- 42 unchanged lines hidden (view full) --- 2177 2178 call = afs_alloc_flat_call(net, &afs_RXFSFetchStatus, 16, (21 + 3 + 6) * 4); 2179 if (!call) { 2180 fc->ac.error = -ENOMEM; 2181 return -ENOMEM; 2182 } 2183 2184 call->key = fc->key; |
2211 call->reply[0] = fid; 2212 call->reply[1] = status; 2213 call->reply[2] = callback; 2214 call->reply[3] = volsync; | 2185 call->out_fid = fid; 2186 call->out_vnode_status = status; 2187 call->out_cb = callback; 2188 call->out_volsync = volsync; |
2215 call->expected_version = 1; /* vnode->status.data_version */ 2216 call->want_reply_time = true; 2217 2218 /* marshall the parameters */ 2219 bp = call->request; 2220 bp[0] = htonl(FSFETCHSTATUS); 2221 bp[1] = htonl(fid->vid); 2222 bp[2] = htonl(fid->vnode); --- 7 unchanged lines hidden (view full) --- 2230 return afs_wait_for_call_to_complete(call, &fc->ac); 2231} 2232 2233/* 2234 * Deliver reply data to an FS.InlineBulkStatus call 2235 */ 2236static int afs_deliver_fs_inline_bulk_status(struct afs_call *call) 2237{ | 2189 call->expected_version = 1; /* vnode->status.data_version */ 2190 call->want_reply_time = true; 2191 2192 /* marshall the parameters */ 2193 bp = call->request; 2194 bp[0] = htonl(FSFETCHSTATUS); 2195 bp[1] = htonl(fid->vid); 2196 bp[2] = htonl(fid->vnode); --- 7 unchanged lines hidden (view full) --- 2204 return afs_wait_for_call_to_complete(call, &fc->ac); 2205} 2206 2207/* 2208 * Deliver reply data to an FS.InlineBulkStatus call 2209 */ 2210static int afs_deliver_fs_inline_bulk_status(struct afs_call *call) 2211{ |
2238 struct afs_file_status *statuses; 2239 struct afs_callback *callbacks; 2240 struct afs_vnode *vnode = call->reply[0]; | 2212 struct afs_status_cb *scb; |
2241 const __be32 *bp; 2242 u32 tmp; 2243 int ret; 2244 2245 _enter("{%u}", call->unmarshall); 2246 2247 switch (call->unmarshall) { 2248 case 0: --- 22 unchanged lines hidden (view full) --- 2271 /* Fall through */ 2272 case 2: 2273 _debug("extract status array %u", call->count); 2274 ret = afs_extract_data(call, true); 2275 if (ret < 0) 2276 return ret; 2277 2278 bp = call->buffer; | 2213 const __be32 *bp; 2214 u32 tmp; 2215 int ret; 2216 2217 _enter("{%u}", call->unmarshall); 2218 2219 switch (call->unmarshall) { 2220 case 0: --- 22 unchanged lines hidden (view full) --- 2243 /* Fall through */ 2244 case 2: 2245 _debug("extract status array %u", call->count); 2246 ret = afs_extract_data(call, true); 2247 if (ret < 0) 2248 return ret; 2249 2250 bp = call->buffer; |
2279 statuses = call->reply[1]; 2280 ret = afs_decode_status(call, &bp, &statuses[call->count], 2281 call->count == 0 ? vnode : NULL, 2282 NULL, NULL); | 2251 scb = &call->out_scb[call->count]; 2252 ret = afs_decode_status(call, &bp, &scb->status, 2253 NULL, NULL, NULL); |
2283 if (ret < 0) 2284 return ret; 2285 2286 call->count++; 2287 if (call->count < call->count2) 2288 goto more_counts; 2289 2290 call->count = 0; --- 22 unchanged lines hidden (view full) --- 2313 case 4: 2314 _debug("extract CB array"); 2315 ret = afs_extract_data(call, true); 2316 if (ret < 0) 2317 return ret; 2318 2319 _debug("unmarshall CB array"); 2320 bp = call->buffer; | 2254 if (ret < 0) 2255 return ret; 2256 2257 call->count++; 2258 if (call->count < call->count2) 2259 goto more_counts; 2260 2261 call->count = 0; --- 22 unchanged lines hidden (view full) --- 2284 case 4: 2285 _debug("extract CB array"); 2286 ret = afs_extract_data(call, true); 2287 if (ret < 0) 2288 return ret; 2289 2290 _debug("unmarshall CB array"); 2291 bp = call->buffer; |
2321 callbacks = call->reply[2]; 2322 xdr_decode_AFSCallBack_raw(call, &callbacks[call->count], &bp); 2323 statuses = call->reply[1]; 2324 if (call->count == 0 && vnode && statuses[0].abort_code == 0) 2325 xdr_decode_AFSCallBack(call, vnode, &bp); | 2292 scb = &call->out_scb[call->count]; 2293 xdr_decode_AFSCallBack_raw(call, &scb->callback, &bp); 2294 scb->have_cb = true; |
2326 call->count++; 2327 if (call->count < call->count2) 2328 goto more_cbs; 2329 2330 afs_extract_to_buf(call, 6 * sizeof(__be32)); 2331 call->unmarshall++; 2332 2333 /* Fall through */ 2334 case 5: 2335 ret = afs_extract_data(call, false); 2336 if (ret < 0) 2337 return ret; 2338 2339 bp = call->buffer; | 2295 call->count++; 2296 if (call->count < call->count2) 2297 goto more_cbs; 2298 2299 afs_extract_to_buf(call, 6 * sizeof(__be32)); 2300 call->unmarshall++; 2301 2302 /* Fall through */ 2303 case 5: 2304 ret = afs_extract_data(call, false); 2305 if (ret < 0) 2306 return ret; 2307 2308 bp = call->buffer; |
2340 xdr_decode_AFSVolSync(&bp, call->reply[3]); | 2309 xdr_decode_AFSVolSync(&bp, call->out_volsync); |
2341 2342 call->unmarshall++; 2343 2344 case 6: 2345 break; 2346 } 2347 2348 _leave(" = 0 [done]"); --- 11 unchanged lines hidden (view full) --- 2360}; 2361 2362/* 2363 * Fetch the status information for up to 50 files 2364 */ 2365int afs_fs_inline_bulk_status(struct afs_fs_cursor *fc, 2366 struct afs_net *net, 2367 struct afs_fid *fids, | 2310 2311 call->unmarshall++; 2312 2313 case 6: 2314 break; 2315 } 2316 2317 _leave(" = 0 [done]"); --- 11 unchanged lines hidden (view full) --- 2329}; 2330 2331/* 2332 * Fetch the status information for up to 50 files 2333 */ 2334int afs_fs_inline_bulk_status(struct afs_fs_cursor *fc, 2335 struct afs_net *net, 2336 struct afs_fid *fids, |
2368 struct afs_file_status *statuses, 2369 struct afs_callback *callbacks, | 2337 struct afs_status_cb *statuses, |
2370 unsigned int nr_fids, 2371 struct afs_volsync *volsync) 2372{ 2373 struct afs_call *call; 2374 __be32 *bp; 2375 int i; 2376 2377 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags)) | 2338 unsigned int nr_fids, 2339 struct afs_volsync *volsync) 2340{ 2341 struct afs_call *call; 2342 __be32 *bp; 2343 int i; 2344 2345 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags)) |
2378 return yfs_fs_inline_bulk_status(fc, net, fids, statuses, callbacks, | 2346 return yfs_fs_inline_bulk_status(fc, net, fids, statuses, |
2379 nr_fids, volsync); 2380 2381 _enter(",%x,{%llx:%llu},%u", 2382 key_serial(fc->key), fids[0].vid, fids[1].vnode, nr_fids); 2383 2384 call = afs_alloc_flat_call(net, &afs_RXFSInlineBulkStatus, 2385 (2 + nr_fids * 3) * 4, 2386 21 * 4); 2387 if (!call) { 2388 fc->ac.error = -ENOMEM; 2389 return -ENOMEM; 2390 } 2391 2392 call->key = fc->key; | 2347 nr_fids, volsync); 2348 2349 _enter(",%x,{%llx:%llu},%u", 2350 key_serial(fc->key), fids[0].vid, fids[1].vnode, nr_fids); 2351 2352 call = afs_alloc_flat_call(net, &afs_RXFSInlineBulkStatus, 2353 (2 + nr_fids * 3) * 4, 2354 21 * 4); 2355 if (!call) { 2356 fc->ac.error = -ENOMEM; 2357 return -ENOMEM; 2358 } 2359 2360 call->key = fc->key; |
2393 call->reply[0] = NULL; /* vnode for fid[0] */ 2394 call->reply[1] = statuses; 2395 call->reply[2] = callbacks; 2396 call->reply[3] = volsync; | 2361 call->out_scb = statuses; 2362 call->out_volsync = volsync; |
2397 call->count2 = nr_fids; 2398 call->want_reply_time = true; 2399 2400 /* marshall the parameters */ 2401 bp = call->request; 2402 *bp++ = htonl(FSINLINEBULKSTATUS); 2403 *bp++ = htonl(nr_fids); 2404 for (i = 0; i < nr_fids; i++) { --- 10 unchanged lines hidden (view full) --- 2415 return afs_wait_for_call_to_complete(call, &fc->ac); 2416} 2417 2418/* 2419 * deliver reply data to an FS.FetchACL 2420 */ 2421static int afs_deliver_fs_fetch_acl(struct afs_call *call) 2422{ | 2363 call->count2 = nr_fids; 2364 call->want_reply_time = true; 2365 2366 /* marshall the parameters */ 2367 bp = call->request; 2368 *bp++ = htonl(FSINLINEBULKSTATUS); 2369 *bp++ = htonl(nr_fids); 2370 for (i = 0; i < nr_fids; i++) { --- 10 unchanged lines hidden (view full) --- 2381 return afs_wait_for_call_to_complete(call, &fc->ac); 2382} 2383 2384/* 2385 * deliver reply data to an FS.FetchACL 2386 */ 2387static int afs_deliver_fs_fetch_acl(struct afs_call *call) 2388{ |
2423 struct afs_vnode *vnode = call->reply[1]; | 2389 struct afs_vnode *vnode = call->xvnode; |
2424 struct afs_acl *acl; 2425 const __be32 *bp; 2426 unsigned int size; 2427 int ret; 2428 2429 _enter("{%u}", call->unmarshall); 2430 2431 switch (call->unmarshall) { --- 8 unchanged lines hidden (view full) --- 2440 return ret; 2441 2442 size = call->count2 = ntohl(call->tmp); 2443 size = round_up(size, 4); 2444 2445 acl = kmalloc(struct_size(acl, data, size), GFP_KERNEL); 2446 if (!acl) 2447 return -ENOMEM; | 2390 struct afs_acl *acl; 2391 const __be32 *bp; 2392 unsigned int size; 2393 int ret; 2394 2395 _enter("{%u}", call->unmarshall); 2396 2397 switch (call->unmarshall) { --- 8 unchanged lines hidden (view full) --- 2406 return ret; 2407 2408 size = call->count2 = ntohl(call->tmp); 2409 size = round_up(size, 4); 2410 2411 acl = kmalloc(struct_size(acl, data, size), GFP_KERNEL); 2412 if (!acl) 2413 return -ENOMEM; |
2448 call->reply[0] = acl; | 2414 call->ret_acl = acl; |
2449 acl->size = call->count2; 2450 afs_extract_begin(call, acl->data, size); 2451 call->unmarshall++; 2452 2453 /* extract the returned data */ 2454 case 2: 2455 ret = afs_extract_data(call, true); 2456 if (ret < 0) --- 8 unchanged lines hidden (view full) --- 2465 if (ret < 0) 2466 return ret; 2467 2468 bp = call->buffer; 2469 ret = afs_decode_status(call, &bp, &vnode->status, vnode, 2470 &vnode->status.data_version, NULL); 2471 if (ret < 0) 2472 return ret; | 2415 acl->size = call->count2; 2416 afs_extract_begin(call, acl->data, size); 2417 call->unmarshall++; 2418 2419 /* extract the returned data */ 2420 case 2: 2421 ret = afs_extract_data(call, true); 2422 if (ret < 0) --- 8 unchanged lines hidden (view full) --- 2431 if (ret < 0) 2432 return ret; 2433 2434 bp = call->buffer; 2435 ret = afs_decode_status(call, &bp, &vnode->status, vnode, 2436 &vnode->status.data_version, NULL); 2437 if (ret < 0) 2438 return ret; |
2473 xdr_decode_AFSVolSync(&bp, call->reply[2]); | 2439 xdr_decode_AFSVolSync(&bp, call->out_volsync); |
2474 2475 call->unmarshall++; 2476 2477 case 4: 2478 break; 2479 } 2480 2481 _leave(" = 0 [done]"); 2482 return 0; 2483} 2484 2485static void afs_destroy_fs_fetch_acl(struct afs_call *call) 2486{ | 2440 2441 call->unmarshall++; 2442 2443 case 4: 2444 break; 2445 } 2446 2447 _leave(" = 0 [done]"); 2448 return 0; 2449} 2450 2451static void afs_destroy_fs_fetch_acl(struct afs_call *call) 2452{ |
2487 kfree(call->reply[0]); | 2453 kfree(call->ret_acl); |
2488 afs_flat_call_destructor(call); 2489} 2490 2491/* 2492 * FS.FetchACL operation type 2493 */ 2494static const struct afs_call_type afs_RXFSFetchACL = { 2495 .name = "FS.FetchACL", --- 17 unchanged lines hidden (view full) --- 2513 2514 call = afs_alloc_flat_call(net, &afs_RXFSFetchACL, 16, (21 + 6) * 4); 2515 if (!call) { 2516 fc->ac.error = -ENOMEM; 2517 return ERR_PTR(-ENOMEM); 2518 } 2519 2520 call->key = fc->key; | 2454 afs_flat_call_destructor(call); 2455} 2456 2457/* 2458 * FS.FetchACL operation type 2459 */ 2460static const struct afs_call_type afs_RXFSFetchACL = { 2461 .name = "FS.FetchACL", --- 17 unchanged lines hidden (view full) --- 2479 2480 call = afs_alloc_flat_call(net, &afs_RXFSFetchACL, 16, (21 + 6) * 4); 2481 if (!call) { 2482 fc->ac.error = -ENOMEM; 2483 return ERR_PTR(-ENOMEM); 2484 } 2485 2486 call->key = fc->key; |
2521 call->reply[0] = NULL; 2522 call->reply[1] = vnode; 2523 call->reply[2] = NULL; /* volsync */ 2524 call->ret_reply0 = true; | 2487 call->ret_acl = NULL; 2488 call->xvnode = vnode; 2489 call->out_volsync = NULL; |
2525 2526 /* marshall the parameters */ 2527 bp = call->request; 2528 bp[0] = htonl(FSFETCHACL); 2529 bp[1] = htonl(vnode->fid.vid); 2530 bp[2] = htonl(vnode->fid.vnode); 2531 bp[3] = htonl(vnode->fid.unique); 2532 2533 call->cb_break = fc->cb_break; 2534 afs_use_fs_server(call, fc->cbi); 2535 trace_afs_make_fs_call(call, &vnode->fid); 2536 afs_make_call(&fc->ac, call, GFP_KERNEL); 2537 return (struct afs_acl *)afs_wait_for_call_to_complete(call, &fc->ac); 2538} 2539 2540/* | 2490 2491 /* marshall the parameters */ 2492 bp = call->request; 2493 bp[0] = htonl(FSFETCHACL); 2494 bp[1] = htonl(vnode->fid.vid); 2495 bp[2] = htonl(vnode->fid.vnode); 2496 bp[3] = htonl(vnode->fid.unique); 2497 2498 call->cb_break = fc->cb_break; 2499 afs_use_fs_server(call, fc->cbi); 2500 trace_afs_make_fs_call(call, &vnode->fid); 2501 afs_make_call(&fc->ac, call, GFP_KERNEL); 2502 return (struct afs_acl *)afs_wait_for_call_to_complete(call, &fc->ac); 2503} 2504 2505/* |
2506 * Deliver reply data to any operation that returns file status and volume 2507 * sync. 2508 */ 2509static int afs_deliver_fs_file_status_and_vol(struct afs_call *call) 2510{ 2511 struct afs_vnode *vnode = call->xvnode; 2512 const __be32 *bp; 2513 int ret; 2514 2515 _enter("{%u}", call->unmarshall); 2516 2517 ret = afs_transfer_reply(call); 2518 if (ret < 0) 2519 return ret; 2520 2521 /* unmarshall the reply once we've received all of it */ 2522 bp = call->buffer; 2523 ret = afs_decode_status(call, &bp, &vnode->status, vnode, 2524 &call->expected_version, NULL); 2525 if (ret < 0) 2526 return ret; 2527 xdr_decode_AFSVolSync(&bp, call->out_volsync); 2528 2529 _leave(" = 0 [done]"); 2530 return 0; 2531} 2532 2533/* |
|
2541 * FS.StoreACL operation type 2542 */ 2543static const struct afs_call_type afs_RXFSStoreACL = { 2544 .name = "FS.StoreACL", 2545 .op = afs_FS_StoreACL, | 2534 * FS.StoreACL operation type 2535 */ 2536static const struct afs_call_type afs_RXFSStoreACL = { 2537 .name = "FS.StoreACL", 2538 .op = afs_FS_StoreACL, |
2546 .deliver = afs_deliver_fs_status_and_vol, | 2539 .deliver = afs_deliver_fs_file_status_and_vol, |
2547 .destructor = afs_flat_call_destructor, 2548}; 2549 2550/* 2551 * Fetch the ACL for a file. 2552 */ 2553int afs_fs_store_acl(struct afs_fs_cursor *fc, const struct afs_acl *acl) 2554{ --- 10 unchanged lines hidden (view full) --- 2565 call = afs_alloc_flat_call(net, &afs_RXFSStoreACL, 2566 5 * 4 + size, (21 + 6) * 4); 2567 if (!call) { 2568 fc->ac.error = -ENOMEM; 2569 return -ENOMEM; 2570 } 2571 2572 call->key = fc->key; | 2540 .destructor = afs_flat_call_destructor, 2541}; 2542 2543/* 2544 * Fetch the ACL for a file. 2545 */ 2546int afs_fs_store_acl(struct afs_fs_cursor *fc, const struct afs_acl *acl) 2547{ --- 10 unchanged lines hidden (view full) --- 2558 call = afs_alloc_flat_call(net, &afs_RXFSStoreACL, 2559 5 * 4 + size, (21 + 6) * 4); 2560 if (!call) { 2561 fc->ac.error = -ENOMEM; 2562 return -ENOMEM; 2563 } 2564 2565 call->key = fc->key; |
2573 call->reply[0] = vnode; 2574 call->reply[2] = NULL; /* volsync */ | 2566 call->xvnode = vnode; 2567 call->out_volsync = NULL; |
2575 2576 /* marshall the parameters */ 2577 bp = call->request; 2578 bp[0] = htonl(FSSTOREACL); 2579 bp[1] = htonl(vnode->fid.vid); 2580 bp[2] = htonl(vnode->fid.vnode); 2581 bp[3] = htonl(vnode->fid.unique); 2582 bp[4] = htonl(acl->size); 2583 memcpy(&bp[5], acl->data, acl->size); 2584 if (acl->size != size) 2585 memset((void *)&bp[5] + acl->size, 0, size - acl->size); 2586 2587 trace_afs_make_fs_call(call, &vnode->fid); 2588 afs_make_call(&fc->ac, call, GFP_KERNEL); 2589 return afs_wait_for_call_to_complete(call, &fc->ac); 2590} | 2568 2569 /* marshall the parameters */ 2570 bp = call->request; 2571 bp[0] = htonl(FSSTOREACL); 2572 bp[1] = htonl(vnode->fid.vid); 2573 bp[2] = htonl(vnode->fid.vnode); 2574 bp[3] = htonl(vnode->fid.unique); 2575 bp[4] = htonl(acl->size); 2576 memcpy(&bp[5], acl->data, acl->size); 2577 if (acl->size != size) 2578 memset((void *)&bp[5] + acl->size, 0, size - acl->size); 2579 2580 trace_afs_make_fs_call(call, &vnode->fid); 2581 afs_make_call(&fc->ac, call, GFP_KERNEL); 2582 return afs_wait_for_call_to_complete(call, &fc->ac); 2583} |