1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* AFS File Server client stubs
4 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
8 #include <linux/init.h>
9 #include <linux/slab.h>
10 #include <linux/sched.h>
11 #include <linux/circ_buf.h>
12 #include <linux/iversion.h>
16 #include "protocol_yfs.h"
18 static const struct afs_fid afs_zero_fid
;
20 static inline void afs_use_fs_server(struct afs_call
*call
, struct afs_cb_interest
*cbi
)
22 call
->cbi
= afs_get_cb_interest(cbi
);
26 * decode an AFSFid block
28 static void xdr_decode_AFSFid(const __be32
**_bp
, struct afs_fid
*fid
)
30 const __be32
*bp
= *_bp
;
32 fid
->vid
= ntohl(*bp
++);
33 fid
->vnode
= ntohl(*bp
++);
34 fid
->unique
= ntohl(*bp
++);
39 * Dump a bad file status record.
41 static void xdr_dump_bad(const __be32
*bp
)
46 pr_notice("AFS XDR: Bad status record\n");
47 for (i
= 0; i
< 5 * 4 * 4; i
+= 16) {
50 pr_notice("%03x: %08x %08x %08x %08x\n",
51 i
, ntohl(x
[0]), ntohl(x
[1]), ntohl(x
[2]), ntohl(x
[3]));
55 pr_notice("0x50: %08x\n", ntohl(x
[0]));
59 * decode an AFSFetchStatus block
61 static int xdr_decode_AFSFetchStatus(const __be32
**_bp
,
62 struct afs_call
*call
,
63 struct afs_status_cb
*scb
)
65 const struct afs_xdr_AFSFetchStatus
*xdr
= (const void *)*_bp
;
66 struct afs_file_status
*status
= &scb
->status
;
67 bool inline_error
= (call
->operation_ID
== afs_FS_InlineBulkStatus
);
68 u64 data_version
, size
;
71 abort_code
= ntohl(xdr
->abort_code
);
73 if (xdr
->if_version
!= htonl(AFS_FSTATUS_VERSION
)) {
74 if (xdr
->if_version
== htonl(0) &&
77 /* The OpenAFS fileserver has a bug in FS.InlineBulkStatus
78 * whereby it doesn't set the interface version in the error
81 status
->abort_code
= abort_code
;
82 scb
->have_error
= true;
86 pr_warn("Unknown AFSFetchStatus version %u\n", ntohl(xdr
->if_version
));
90 if (abort_code
!= 0 && inline_error
) {
91 status
->abort_code
= abort_code
;
95 type
= ntohl(xdr
->type
);
99 case AFS_FTYPE_SYMLINK
:
106 status
->nlink
= ntohl(xdr
->nlink
);
107 status
->author
= ntohl(xdr
->author
);
108 status
->owner
= ntohl(xdr
->owner
);
109 status
->caller_access
= ntohl(xdr
->caller_access
); /* Ticket dependent */
110 status
->anon_access
= ntohl(xdr
->anon_access
);
111 status
->mode
= ntohl(xdr
->mode
) & S_IALLUGO
;
112 status
->group
= ntohl(xdr
->group
);
113 status
->lock_count
= ntohl(xdr
->lock_count
);
115 status
->mtime_client
.tv_sec
= ntohl(xdr
->mtime_client
);
116 status
->mtime_client
.tv_nsec
= 0;
117 status
->mtime_server
.tv_sec
= ntohl(xdr
->mtime_server
);
118 status
->mtime_server
.tv_nsec
= 0;
120 size
= (u64
)ntohl(xdr
->size_lo
);
121 size
|= (u64
)ntohl(xdr
->size_hi
) << 32;
124 data_version
= (u64
)ntohl(xdr
->data_version_lo
);
125 data_version
|= (u64
)ntohl(xdr
->data_version_hi
) << 32;
126 status
->data_version
= data_version
;
127 scb
->have_status
= true;
129 *_bp
= (const void *)*_bp
+ sizeof(*xdr
);
134 return afs_protocol_error(call
, -EBADMSG
, afs_eproto_bad_status
);
137 static time64_t
xdr_decode_expiry(struct afs_call
*call
, u32 expiry
)
139 return ktime_divns(call
->reply_time
, NSEC_PER_SEC
) + expiry
;
142 static void xdr_decode_AFSCallBack(const __be32
**_bp
,
143 struct afs_call
*call
,
144 struct afs_status_cb
*scb
)
146 struct afs_callback
*cb
= &scb
->callback
;
147 const __be32
*bp
= *_bp
;
150 cb
->expires_at
= xdr_decode_expiry(call
, ntohl(*bp
++));
157 * decode an AFSVolSync block
159 static void xdr_decode_AFSVolSync(const __be32
**_bp
,
160 struct afs_volsync
*volsync
)
162 const __be32
*bp
= *_bp
;
165 creation
= ntohl(*bp
++);
174 volsync
->creation
= creation
;
178 * encode the requested attributes into an AFSStoreStatus block
180 static void xdr_encode_AFS_StoreStatus(__be32
**_bp
, struct iattr
*attr
)
183 u32 mask
= 0, mtime
= 0, owner
= 0, group
= 0, mode
= 0;
186 if (attr
->ia_valid
& ATTR_MTIME
) {
187 mask
|= AFS_SET_MTIME
;
188 mtime
= attr
->ia_mtime
.tv_sec
;
191 if (attr
->ia_valid
& ATTR_UID
) {
192 mask
|= AFS_SET_OWNER
;
193 owner
= from_kuid(&init_user_ns
, attr
->ia_uid
);
196 if (attr
->ia_valid
& ATTR_GID
) {
197 mask
|= AFS_SET_GROUP
;
198 group
= from_kgid(&init_user_ns
, attr
->ia_gid
);
201 if (attr
->ia_valid
& ATTR_MODE
) {
202 mask
|= AFS_SET_MODE
;
203 mode
= attr
->ia_mode
& S_IALLUGO
;
207 *bp
++ = htonl(mtime
);
208 *bp
++ = htonl(owner
);
209 *bp
++ = htonl(group
);
211 *bp
++ = 0; /* segment size */
216 * decode an AFSFetchVolumeStatus block
218 static void xdr_decode_AFSFetchVolumeStatus(const __be32
**_bp
,
219 struct afs_volume_status
*vs
)
221 const __be32
*bp
= *_bp
;
223 vs
->vid
= ntohl(*bp
++);
224 vs
->parent_id
= ntohl(*bp
++);
225 vs
->online
= ntohl(*bp
++);
226 vs
->in_service
= ntohl(*bp
++);
227 vs
->blessed
= ntohl(*bp
++);
228 vs
->needs_salvage
= ntohl(*bp
++);
229 vs
->type
= ntohl(*bp
++);
230 vs
->min_quota
= ntohl(*bp
++);
231 vs
->max_quota
= ntohl(*bp
++);
232 vs
->blocks_in_use
= ntohl(*bp
++);
233 vs
->part_blocks_avail
= ntohl(*bp
++);
234 vs
->part_max_blocks
= ntohl(*bp
++);
235 vs
->vol_copy_date
= 0;
236 vs
->vol_backup_date
= 0;
241 * deliver reply data to an FS.FetchStatus
243 static int afs_deliver_fs_fetch_status_vnode(struct afs_call
*call
)
248 ret
= afs_transfer_reply(call
);
252 /* unmarshall the reply once we've received all of it */
254 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
257 xdr_decode_AFSCallBack(&bp
, call
, call
->out_scb
);
258 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
260 _leave(" = 0 [done]");
265 * FS.FetchStatus operation type
267 static const struct afs_call_type afs_RXFSFetchStatus_vnode
= {
268 .name
= "FS.FetchStatus(vnode)",
269 .op
= afs_FS_FetchStatus
,
270 .deliver
= afs_deliver_fs_fetch_status_vnode
,
271 .destructor
= afs_flat_call_destructor
,
275 * fetch the status information for a file
277 int afs_fs_fetch_file_status(struct afs_fs_cursor
*fc
, struct afs_status_cb
*scb
,
278 struct afs_volsync
*volsync
)
280 struct afs_vnode
*vnode
= fc
->vnode
;
281 struct afs_call
*call
;
282 struct afs_net
*net
= afs_v2net(vnode
);
285 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
286 return yfs_fs_fetch_file_status(fc
, scb
, volsync
);
288 _enter(",%x,{%llx:%llu},,",
289 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
291 call
= afs_alloc_flat_call(net
, &afs_RXFSFetchStatus_vnode
,
292 16, (21 + 3 + 6) * 4);
294 fc
->ac
.error
= -ENOMEM
;
300 call
->out_volsync
= volsync
;
302 /* marshall the parameters */
304 bp
[0] = htonl(FSFETCHSTATUS
);
305 bp
[1] = htonl(vnode
->fid
.vid
);
306 bp
[2] = htonl(vnode
->fid
.vnode
);
307 bp
[3] = htonl(vnode
->fid
.unique
);
309 afs_use_fs_server(call
, fc
->cbi
);
310 trace_afs_make_fs_call(call
, &vnode
->fid
);
312 afs_set_fc_call(call
, fc
);
313 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
314 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
318 * deliver reply data to an FS.FetchData
320 static int afs_deliver_fs_fetch_data(struct afs_call
*call
)
322 struct afs_read
*req
= call
->read_request
;
327 _enter("{%u,%zu/%llu}",
328 call
->unmarshall
, iov_iter_count(&call
->iter
), req
->actual_len
);
330 switch (call
->unmarshall
) {
334 req
->offset
= req
->pos
& (PAGE_SIZE
- 1);
336 if (call
->operation_ID
== FSFETCHDATA64
) {
337 afs_extract_to_tmp64(call
);
339 call
->tmp_u
= htonl(0);
340 afs_extract_to_tmp(call
);
343 /* Fall through - and extract the returned data length */
345 _debug("extract data length");
346 ret
= afs_extract_data(call
, true);
350 req
->actual_len
= be64_to_cpu(call
->tmp64
);
351 _debug("DATA length: %llu", req
->actual_len
);
352 req
->remain
= min(req
->len
, req
->actual_len
);
353 if (req
->remain
== 0)
359 ASSERTCMP(req
->index
, <, req
->nr_pages
);
360 if (req
->remain
> PAGE_SIZE
- req
->offset
)
361 size
= PAGE_SIZE
- req
->offset
;
364 call
->bvec
[0].bv_len
= size
;
365 call
->bvec
[0].bv_offset
= req
->offset
;
366 call
->bvec
[0].bv_page
= req
->pages
[req
->index
];
367 iov_iter_bvec(&call
->iter
, READ
, call
->bvec
, 1, size
);
368 ASSERTCMP(size
, <=, PAGE_SIZE
);
370 /* Fall through - and extract the returned data */
372 _debug("extract data %zu/%llu",
373 iov_iter_count(&call
->iter
), req
->remain
);
375 ret
= afs_extract_data(call
, true);
378 req
->remain
-= call
->bvec
[0].bv_len
;
379 req
->offset
+= call
->bvec
[0].bv_len
;
380 ASSERTCMP(req
->offset
, <=, PAGE_SIZE
);
381 if (req
->offset
== PAGE_SIZE
) {
390 ASSERTCMP(req
->remain
, ==, 0);
391 if (req
->actual_len
<= req
->len
)
394 /* Discard any excess data the server gave us */
395 iov_iter_discard(&call
->iter
, READ
, req
->actual_len
- req
->len
);
396 call
->unmarshall
= 3;
400 _debug("extract discard %zu/%llu",
401 iov_iter_count(&call
->iter
), req
->actual_len
- req
->len
);
403 ret
= afs_extract_data(call
, true);
408 call
->unmarshall
= 4;
409 afs_extract_to_buf(call
, (21 + 3 + 6) * 4);
411 /* Fall through - and extract the metadata */
413 ret
= afs_extract_data(call
, false);
418 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
421 xdr_decode_AFSCallBack(&bp
, call
, call
->out_scb
);
422 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
424 req
->data_version
= call
->out_scb
->status
.data_version
;
425 req
->file_size
= call
->out_scb
->status
.size
;
433 for (; req
->index
< req
->nr_pages
; req
->index
++) {
434 if (req
->offset
< PAGE_SIZE
)
435 zero_user_segment(req
->pages
[req
->index
],
436 req
->offset
, PAGE_SIZE
);
442 _leave(" = 0 [done]");
446 static void afs_fetch_data_destructor(struct afs_call
*call
)
448 struct afs_read
*req
= call
->read_request
;
451 afs_flat_call_destructor(call
);
455 * FS.FetchData operation type
457 static const struct afs_call_type afs_RXFSFetchData
= {
458 .name
= "FS.FetchData",
459 .op
= afs_FS_FetchData
,
460 .deliver
= afs_deliver_fs_fetch_data
,
461 .destructor
= afs_fetch_data_destructor
,
464 static const struct afs_call_type afs_RXFSFetchData64
= {
465 .name
= "FS.FetchData64",
466 .op
= afs_FS_FetchData64
,
467 .deliver
= afs_deliver_fs_fetch_data
,
468 .destructor
= afs_fetch_data_destructor
,
472 * fetch data from a very large file
474 static int afs_fs_fetch_data64(struct afs_fs_cursor
*fc
,
475 struct afs_status_cb
*scb
,
476 struct afs_read
*req
)
478 struct afs_vnode
*vnode
= fc
->vnode
;
479 struct afs_call
*call
;
480 struct afs_net
*net
= afs_v2net(vnode
);
485 call
= afs_alloc_flat_call(net
, &afs_RXFSFetchData64
, 32, (21 + 3 + 6) * 4);
491 call
->out_volsync
= NULL
;
492 call
->read_request
= req
;
494 /* marshall the parameters */
496 bp
[0] = htonl(FSFETCHDATA64
);
497 bp
[1] = htonl(vnode
->fid
.vid
);
498 bp
[2] = htonl(vnode
->fid
.vnode
);
499 bp
[3] = htonl(vnode
->fid
.unique
);
500 bp
[4] = htonl(upper_32_bits(req
->pos
));
501 bp
[5] = htonl(lower_32_bits(req
->pos
));
503 bp
[7] = htonl(lower_32_bits(req
->len
));
505 refcount_inc(&req
->usage
);
506 afs_use_fs_server(call
, fc
->cbi
);
507 trace_afs_make_fs_call(call
, &vnode
->fid
);
508 afs_set_fc_call(call
, fc
);
509 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
510 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
514 * fetch data from a file
516 int afs_fs_fetch_data(struct afs_fs_cursor
*fc
,
517 struct afs_status_cb
*scb
,
518 struct afs_read
*req
)
520 struct afs_vnode
*vnode
= fc
->vnode
;
521 struct afs_call
*call
;
522 struct afs_net
*net
= afs_v2net(vnode
);
525 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
526 return yfs_fs_fetch_data(fc
, scb
, req
);
528 if (upper_32_bits(req
->pos
) ||
529 upper_32_bits(req
->len
) ||
530 upper_32_bits(req
->pos
+ req
->len
))
531 return afs_fs_fetch_data64(fc
, scb
, req
);
535 call
= afs_alloc_flat_call(net
, &afs_RXFSFetchData
, 24, (21 + 3 + 6) * 4);
541 call
->out_volsync
= NULL
;
542 call
->read_request
= req
;
544 /* marshall the parameters */
546 bp
[0] = htonl(FSFETCHDATA
);
547 bp
[1] = htonl(vnode
->fid
.vid
);
548 bp
[2] = htonl(vnode
->fid
.vnode
);
549 bp
[3] = htonl(vnode
->fid
.unique
);
550 bp
[4] = htonl(lower_32_bits(req
->pos
));
551 bp
[5] = htonl(lower_32_bits(req
->len
));
553 refcount_inc(&req
->usage
);
554 afs_use_fs_server(call
, fc
->cbi
);
555 trace_afs_make_fs_call(call
, &vnode
->fid
);
556 afs_set_fc_call(call
, fc
);
557 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
558 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
562 * deliver reply data to an FS.CreateFile or an FS.MakeDir
564 static int afs_deliver_fs_create_vnode(struct afs_call
*call
)
569 ret
= afs_transfer_reply(call
);
573 /* unmarshall the reply once we've received all of it */
575 xdr_decode_AFSFid(&bp
, call
->out_fid
);
576 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
579 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_dir_scb
);
582 xdr_decode_AFSCallBack(&bp
, call
, call
->out_scb
);
583 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
585 _leave(" = 0 [done]");
590 * FS.CreateFile and FS.MakeDir operation type
592 static const struct afs_call_type afs_RXFSCreateFile
= {
593 .name
= "FS.CreateFile",
594 .op
= afs_FS_CreateFile
,
595 .deliver
= afs_deliver_fs_create_vnode
,
596 .destructor
= afs_flat_call_destructor
,
599 static const struct afs_call_type afs_RXFSMakeDir
= {
600 .name
= "FS.MakeDir",
601 .op
= afs_FS_MakeDir
,
602 .deliver
= afs_deliver_fs_create_vnode
,
603 .destructor
= afs_flat_call_destructor
,
607 * create a file or make a directory
609 int afs_fs_create(struct afs_fs_cursor
*fc
,
612 struct afs_status_cb
*dvnode_scb
,
613 struct afs_fid
*newfid
,
614 struct afs_status_cb
*new_scb
)
616 struct afs_vnode
*dvnode
= fc
->vnode
;
617 struct afs_call
*call
;
618 struct afs_net
*net
= afs_v2net(dvnode
);
619 size_t namesz
, reqsz
, padsz
;
622 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
)){
624 return yfs_fs_make_dir(fc
, name
, mode
, dvnode_scb
,
627 return yfs_fs_create_file(fc
, name
, mode
, dvnode_scb
,
633 namesz
= strlen(name
);
634 padsz
= (4 - (namesz
& 3)) & 3;
635 reqsz
= (5 * 4) + namesz
+ padsz
+ (6 * 4);
637 call
= afs_alloc_flat_call(
638 net
, S_ISDIR(mode
) ? &afs_RXFSMakeDir
: &afs_RXFSCreateFile
,
639 reqsz
, (3 + 21 + 21 + 3 + 6) * 4);
644 call
->out_dir_scb
= dvnode_scb
;
645 call
->out_fid
= newfid
;
646 call
->out_scb
= new_scb
;
648 /* marshall the parameters */
650 *bp
++ = htonl(S_ISDIR(mode
) ? FSMAKEDIR
: FSCREATEFILE
);
651 *bp
++ = htonl(dvnode
->fid
.vid
);
652 *bp
++ = htonl(dvnode
->fid
.vnode
);
653 *bp
++ = htonl(dvnode
->fid
.unique
);
654 *bp
++ = htonl(namesz
);
655 memcpy(bp
, name
, namesz
);
656 bp
= (void *) bp
+ namesz
;
658 memset(bp
, 0, padsz
);
659 bp
= (void *) bp
+ padsz
;
661 *bp
++ = htonl(AFS_SET_MODE
| AFS_SET_MTIME
);
662 *bp
++ = htonl(dvnode
->vfs_inode
.i_mtime
.tv_sec
); /* mtime */
663 *bp
++ = 0; /* owner */
664 *bp
++ = 0; /* group */
665 *bp
++ = htonl(mode
& S_IALLUGO
); /* unix mode */
666 *bp
++ = 0; /* segment size */
668 afs_use_fs_server(call
, fc
->cbi
);
669 trace_afs_make_fs_call1(call
, &dvnode
->fid
, name
);
670 afs_set_fc_call(call
, fc
);
671 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
672 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
676 * Deliver reply data to any operation that returns directory status and volume
679 static int afs_deliver_fs_dir_status_and_vol(struct afs_call
*call
)
684 ret
= afs_transfer_reply(call
);
688 /* unmarshall the reply once we've received all of it */
690 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_dir_scb
);
693 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
695 _leave(" = 0 [done]");
700 * FS.RemoveDir/FS.RemoveFile operation type
702 static const struct afs_call_type afs_RXFSRemoveFile
= {
703 .name
= "FS.RemoveFile",
704 .op
= afs_FS_RemoveFile
,
705 .deliver
= afs_deliver_fs_dir_status_and_vol
,
706 .destructor
= afs_flat_call_destructor
,
709 static const struct afs_call_type afs_RXFSRemoveDir
= {
710 .name
= "FS.RemoveDir",
711 .op
= afs_FS_RemoveDir
,
712 .deliver
= afs_deliver_fs_dir_status_and_vol
,
713 .destructor
= afs_flat_call_destructor
,
717 * remove a file or directory
719 int afs_fs_remove(struct afs_fs_cursor
*fc
, struct afs_vnode
*vnode
,
720 const char *name
, bool isdir
, struct afs_status_cb
*dvnode_scb
)
722 struct afs_vnode
*dvnode
= fc
->vnode
;
723 struct afs_call
*call
;
724 struct afs_net
*net
= afs_v2net(dvnode
);
725 size_t namesz
, reqsz
, padsz
;
728 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
729 return yfs_fs_remove(fc
, vnode
, name
, isdir
, dvnode_scb
);
733 namesz
= strlen(name
);
734 padsz
= (4 - (namesz
& 3)) & 3;
735 reqsz
= (5 * 4) + namesz
+ padsz
;
737 call
= afs_alloc_flat_call(
738 net
, isdir
? &afs_RXFSRemoveDir
: &afs_RXFSRemoveFile
,
739 reqsz
, (21 + 6) * 4);
744 call
->out_dir_scb
= dvnode_scb
;
746 /* marshall the parameters */
748 *bp
++ = htonl(isdir
? FSREMOVEDIR
: FSREMOVEFILE
);
749 *bp
++ = htonl(dvnode
->fid
.vid
);
750 *bp
++ = htonl(dvnode
->fid
.vnode
);
751 *bp
++ = htonl(dvnode
->fid
.unique
);
752 *bp
++ = htonl(namesz
);
753 memcpy(bp
, name
, namesz
);
754 bp
= (void *) bp
+ namesz
;
756 memset(bp
, 0, padsz
);
757 bp
= (void *) bp
+ padsz
;
760 afs_use_fs_server(call
, fc
->cbi
);
761 trace_afs_make_fs_call1(call
, &dvnode
->fid
, name
);
762 afs_set_fc_call(call
, fc
);
763 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
764 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
768 * deliver reply data to an FS.Link
770 static int afs_deliver_fs_link(struct afs_call
*call
)
775 _enter("{%u}", call
->unmarshall
);
777 ret
= afs_transfer_reply(call
);
781 /* unmarshall the reply once we've received all of it */
783 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
786 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_dir_scb
);
789 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
791 _leave(" = 0 [done]");
796 * FS.Link operation type
798 static const struct afs_call_type afs_RXFSLink
= {
801 .deliver
= afs_deliver_fs_link
,
802 .destructor
= afs_flat_call_destructor
,
808 int afs_fs_link(struct afs_fs_cursor
*fc
, struct afs_vnode
*vnode
,
810 struct afs_status_cb
*dvnode_scb
,
811 struct afs_status_cb
*vnode_scb
)
813 struct afs_vnode
*dvnode
= fc
->vnode
;
814 struct afs_call
*call
;
815 struct afs_net
*net
= afs_v2net(vnode
);
816 size_t namesz
, reqsz
, padsz
;
819 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
820 return yfs_fs_link(fc
, vnode
, name
, dvnode_scb
, vnode_scb
);
824 namesz
= strlen(name
);
825 padsz
= (4 - (namesz
& 3)) & 3;
826 reqsz
= (5 * 4) + namesz
+ padsz
+ (3 * 4);
828 call
= afs_alloc_flat_call(net
, &afs_RXFSLink
, reqsz
, (21 + 21 + 6) * 4);
833 call
->out_dir_scb
= dvnode_scb
;
834 call
->out_scb
= vnode_scb
;
836 /* marshall the parameters */
838 *bp
++ = htonl(FSLINK
);
839 *bp
++ = htonl(dvnode
->fid
.vid
);
840 *bp
++ = htonl(dvnode
->fid
.vnode
);
841 *bp
++ = htonl(dvnode
->fid
.unique
);
842 *bp
++ = htonl(namesz
);
843 memcpy(bp
, name
, namesz
);
844 bp
= (void *) bp
+ namesz
;
846 memset(bp
, 0, padsz
);
847 bp
= (void *) bp
+ padsz
;
849 *bp
++ = htonl(vnode
->fid
.vid
);
850 *bp
++ = htonl(vnode
->fid
.vnode
);
851 *bp
++ = htonl(vnode
->fid
.unique
);
853 afs_use_fs_server(call
, fc
->cbi
);
854 trace_afs_make_fs_call1(call
, &vnode
->fid
, name
);
855 afs_set_fc_call(call
, fc
);
856 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
857 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
861 * deliver reply data to an FS.Symlink
863 static int afs_deliver_fs_symlink(struct afs_call
*call
)
868 _enter("{%u}", call
->unmarshall
);
870 ret
= afs_transfer_reply(call
);
874 /* unmarshall the reply once we've received all of it */
876 xdr_decode_AFSFid(&bp
, call
->out_fid
);
877 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
880 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_dir_scb
);
883 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
885 _leave(" = 0 [done]");
890 * FS.Symlink operation type
892 static const struct afs_call_type afs_RXFSSymlink
= {
893 .name
= "FS.Symlink",
894 .op
= afs_FS_Symlink
,
895 .deliver
= afs_deliver_fs_symlink
,
896 .destructor
= afs_flat_call_destructor
,
900 * create a symbolic link
902 int afs_fs_symlink(struct afs_fs_cursor
*fc
,
904 const char *contents
,
905 struct afs_status_cb
*dvnode_scb
,
906 struct afs_fid
*newfid
,
907 struct afs_status_cb
*new_scb
)
909 struct afs_vnode
*dvnode
= fc
->vnode
;
910 struct afs_call
*call
;
911 struct afs_net
*net
= afs_v2net(dvnode
);
912 size_t namesz
, reqsz
, padsz
, c_namesz
, c_padsz
;
915 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
916 return yfs_fs_symlink(fc
, name
, contents
, dvnode_scb
,
921 namesz
= strlen(name
);
922 padsz
= (4 - (namesz
& 3)) & 3;
924 c_namesz
= strlen(contents
);
925 c_padsz
= (4 - (c_namesz
& 3)) & 3;
927 reqsz
= (6 * 4) + namesz
+ padsz
+ c_namesz
+ c_padsz
+ (6 * 4);
929 call
= afs_alloc_flat_call(net
, &afs_RXFSSymlink
, reqsz
,
930 (3 + 21 + 21 + 6) * 4);
935 call
->out_dir_scb
= dvnode_scb
;
936 call
->out_fid
= newfid
;
937 call
->out_scb
= new_scb
;
939 /* marshall the parameters */
941 *bp
++ = htonl(FSSYMLINK
);
942 *bp
++ = htonl(dvnode
->fid
.vid
);
943 *bp
++ = htonl(dvnode
->fid
.vnode
);
944 *bp
++ = htonl(dvnode
->fid
.unique
);
945 *bp
++ = htonl(namesz
);
946 memcpy(bp
, name
, namesz
);
947 bp
= (void *) bp
+ namesz
;
949 memset(bp
, 0, padsz
);
950 bp
= (void *) bp
+ padsz
;
952 *bp
++ = htonl(c_namesz
);
953 memcpy(bp
, contents
, c_namesz
);
954 bp
= (void *) bp
+ c_namesz
;
956 memset(bp
, 0, c_padsz
);
957 bp
= (void *) bp
+ c_padsz
;
959 *bp
++ = htonl(AFS_SET_MODE
| AFS_SET_MTIME
);
960 *bp
++ = htonl(dvnode
->vfs_inode
.i_mtime
.tv_sec
); /* mtime */
961 *bp
++ = 0; /* owner */
962 *bp
++ = 0; /* group */
963 *bp
++ = htonl(S_IRWXUGO
); /* unix mode */
964 *bp
++ = 0; /* segment size */
966 afs_use_fs_server(call
, fc
->cbi
);
967 trace_afs_make_fs_call1(call
, &dvnode
->fid
, name
);
968 afs_set_fc_call(call
, fc
);
969 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
970 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
974 * deliver reply data to an FS.Rename
976 static int afs_deliver_fs_rename(struct afs_call
*call
)
981 ret
= afs_transfer_reply(call
);
985 /* unmarshall the reply once we've received all of it */
987 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_dir_scb
);
990 if (call
->out_dir_scb
!= call
->out_scb
) {
991 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
995 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
997 _leave(" = 0 [done]");
1002 * FS.Rename operation type
1004 static const struct afs_call_type afs_RXFSRename
= {
1005 .name
= "FS.Rename",
1006 .op
= afs_FS_Rename
,
1007 .deliver
= afs_deliver_fs_rename
,
1008 .destructor
= afs_flat_call_destructor
,
1012 * Rename/move a file or directory.
1014 int afs_fs_rename(struct afs_fs_cursor
*fc
,
1015 const char *orig_name
,
1016 struct afs_vnode
*new_dvnode
,
1017 const char *new_name
,
1018 struct afs_status_cb
*orig_dvnode_scb
,
1019 struct afs_status_cb
*new_dvnode_scb
)
1021 struct afs_vnode
*orig_dvnode
= fc
->vnode
;
1022 struct afs_call
*call
;
1023 struct afs_net
*net
= afs_v2net(orig_dvnode
);
1024 size_t reqsz
, o_namesz
, o_padsz
, n_namesz
, n_padsz
;
1027 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1028 return yfs_fs_rename(fc
, orig_name
,
1029 new_dvnode
, new_name
,
1035 o_namesz
= strlen(orig_name
);
1036 o_padsz
= (4 - (o_namesz
& 3)) & 3;
1038 n_namesz
= strlen(new_name
);
1039 n_padsz
= (4 - (n_namesz
& 3)) & 3;
1042 4 + o_namesz
+ o_padsz
+
1044 4 + n_namesz
+ n_padsz
;
1046 call
= afs_alloc_flat_call(net
, &afs_RXFSRename
, reqsz
, (21 + 21 + 6) * 4);
1050 call
->key
= fc
->key
;
1051 call
->out_dir_scb
= orig_dvnode_scb
;
1052 call
->out_scb
= new_dvnode_scb
;
1054 /* marshall the parameters */
1056 *bp
++ = htonl(FSRENAME
);
1057 *bp
++ = htonl(orig_dvnode
->fid
.vid
);
1058 *bp
++ = htonl(orig_dvnode
->fid
.vnode
);
1059 *bp
++ = htonl(orig_dvnode
->fid
.unique
);
1060 *bp
++ = htonl(o_namesz
);
1061 memcpy(bp
, orig_name
, o_namesz
);
1062 bp
= (void *) bp
+ o_namesz
;
1064 memset(bp
, 0, o_padsz
);
1065 bp
= (void *) bp
+ o_padsz
;
1068 *bp
++ = htonl(new_dvnode
->fid
.vid
);
1069 *bp
++ = htonl(new_dvnode
->fid
.vnode
);
1070 *bp
++ = htonl(new_dvnode
->fid
.unique
);
1071 *bp
++ = htonl(n_namesz
);
1072 memcpy(bp
, new_name
, n_namesz
);
1073 bp
= (void *) bp
+ n_namesz
;
1075 memset(bp
, 0, n_padsz
);
1076 bp
= (void *) bp
+ n_padsz
;
1079 afs_use_fs_server(call
, fc
->cbi
);
1080 trace_afs_make_fs_call2(call
, &orig_dvnode
->fid
, orig_name
, new_name
);
1081 afs_set_fc_call(call
, fc
);
1082 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1083 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1087 * deliver reply data to an FS.StoreData
1089 static int afs_deliver_fs_store_data(struct afs_call
*call
)
1096 ret
= afs_transfer_reply(call
);
1100 /* unmarshall the reply once we've received all of it */
1102 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
1105 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
1107 _leave(" = 0 [done]");
1112 * FS.StoreData operation type
1114 static const struct afs_call_type afs_RXFSStoreData
= {
1115 .name
= "FS.StoreData",
1116 .op
= afs_FS_StoreData
,
1117 .deliver
= afs_deliver_fs_store_data
,
1118 .destructor
= afs_flat_call_destructor
,
1121 static const struct afs_call_type afs_RXFSStoreData64
= {
1122 .name
= "FS.StoreData64",
1123 .op
= afs_FS_StoreData64
,
1124 .deliver
= afs_deliver_fs_store_data
,
1125 .destructor
= afs_flat_call_destructor
,
1129 * store a set of pages to a very large file
1131 static int afs_fs_store_data64(struct afs_fs_cursor
*fc
,
1132 struct address_space
*mapping
,
1133 pgoff_t first
, pgoff_t last
,
1134 unsigned offset
, unsigned to
,
1135 loff_t size
, loff_t pos
, loff_t i_size
,
1136 struct afs_status_cb
*scb
)
1138 struct afs_vnode
*vnode
= fc
->vnode
;
1139 struct afs_call
*call
;
1140 struct afs_net
*net
= afs_v2net(vnode
);
1143 _enter(",%x,{%llx:%llu},,",
1144 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
1146 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreData64
,
1147 (4 + 6 + 3 * 2) * 4,
1152 call
->key
= fc
->key
;
1153 call
->mapping
= mapping
;
1154 call
->first
= first
;
1156 call
->first_offset
= offset
;
1158 call
->send_pages
= true;
1159 call
->out_scb
= scb
;
1161 /* marshall the parameters */
1163 *bp
++ = htonl(FSSTOREDATA64
);
1164 *bp
++ = htonl(vnode
->fid
.vid
);
1165 *bp
++ = htonl(vnode
->fid
.vnode
);
1166 *bp
++ = htonl(vnode
->fid
.unique
);
1168 *bp
++ = htonl(AFS_SET_MTIME
); /* mask */
1169 *bp
++ = htonl(vnode
->vfs_inode
.i_mtime
.tv_sec
); /* mtime */
1170 *bp
++ = 0; /* owner */
1171 *bp
++ = 0; /* group */
1172 *bp
++ = 0; /* unix mode */
1173 *bp
++ = 0; /* segment size */
1175 *bp
++ = htonl(pos
>> 32);
1176 *bp
++ = htonl((u32
) pos
);
1177 *bp
++ = htonl(size
>> 32);
1178 *bp
++ = htonl((u32
) size
);
1179 *bp
++ = htonl(i_size
>> 32);
1180 *bp
++ = htonl((u32
) i_size
);
1182 trace_afs_make_fs_call(call
, &vnode
->fid
);
1183 afs_set_fc_call(call
, fc
);
1184 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1185 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1189 * store a set of pages
1191 int afs_fs_store_data(struct afs_fs_cursor
*fc
, struct address_space
*mapping
,
1192 pgoff_t first
, pgoff_t last
,
1193 unsigned offset
, unsigned to
,
1194 struct afs_status_cb
*scb
)
1196 struct afs_vnode
*vnode
= fc
->vnode
;
1197 struct afs_call
*call
;
1198 struct afs_net
*net
= afs_v2net(vnode
);
1199 loff_t size
, pos
, i_size
;
1202 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1203 return yfs_fs_store_data(fc
, mapping
, first
, last
, offset
, to
, scb
);
1205 _enter(",%x,{%llx:%llu},,",
1206 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
1208 size
= (loff_t
)to
- (loff_t
)offset
;
1210 size
+= (loff_t
)(last
- first
) << PAGE_SHIFT
;
1211 pos
= (loff_t
)first
<< PAGE_SHIFT
;
1214 i_size
= i_size_read(&vnode
->vfs_inode
);
1215 if (pos
+ size
> i_size
)
1216 i_size
= size
+ pos
;
1218 _debug("size %llx, at %llx, i_size %llx",
1219 (unsigned long long) size
, (unsigned long long) pos
,
1220 (unsigned long long) i_size
);
1222 if (pos
>> 32 || i_size
>> 32 || size
>> 32 || (pos
+ size
) >> 32)
1223 return afs_fs_store_data64(fc
, mapping
, first
, last
, offset
, to
,
1224 size
, pos
, i_size
, scb
);
1226 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreData
,
1232 call
->key
= fc
->key
;
1233 call
->mapping
= mapping
;
1234 call
->first
= first
;
1236 call
->first_offset
= offset
;
1238 call
->send_pages
= true;
1239 call
->out_scb
= scb
;
1241 /* marshall the parameters */
1243 *bp
++ = htonl(FSSTOREDATA
);
1244 *bp
++ = htonl(vnode
->fid
.vid
);
1245 *bp
++ = htonl(vnode
->fid
.vnode
);
1246 *bp
++ = htonl(vnode
->fid
.unique
);
1248 *bp
++ = htonl(AFS_SET_MTIME
); /* mask */
1249 *bp
++ = htonl(vnode
->vfs_inode
.i_mtime
.tv_sec
); /* mtime */
1250 *bp
++ = 0; /* owner */
1251 *bp
++ = 0; /* group */
1252 *bp
++ = 0; /* unix mode */
1253 *bp
++ = 0; /* segment size */
1256 *bp
++ = htonl(size
);
1257 *bp
++ = htonl(i_size
);
1259 afs_use_fs_server(call
, fc
->cbi
);
1260 trace_afs_make_fs_call(call
, &vnode
->fid
);
1261 afs_set_fc_call(call
, fc
);
1262 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1263 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1267 * deliver reply data to an FS.StoreStatus
1269 static int afs_deliver_fs_store_status(struct afs_call
*call
)
1276 ret
= afs_transfer_reply(call
);
1280 /* unmarshall the reply once we've received all of it */
1282 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
1285 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
1287 _leave(" = 0 [done]");
1292 * FS.StoreStatus operation type
1294 static const struct afs_call_type afs_RXFSStoreStatus
= {
1295 .name
= "FS.StoreStatus",
1296 .op
= afs_FS_StoreStatus
,
1297 .deliver
= afs_deliver_fs_store_status
,
1298 .destructor
= afs_flat_call_destructor
,
1301 static const struct afs_call_type afs_RXFSStoreData_as_Status
= {
1302 .name
= "FS.StoreData",
1303 .op
= afs_FS_StoreData
,
1304 .deliver
= afs_deliver_fs_store_status
,
1305 .destructor
= afs_flat_call_destructor
,
1308 static const struct afs_call_type afs_RXFSStoreData64_as_Status
= {
1309 .name
= "FS.StoreData64",
1310 .op
= afs_FS_StoreData64
,
1311 .deliver
= afs_deliver_fs_store_status
,
1312 .destructor
= afs_flat_call_destructor
,
1316 * set the attributes on a very large file, using FS.StoreData rather than
1317 * FS.StoreStatus so as to alter the file size also
1319 static int afs_fs_setattr_size64(struct afs_fs_cursor
*fc
, struct iattr
*attr
,
1320 struct afs_status_cb
*scb
)
1322 struct afs_vnode
*vnode
= fc
->vnode
;
1323 struct afs_call
*call
;
1324 struct afs_net
*net
= afs_v2net(vnode
);
1327 _enter(",%x,{%llx:%llu},,",
1328 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
1330 ASSERT(attr
->ia_valid
& ATTR_SIZE
);
1332 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreData64_as_Status
,
1333 (4 + 6 + 3 * 2) * 4,
1338 call
->key
= fc
->key
;
1339 call
->out_scb
= scb
;
1341 /* marshall the parameters */
1343 *bp
++ = htonl(FSSTOREDATA64
);
1344 *bp
++ = htonl(vnode
->fid
.vid
);
1345 *bp
++ = htonl(vnode
->fid
.vnode
);
1346 *bp
++ = htonl(vnode
->fid
.unique
);
1348 xdr_encode_AFS_StoreStatus(&bp
, attr
);
1350 *bp
++ = htonl(attr
->ia_size
>> 32); /* position of start of write */
1351 *bp
++ = htonl((u32
) attr
->ia_size
);
1352 *bp
++ = 0; /* size of write */
1354 *bp
++ = htonl(attr
->ia_size
>> 32); /* new file length */
1355 *bp
++ = htonl((u32
) attr
->ia_size
);
1357 afs_use_fs_server(call
, fc
->cbi
);
1358 trace_afs_make_fs_call(call
, &vnode
->fid
);
1359 afs_set_fc_call(call
, fc
);
1360 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1361 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1365 * set the attributes on a file, using FS.StoreData rather than FS.StoreStatus
1366 * so as to alter the file size also
1368 static int afs_fs_setattr_size(struct afs_fs_cursor
*fc
, struct iattr
*attr
,
1369 struct afs_status_cb
*scb
)
1371 struct afs_vnode
*vnode
= fc
->vnode
;
1372 struct afs_call
*call
;
1373 struct afs_net
*net
= afs_v2net(vnode
);
1376 _enter(",%x,{%llx:%llu},,",
1377 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
1379 ASSERT(attr
->ia_valid
& ATTR_SIZE
);
1380 if (attr
->ia_size
>> 32)
1381 return afs_fs_setattr_size64(fc
, attr
, scb
);
1383 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreData_as_Status
,
1389 call
->key
= fc
->key
;
1390 call
->out_scb
= scb
;
1392 /* marshall the parameters */
1394 *bp
++ = htonl(FSSTOREDATA
);
1395 *bp
++ = htonl(vnode
->fid
.vid
);
1396 *bp
++ = htonl(vnode
->fid
.vnode
);
1397 *bp
++ = htonl(vnode
->fid
.unique
);
1399 xdr_encode_AFS_StoreStatus(&bp
, attr
);
1401 *bp
++ = htonl(attr
->ia_size
); /* position of start of write */
1402 *bp
++ = 0; /* size of write */
1403 *bp
++ = htonl(attr
->ia_size
); /* new file length */
1405 afs_use_fs_server(call
, fc
->cbi
);
1406 trace_afs_make_fs_call(call
, &vnode
->fid
);
1407 afs_set_fc_call(call
, fc
);
1408 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1409 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1413 * set the attributes on a file, using FS.StoreData if there's a change in file
1414 * size, and FS.StoreStatus otherwise
1416 int afs_fs_setattr(struct afs_fs_cursor
*fc
, struct iattr
*attr
,
1417 struct afs_status_cb
*scb
)
1419 struct afs_vnode
*vnode
= fc
->vnode
;
1420 struct afs_call
*call
;
1421 struct afs_net
*net
= afs_v2net(vnode
);
1424 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1425 return yfs_fs_setattr(fc
, attr
, scb
);
1427 if (attr
->ia_valid
& ATTR_SIZE
)
1428 return afs_fs_setattr_size(fc
, attr
, scb
);
1430 _enter(",%x,{%llx:%llu},,",
1431 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
1433 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreStatus
,
1439 call
->key
= fc
->key
;
1440 call
->out_scb
= scb
;
1442 /* marshall the parameters */
1444 *bp
++ = htonl(FSSTORESTATUS
);
1445 *bp
++ = htonl(vnode
->fid
.vid
);
1446 *bp
++ = htonl(vnode
->fid
.vnode
);
1447 *bp
++ = htonl(vnode
->fid
.unique
);
1449 xdr_encode_AFS_StoreStatus(&bp
, attr
);
1451 afs_use_fs_server(call
, fc
->cbi
);
1452 trace_afs_make_fs_call(call
, &vnode
->fid
);
1453 afs_set_fc_call(call
, fc
);
1454 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1455 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1459 * deliver reply data to an FS.GetVolumeStatus
1461 static int afs_deliver_fs_get_volume_status(struct afs_call
*call
)
1468 _enter("{%u}", call
->unmarshall
);
1470 switch (call
->unmarshall
) {
1473 afs_extract_to_buf(call
, 12 * 4);
1475 /* Fall through - and extract the returned status record */
1477 _debug("extract status");
1478 ret
= afs_extract_data(call
, true);
1483 xdr_decode_AFSFetchVolumeStatus(&bp
, call
->out_volstatus
);
1485 afs_extract_to_tmp(call
);
1487 /* Fall through - and extract the volume name length */
1489 ret
= afs_extract_data(call
, true);
1493 call
->count
= ntohl(call
->tmp
);
1494 _debug("volname length: %u", call
->count
);
1495 if (call
->count
>= AFSNAMEMAX
)
1496 return afs_protocol_error(call
, -EBADMSG
,
1497 afs_eproto_volname_len
);
1498 size
= (call
->count
+ 3) & ~3; /* It's padded */
1499 afs_extract_to_buf(call
, size
);
1502 /* Fall through - and extract the volume name */
1504 _debug("extract volname");
1505 ret
= afs_extract_data(call
, true);
1511 _debug("volname '%s'", p
);
1512 afs_extract_to_tmp(call
);
1515 /* Fall through - and extract the offline message length */
1517 ret
= afs_extract_data(call
, true);
1521 call
->count
= ntohl(call
->tmp
);
1522 _debug("offline msg length: %u", call
->count
);
1523 if (call
->count
>= AFSNAMEMAX
)
1524 return afs_protocol_error(call
, -EBADMSG
,
1525 afs_eproto_offline_msg_len
);
1526 size
= (call
->count
+ 3) & ~3; /* It's padded */
1527 afs_extract_to_buf(call
, size
);
1530 /* Fall through - and extract the offline message */
1532 _debug("extract offline");
1533 ret
= afs_extract_data(call
, true);
1539 _debug("offline '%s'", p
);
1541 afs_extract_to_tmp(call
);
1544 /* Fall through - and extract the message of the day length */
1546 ret
= afs_extract_data(call
, true);
1550 call
->count
= ntohl(call
->tmp
);
1551 _debug("motd length: %u", call
->count
);
1552 if (call
->count
>= AFSNAMEMAX
)
1553 return afs_protocol_error(call
, -EBADMSG
,
1554 afs_eproto_motd_len
);
1555 size
= (call
->count
+ 3) & ~3; /* It's padded */
1556 afs_extract_to_buf(call
, size
);
1559 /* Fall through - and extract the message of the day */
1561 _debug("extract motd");
1562 ret
= afs_extract_data(call
, false);
1568 _debug("motd '%s'", p
);
1576 _leave(" = 0 [done]");
1581 * FS.GetVolumeStatus operation type
1583 static const struct afs_call_type afs_RXFSGetVolumeStatus
= {
1584 .name
= "FS.GetVolumeStatus",
1585 .op
= afs_FS_GetVolumeStatus
,
1586 .deliver
= afs_deliver_fs_get_volume_status
,
1587 .destructor
= afs_flat_call_destructor
,
1591 * fetch the status of a volume
1593 int afs_fs_get_volume_status(struct afs_fs_cursor
*fc
,
1594 struct afs_volume_status
*vs
)
1596 struct afs_vnode
*vnode
= fc
->vnode
;
1597 struct afs_call
*call
;
1598 struct afs_net
*net
= afs_v2net(vnode
);
1601 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1602 return yfs_fs_get_volume_status(fc
, vs
);
1606 call
= afs_alloc_flat_call(net
, &afs_RXFSGetVolumeStatus
, 2 * 4,
1607 max(12 * 4, AFSOPAQUEMAX
+ 1));
1611 call
->key
= fc
->key
;
1612 call
->out_volstatus
= vs
;
1614 /* marshall the parameters */
1616 bp
[0] = htonl(FSGETVOLUMESTATUS
);
1617 bp
[1] = htonl(vnode
->fid
.vid
);
1619 afs_use_fs_server(call
, fc
->cbi
);
1620 trace_afs_make_fs_call(call
, &vnode
->fid
);
1621 afs_set_fc_call(call
, fc
);
1622 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1623 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1627 * deliver reply data to an FS.SetLock, FS.ExtendLock or FS.ReleaseLock
1629 static int afs_deliver_fs_xxxx_lock(struct afs_call
*call
)
1634 _enter("{%u}", call
->unmarshall
);
1636 ret
= afs_transfer_reply(call
);
1640 /* unmarshall the reply once we've received all of it */
1642 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
1644 _leave(" = 0 [done]");
1649 * FS.SetLock operation type
1651 static const struct afs_call_type afs_RXFSSetLock
= {
1652 .name
= "FS.SetLock",
1653 .op
= afs_FS_SetLock
,
1654 .deliver
= afs_deliver_fs_xxxx_lock
,
1655 .done
= afs_lock_op_done
,
1656 .destructor
= afs_flat_call_destructor
,
1660 * FS.ExtendLock operation type
1662 static const struct afs_call_type afs_RXFSExtendLock
= {
1663 .name
= "FS.ExtendLock",
1664 .op
= afs_FS_ExtendLock
,
1665 .deliver
= afs_deliver_fs_xxxx_lock
,
1666 .done
= afs_lock_op_done
,
1667 .destructor
= afs_flat_call_destructor
,
1671 * FS.ReleaseLock operation type
1673 static const struct afs_call_type afs_RXFSReleaseLock
= {
1674 .name
= "FS.ReleaseLock",
1675 .op
= afs_FS_ReleaseLock
,
1676 .deliver
= afs_deliver_fs_xxxx_lock
,
1677 .destructor
= afs_flat_call_destructor
,
1681 * Set a lock on a file
1683 int afs_fs_set_lock(struct afs_fs_cursor
*fc
, afs_lock_type_t type
,
1684 struct afs_status_cb
*scb
)
1686 struct afs_vnode
*vnode
= fc
->vnode
;
1687 struct afs_call
*call
;
1688 struct afs_net
*net
= afs_v2net(vnode
);
1691 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1692 return yfs_fs_set_lock(fc
, type
, scb
);
1696 call
= afs_alloc_flat_call(net
, &afs_RXFSSetLock
, 5 * 4, 6 * 4);
1700 call
->key
= fc
->key
;
1701 call
->lvnode
= vnode
;
1702 call
->out_scb
= scb
;
1704 /* marshall the parameters */
1706 *bp
++ = htonl(FSSETLOCK
);
1707 *bp
++ = htonl(vnode
->fid
.vid
);
1708 *bp
++ = htonl(vnode
->fid
.vnode
);
1709 *bp
++ = htonl(vnode
->fid
.unique
);
1710 *bp
++ = htonl(type
);
1712 afs_use_fs_server(call
, fc
->cbi
);
1713 trace_afs_make_fs_calli(call
, &vnode
->fid
, type
);
1714 afs_set_fc_call(call
, fc
);
1715 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1716 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1720 * extend a lock on a file
1722 int afs_fs_extend_lock(struct afs_fs_cursor
*fc
, struct afs_status_cb
*scb
)
1724 struct afs_vnode
*vnode
= fc
->vnode
;
1725 struct afs_call
*call
;
1726 struct afs_net
*net
= afs_v2net(vnode
);
1729 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1730 return yfs_fs_extend_lock(fc
, scb
);
1734 call
= afs_alloc_flat_call(net
, &afs_RXFSExtendLock
, 4 * 4, 6 * 4);
1738 call
->key
= fc
->key
;
1739 call
->lvnode
= vnode
;
1740 call
->out_scb
= scb
;
1742 /* marshall the parameters */
1744 *bp
++ = htonl(FSEXTENDLOCK
);
1745 *bp
++ = htonl(vnode
->fid
.vid
);
1746 *bp
++ = htonl(vnode
->fid
.vnode
);
1747 *bp
++ = htonl(vnode
->fid
.unique
);
1749 afs_use_fs_server(call
, fc
->cbi
);
1750 trace_afs_make_fs_call(call
, &vnode
->fid
);
1751 afs_set_fc_call(call
, fc
);
1752 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1753 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1757 * release a lock on a file
1759 int afs_fs_release_lock(struct afs_fs_cursor
*fc
, struct afs_status_cb
*scb
)
1761 struct afs_vnode
*vnode
= fc
->vnode
;
1762 struct afs_call
*call
;
1763 struct afs_net
*net
= afs_v2net(vnode
);
1766 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1767 return yfs_fs_release_lock(fc
, scb
);
1771 call
= afs_alloc_flat_call(net
, &afs_RXFSReleaseLock
, 4 * 4, 6 * 4);
1775 call
->key
= fc
->key
;
1776 call
->lvnode
= vnode
;
1777 call
->out_scb
= scb
;
1779 /* marshall the parameters */
1781 *bp
++ = htonl(FSRELEASELOCK
);
1782 *bp
++ = htonl(vnode
->fid
.vid
);
1783 *bp
++ = htonl(vnode
->fid
.vnode
);
1784 *bp
++ = htonl(vnode
->fid
.unique
);
1786 afs_use_fs_server(call
, fc
->cbi
);
1787 trace_afs_make_fs_call(call
, &vnode
->fid
);
1788 afs_set_fc_call(call
, fc
);
1789 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1790 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1794 * Deliver reply data to an FS.GiveUpAllCallBacks operation.
1796 static int afs_deliver_fs_give_up_all_callbacks(struct afs_call
*call
)
1798 return afs_transfer_reply(call
);
1802 * FS.GiveUpAllCallBacks operation type
1804 static const struct afs_call_type afs_RXFSGiveUpAllCallBacks
= {
1805 .name
= "FS.GiveUpAllCallBacks",
1806 .op
= afs_FS_GiveUpAllCallBacks
,
1807 .deliver
= afs_deliver_fs_give_up_all_callbacks
,
1808 .destructor
= afs_flat_call_destructor
,
1812 * Flush all the callbacks we have on a server.
1814 int afs_fs_give_up_all_callbacks(struct afs_net
*net
,
1815 struct afs_server
*server
,
1816 struct afs_addr_cursor
*ac
,
1819 struct afs_call
*call
;
1824 call
= afs_alloc_flat_call(net
, &afs_RXFSGiveUpAllCallBacks
, 1 * 4, 0);
1830 /* marshall the parameters */
1832 *bp
++ = htonl(FSGIVEUPALLCALLBACKS
);
1834 /* Can't take a ref on server */
1835 afs_make_call(ac
, call
, GFP_NOFS
);
1836 return afs_wait_for_call_to_complete(call
, ac
);
1840 * Deliver reply data to an FS.GetCapabilities operation.
1842 static int afs_deliver_fs_get_capabilities(struct afs_call
*call
)
1847 _enter("{%u,%zu}", call
->unmarshall
, iov_iter_count(&call
->iter
));
1849 switch (call
->unmarshall
) {
1851 afs_extract_to_tmp(call
);
1854 /* Fall through - and extract the capabilities word count */
1856 ret
= afs_extract_data(call
, true);
1860 count
= ntohl(call
->tmp
);
1862 call
->count
= count
;
1863 call
->count2
= count
;
1864 iov_iter_discard(&call
->iter
, READ
, count
* sizeof(__be32
));
1867 /* Fall through - and extract capabilities words */
1869 ret
= afs_extract_data(call
, false);
1873 /* TODO: Examine capabilities */
1879 _leave(" = 0 [done]");
1884 * FS.GetCapabilities operation type
1886 static const struct afs_call_type afs_RXFSGetCapabilities
= {
1887 .name
= "FS.GetCapabilities",
1888 .op
= afs_FS_GetCapabilities
,
1889 .deliver
= afs_deliver_fs_get_capabilities
,
1890 .done
= afs_fileserver_probe_result
,
1891 .destructor
= afs_flat_call_destructor
,
1895 * Probe a fileserver for the capabilities that it supports. This can
1896 * return up to 196 words.
1898 struct afs_call
*afs_fs_get_capabilities(struct afs_net
*net
,
1899 struct afs_server
*server
,
1900 struct afs_addr_cursor
*ac
,
1902 unsigned int server_index
)
1904 struct afs_call
*call
;
1909 call
= afs_alloc_flat_call(net
, &afs_RXFSGetCapabilities
, 1 * 4, 16 * 4);
1911 return ERR_PTR(-ENOMEM
);
1914 call
->server
= afs_get_server(server
, afs_server_trace_get_caps
);
1915 call
->server_index
= server_index
;
1916 call
->upgrade
= true;
1918 call
->max_lifespan
= AFS_PROBE_MAX_LIFESPAN
;
1920 /* marshall the parameters */
1922 *bp
++ = htonl(FSGETCAPABILITIES
);
1924 /* Can't take a ref on server */
1925 trace_afs_make_fs_call(call
, NULL
);
1926 afs_make_call(ac
, call
, GFP_NOFS
);
1931 * Deliver reply data to an FS.FetchStatus with no vnode.
1933 static int afs_deliver_fs_fetch_status(struct afs_call
*call
)
1938 ret
= afs_transfer_reply(call
);
1942 /* unmarshall the reply once we've received all of it */
1944 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
1947 xdr_decode_AFSCallBack(&bp
, call
, call
->out_scb
);
1948 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
1950 _leave(" = 0 [done]");
1955 * FS.FetchStatus operation type
1957 static const struct afs_call_type afs_RXFSFetchStatus
= {
1958 .name
= "FS.FetchStatus",
1959 .op
= afs_FS_FetchStatus
,
1960 .deliver
= afs_deliver_fs_fetch_status
,
1961 .destructor
= afs_flat_call_destructor
,
1965 * Fetch the status information for a fid without needing a vnode handle.
1967 int afs_fs_fetch_status(struct afs_fs_cursor
*fc
,
1968 struct afs_net
*net
,
1969 struct afs_fid
*fid
,
1970 struct afs_status_cb
*scb
,
1971 struct afs_volsync
*volsync
)
1973 struct afs_call
*call
;
1976 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1977 return yfs_fs_fetch_status(fc
, net
, fid
, scb
, volsync
);
1979 _enter(",%x,{%llx:%llu},,",
1980 key_serial(fc
->key
), fid
->vid
, fid
->vnode
);
1982 call
= afs_alloc_flat_call(net
, &afs_RXFSFetchStatus
, 16, (21 + 3 + 6) * 4);
1984 fc
->ac
.error
= -ENOMEM
;
1988 call
->key
= fc
->key
;
1989 call
->out_fid
= fid
;
1990 call
->out_scb
= scb
;
1991 call
->out_volsync
= volsync
;
1993 /* marshall the parameters */
1995 bp
[0] = htonl(FSFETCHSTATUS
);
1996 bp
[1] = htonl(fid
->vid
);
1997 bp
[2] = htonl(fid
->vnode
);
1998 bp
[3] = htonl(fid
->unique
);
2000 afs_use_fs_server(call
, fc
->cbi
);
2001 trace_afs_make_fs_call(call
, fid
);
2002 afs_set_fc_call(call
, fc
);
2003 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
2004 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
2008 * Deliver reply data to an FS.InlineBulkStatus call
2010 static int afs_deliver_fs_inline_bulk_status(struct afs_call
*call
)
2012 struct afs_status_cb
*scb
;
2017 _enter("{%u}", call
->unmarshall
);
2019 switch (call
->unmarshall
) {
2021 afs_extract_to_tmp(call
);
2024 /* Extract the file status count and array in two steps */
2027 _debug("extract status count");
2028 ret
= afs_extract_data(call
, true);
2032 tmp
= ntohl(call
->tmp
);
2033 _debug("status count: %u/%u", tmp
, call
->count2
);
2034 if (tmp
!= call
->count2
)
2035 return afs_protocol_error(call
, -EBADMSG
,
2036 afs_eproto_ibulkst_count
);
2041 afs_extract_to_buf(call
, 21 * sizeof(__be32
));
2045 _debug("extract status array %u", call
->count
);
2046 ret
= afs_extract_data(call
, true);
2051 scb
= &call
->out_scb
[call
->count
];
2052 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, scb
);
2057 if (call
->count
< call
->count2
)
2062 afs_extract_to_tmp(call
);
2064 /* Extract the callback count and array in two steps */
2067 _debug("extract CB count");
2068 ret
= afs_extract_data(call
, true);
2072 tmp
= ntohl(call
->tmp
);
2073 _debug("CB count: %u", tmp
);
2074 if (tmp
!= call
->count2
)
2075 return afs_protocol_error(call
, -EBADMSG
,
2076 afs_eproto_ibulkst_cb_count
);
2080 afs_extract_to_buf(call
, 3 * sizeof(__be32
));
2084 _debug("extract CB array");
2085 ret
= afs_extract_data(call
, true);
2089 _debug("unmarshall CB array");
2091 scb
= &call
->out_scb
[call
->count
];
2092 xdr_decode_AFSCallBack(&bp
, call
, scb
);
2094 if (call
->count
< call
->count2
)
2097 afs_extract_to_buf(call
, 6 * sizeof(__be32
));
2102 ret
= afs_extract_data(call
, false);
2107 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
2115 _leave(" = 0 [done]");
2120 * FS.InlineBulkStatus operation type
2122 static const struct afs_call_type afs_RXFSInlineBulkStatus
= {
2123 .name
= "FS.InlineBulkStatus",
2124 .op
= afs_FS_InlineBulkStatus
,
2125 .deliver
= afs_deliver_fs_inline_bulk_status
,
2126 .destructor
= afs_flat_call_destructor
,
2130 * Fetch the status information for up to 50 files
2132 int afs_fs_inline_bulk_status(struct afs_fs_cursor
*fc
,
2133 struct afs_net
*net
,
2134 struct afs_fid
*fids
,
2135 struct afs_status_cb
*statuses
,
2136 unsigned int nr_fids
,
2137 struct afs_volsync
*volsync
)
2139 struct afs_call
*call
;
2143 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
2144 return yfs_fs_inline_bulk_status(fc
, net
, fids
, statuses
,
2147 _enter(",%x,{%llx:%llu},%u",
2148 key_serial(fc
->key
), fids
[0].vid
, fids
[1].vnode
, nr_fids
);
2150 call
= afs_alloc_flat_call(net
, &afs_RXFSInlineBulkStatus
,
2151 (2 + nr_fids
* 3) * 4,
2154 fc
->ac
.error
= -ENOMEM
;
2158 call
->key
= fc
->key
;
2159 call
->out_scb
= statuses
;
2160 call
->out_volsync
= volsync
;
2161 call
->count2
= nr_fids
;
2163 /* marshall the parameters */
2165 *bp
++ = htonl(FSINLINEBULKSTATUS
);
2166 *bp
++ = htonl(nr_fids
);
2167 for (i
= 0; i
< nr_fids
; i
++) {
2168 *bp
++ = htonl(fids
[i
].vid
);
2169 *bp
++ = htonl(fids
[i
].vnode
);
2170 *bp
++ = htonl(fids
[i
].unique
);
2173 afs_use_fs_server(call
, fc
->cbi
);
2174 trace_afs_make_fs_call(call
, &fids
[0]);
2175 afs_set_fc_call(call
, fc
);
2176 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
2177 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
2181 * deliver reply data to an FS.FetchACL
2183 static int afs_deliver_fs_fetch_acl(struct afs_call
*call
)
2185 struct afs_acl
*acl
;
2190 _enter("{%u}", call
->unmarshall
);
2192 switch (call
->unmarshall
) {
2194 afs_extract_to_tmp(call
);
2197 /* extract the returned data length */
2199 ret
= afs_extract_data(call
, true);
2203 size
= call
->count2
= ntohl(call
->tmp
);
2204 size
= round_up(size
, 4);
2206 acl
= kmalloc(struct_size(acl
, data
, size
), GFP_KERNEL
);
2209 call
->ret_acl
= acl
;
2210 acl
->size
= call
->count2
;
2211 afs_extract_begin(call
, acl
->data
, size
);
2214 /* extract the returned data */
2216 ret
= afs_extract_data(call
, true);
2220 afs_extract_to_buf(call
, (21 + 6) * 4);
2223 /* extract the metadata */
2225 ret
= afs_extract_data(call
, false);
2230 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
2233 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
2241 _leave(" = 0 [done]");
2245 static void afs_destroy_fs_fetch_acl(struct afs_call
*call
)
2247 kfree(call
->ret_acl
);
2248 afs_flat_call_destructor(call
);
2252 * FS.FetchACL operation type
2254 static const struct afs_call_type afs_RXFSFetchACL
= {
2255 .name
= "FS.FetchACL",
2256 .op
= afs_FS_FetchACL
,
2257 .deliver
= afs_deliver_fs_fetch_acl
,
2258 .destructor
= afs_destroy_fs_fetch_acl
,
2262 * Fetch the ACL for a file.
2264 struct afs_acl
*afs_fs_fetch_acl(struct afs_fs_cursor
*fc
,
2265 struct afs_status_cb
*scb
)
2267 struct afs_vnode
*vnode
= fc
->vnode
;
2268 struct afs_call
*call
;
2269 struct afs_net
*net
= afs_v2net(vnode
);
2272 _enter(",%x,{%llx:%llu},,",
2273 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
2275 call
= afs_alloc_flat_call(net
, &afs_RXFSFetchACL
, 16, (21 + 6) * 4);
2277 fc
->ac
.error
= -ENOMEM
;
2278 return ERR_PTR(-ENOMEM
);
2281 call
->key
= fc
->key
;
2282 call
->ret_acl
= NULL
;
2283 call
->out_scb
= scb
;
2284 call
->out_volsync
= NULL
;
2286 /* marshall the parameters */
2288 bp
[0] = htonl(FSFETCHACL
);
2289 bp
[1] = htonl(vnode
->fid
.vid
);
2290 bp
[2] = htonl(vnode
->fid
.vnode
);
2291 bp
[3] = htonl(vnode
->fid
.unique
);
2293 afs_use_fs_server(call
, fc
->cbi
);
2294 trace_afs_make_fs_call(call
, &vnode
->fid
);
2295 afs_make_call(&fc
->ac
, call
, GFP_KERNEL
);
2296 return (struct afs_acl
*)afs_wait_for_call_to_complete(call
, &fc
->ac
);
2300 * Deliver reply data to any operation that returns file status and volume
2303 static int afs_deliver_fs_file_status_and_vol(struct afs_call
*call
)
2308 ret
= afs_transfer_reply(call
);
2313 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
2316 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
2318 _leave(" = 0 [done]");
2323 * FS.StoreACL operation type
2325 static const struct afs_call_type afs_RXFSStoreACL
= {
2326 .name
= "FS.StoreACL",
2327 .op
= afs_FS_StoreACL
,
2328 .deliver
= afs_deliver_fs_file_status_and_vol
,
2329 .destructor
= afs_flat_call_destructor
,
2333 * Fetch the ACL for a file.
2335 int afs_fs_store_acl(struct afs_fs_cursor
*fc
, const struct afs_acl
*acl
,
2336 struct afs_status_cb
*scb
)
2338 struct afs_vnode
*vnode
= fc
->vnode
;
2339 struct afs_call
*call
;
2340 struct afs_net
*net
= afs_v2net(vnode
);
2344 _enter(",%x,{%llx:%llu},,",
2345 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
2347 size
= round_up(acl
->size
, 4);
2348 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreACL
,
2349 5 * 4 + size
, (21 + 6) * 4);
2351 fc
->ac
.error
= -ENOMEM
;
2355 call
->key
= fc
->key
;
2356 call
->out_scb
= scb
;
2357 call
->out_volsync
= NULL
;
2359 /* marshall the parameters */
2361 bp
[0] = htonl(FSSTOREACL
);
2362 bp
[1] = htonl(vnode
->fid
.vid
);
2363 bp
[2] = htonl(vnode
->fid
.vnode
);
2364 bp
[3] = htonl(vnode
->fid
.unique
);
2365 bp
[4] = htonl(acl
->size
);
2366 memcpy(&bp
[5], acl
->data
, acl
->size
);
2367 if (acl
->size
!= size
)
2368 memset((void *)&bp
[5] + acl
->size
, 0, size
- acl
->size
);
2370 trace_afs_make_fs_call(call
, &vnode
->fid
);
2371 afs_make_call(&fc
->ac
, call
, GFP_KERNEL
);
2372 return afs_wait_for_call_to_complete(call
, &fc
->ac
);