-
Notifications
You must be signed in to change notification settings - Fork 4
/
nfs_vfsops.c
6374 lines (5900 loc) · 188 KB
/
nfs_vfsops.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2000-2020 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
/*
* Copyright (c) 1989, 1993, 1995
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Rick Macklem at The University of Guelph.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)nfs_vfsops.c 8.12 (Berkeley) 5/20/95
* FreeBSD-Id: nfs_vfsops.c,v 1.52 1997/11/12 05:42:21 julian Exp $
*/
#include "nfs_client.h"
/*
* NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce
* support for mandatory and extensible security protections. This notice
* is included in support of clause 2.2 (b) of the Apple Public License,
* Version 2.0.
*/
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/kernel.h>
#include <sys/un.h>
#include <sys/fcntl.h>
#include <sys/priv.h>
#include <IOKit/IOLib.h>
#include <net/if.h>
#include <kern/kalloc.h>
#include <miscfs/devfs/devfs.h>
#include <nfs/nfsnode.h>
#include <nfs/nfs_gss.h>
#include <nfs/nfsmount.h>
#include <nfs/xdr_subs.h>
#include <nfs/nfsm_subs.h>
#include <nfs/nfs_lock.h>
#define NFS_VFS_DBG(...) NFSCLNT_DBG(NFSCLNT_FAC_VFS, 7, ## __VA_ARGS__)
// this describes each of our lock groups
typedef struct nfs_lck_group_info {
nfs_lck_group_kind_t nlg_kind;
const char * nlg_name;
} nfs_lck_group_info_t;
/* Global array of lock groups */
nfs_lck_group_info_t nfs_lck_group_infos[NLG_NUM_GROUPS] = {
{ NLG_GLOBAL, "nfs_global" },
{ NLG_MOUNT, "nfs_mount" },
{ NLG_REQUEST, "nfs_request" },
{ NLG_OPEN, "nfs_open" },
{ NLG_NFSIOD, "nfsiod" },
{ NLG_NODE_HASH, "nfs_node_hash" },
{ NLG_NODE, "nfs_node" },
{ NLG_DATA, "nfs_data" },
{ NLG_LOCK, "nfs_lock" },
{ NLG_BUF, "nfs_buf" },
{ NLG_GSS_KRB5_MECH, "gss_krb5_mech" },
{ NLG_GSS_CLNT, "rpcsec_gss_clnt" },
};
// this describes each of our lock mutexes
typedef struct nfs_lck_mtx_info {
nfs_lck_mtx_kind_t nlm_kind;
nfs_lck_group_kind_t nlm_group;
const char * nlm_name;
} nfs_lck_mtx_info_t;
/* Global array of lock mutexes currently defined */
nfs_lck_mtx_info_t nfs_lck_mtx_infos[NLM_NUM_MUTEXES] = {
{ NLM_GLOBAL, NLG_GLOBAL, "nfs_global_mutex" },
{ NLM_REQUEST, NLG_REQUEST, "nfs_request_mutex" },
{ NLM_NFSIOD, NLG_NFSIOD, "nfsiod_mutex" },
{ NLM_NODE_HASH, NLG_NODE_HASH, "nfs_node_hash_mutex" },
{ NLM_LOCK, NLG_LOCK, "nfs_lock_mutex" },
{ NLM_BUF, NLG_BUF, "nfs_buf_mutex" },
};
lck_grp_t* nfs_lck_groups[NLG_NUM_GROUPS];
lck_mtx_t* nfs_lck_mtxes[NLM_NUM_MUTEXES];
lck_grp_t *
get_lck_group(nfs_lck_group_kind_t group)
{
return nfs_lck_groups[group];
}
lck_mtx_t *
get_lck_mtx(nfs_lck_mtx_kind_t mtx)
{
return nfs_lck_mtxes[mtx];
}
/*
* Initialize the NFS lock groups
*/
int
nfs_locks_init(void)
{
int i;
for (i = 0; i < NLG_NUM_GROUPS; i++) {
nfs_lck_groups[i] = lck_grp_alloc_init(nfs_lck_group_infos[i].nlg_name, LCK_GRP_ATTR_NULL);
if (nfs_lck_groups[i] == NULL) {
printf("nfs_locks_init: Couldn't create %s lock group\n", nfs_lck_group_infos[i].nlg_name);
return ENOMEM;
}
}
for (i = 0; i < NLM_NUM_MUTEXES; i++) {
nfs_lck_mtxes[i] = lck_mtx_alloc_init(get_lck_group(nfs_lck_mtx_infos[i].nlm_group), LCK_ATTR_NULL);
if (nfs_lck_mtxes[i] == NULL) {
printf("nfs_locks_init: Couldn't create mutex %s\n", nfs_lck_mtx_infos[i].nlm_name);
return ENOMEM;
}
}
return 0;
}
void
nfs_locks_free(void)
{
int i;
for (i = 0; i < NLM_NUM_MUTEXES; i++) {
if (nfs_lck_mtxes[i]) {
lck_mtx_free(nfs_lck_mtxes[i], get_lck_group(nfs_lck_mtx_infos[i].nlm_group));
nfs_lck_mtxes[i] = NULL;
}
}
for (i = 0; i < NLG_NUM_GROUPS; i++) {
if (nfs_lck_groups[i]) {
lck_grp_free(nfs_lck_groups[i]);
nfs_lck_groups[i] = NULL;
}
}
}
struct nfs_hooks_out hooks_out = { .f_get_bsdthreadtask_info = NULL };
void *
nfs_bsdthreadtask_info(thread_t th)
{
return hooks_out.f_get_bsdthreadtask_info(th);
}
// this describes each of our NFS zones
typedef struct nfs_zone_info {
nfs_zone_kind_t nze_kind;
size_t nze_elem_size;
const char * nze_name;
zone_create_flags_t nze_flags;
} nfs_zone_info_t;
/* Global array of NFS client zones */
nfs_zone_info_t nfs_zone_infos[NFS_NUM_ZONES] = {
{ NFS_MOUNT_ZONE, sizeof(struct nfsmount), "NFS mount", ZC_ZFREE_CLEARMEM },
{ NFS_FILE_HANDLE_ZONE, sizeof(struct fhandle), "NFS fhandle", ZC_NONE },
{ NFS_REQUEST_ZONE, sizeof(struct nfsreq), "NFS req", ZC_NONE },
{ NFS_NODE_ZONE, sizeof(struct nfsnode), "NFS node", ZC_ZFREE_CLEARMEM },
{ NFS_BIO_ZONE, sizeof(struct nfsbuf), "NFS bio", ZC_NONE },
{ NFS_DIROFF, sizeof(struct nfsdmap), "NFSV3 diroff", ZC_NONE },
{ NFS_NAMEI, PATH_MAX, "NFS namei", ZC_NONE },
{ NFS_VATTR, sizeof(struct nfs_vattr), "NFS attr", ZC_NONE },
};
zone_t nfs_zones[NFS_NUM_ZONES];
zone_t
get_zone(nfs_zone_kind_t zone)
{
return nfs_zones[zone];
}
/*
* Initialize the NFS zones
*/
void
nfs_zone_init(void)
{
int i;
for (i = 0; i < NFS_NUM_ZONES; i++) {
nfs_zones[i] = zone_create(nfs_zone_infos[i].nze_name,
nfs_zone_infos[i].nze_elem_size,
nfs_zone_infos[i].nze_flags | ZC_DESTRUCTIBLE);
}
}
void
nfs_zone_destroy(void)
{
int i;
/*
* Free all allocated buffers.
*/
nfs_buf_freeup(NBF_FREEALL);
for (i = 0; i < NFS_NUM_ZONES; i++) {
if (nfs_zones[i]) {
zdestroy(nfs_zones[i]);
nfs_zones[i] = NULL;
}
}
}
/*
* NFS client globals
*/
int nfs_ticks;
uint32_t nfs_fs_attr_bitmap[NFS_ATTR_BITMAP_LEN];
uint32_t nfs_object_attr_bitmap[NFS_ATTR_BITMAP_LEN];
uint32_t nfs_getattr_bitmap[NFS_ATTR_BITMAP_LEN];
uint32_t nfs4_getattr_write_bitmap[NFS_ATTR_BITMAP_LEN];
struct nfsclientidlist nfsclientids;
/* NFS requests */
struct nfs_reqqhead nfs_reqq;
thread_call_t nfs_request_timer_call;
int nfs_request_timer_on;
u_int64_t nfs_xid = 0;
u_int64_t nfs_xidwrap = 0; /* to build a (non-wrapping) 64 bit xid */
thread_call_t nfs_buf_timer_call;
/* NFSv4 */
uint32_t nfs_open_owner_seqnum = 0;
uint32_t nfs_lock_owner_seqnum = 0;
thread_call_t nfs4_callback_timer_call;
int nfs4_callback_timer_on = 0;
char nfs4_default_domain[MAXPATHLEN];
/* nfsiod */
struct nfsiodlist nfsiodfree, nfsiodwork;
struct nfsiodmountlist nfsiodmounts;
int nfsiod_thread_count = 0;
int nfsiod_thread_max = NFS_DEFASYNCTHREAD;
int nfs_max_async_writes = NFS_DEFMAXASYNCWRITES;
int nfs_iosize = NFS_IOSIZE;
int nfs_access_cache_timeout = NFS_MAXATTRTIMO;
int nfs_access_delete = 1; /* too many servers get this wrong - workaround on by default */
int nfs_access_dotzfs = 1;
int nfs_access_for_getattr = 0;
int nfs_allow_async = 0;
int nfs_statfs_rate_limit = NFS_DEFSTATFSRATELIMIT;
int nfs_lockd_mounts = 0;
int nfs_lockd_request_sent = 0;
int nfs_idmap_ctrl = NFS_IDMAP_CTRL_USE_IDMAP_SERVICE;
int nfs_callback_port = 0;
int nfs_split_open_owner = 0;
uint32_t nfs_mount_count = 0, nfs_device_count = 0;
uint32_t unload_in_progress = 0;
int nfs_tprintf_initial_delay = NFS_TPRINTF_INITIAL_DELAY;
int nfs_tprintf_delay = NFS_TPRINTF_DELAY;
int nfs_mount_timeout = NFS_MOUNT_TIMEOUT;
int nfs_mount_quick_timeout = NFS_MOUNT_QUICK_TIMEOUT;
int mountnfs(char *, mount_t, vfs_context_t, vnode_t *);
int nfs_mount_connect(struct nfsmount *);
void nfs_mount_drain_and_cleanup(struct nfsmount *);
void nfs_mount_cleanup(struct nfsmount *);
int nfs_mountinfo_assemble(struct nfsmount *, struct xdrbuf *);
int nfs4_mount_update_path_with_symlink(struct nfsmount *, struct nfs_fs_path *, uint32_t, fhandle_t *, int *, fhandle_t *, vfs_context_t);
/*
* NFS VFS operations.
*/
int nfs_vfs_mount(mount_t, vnode_t, user_addr_t, vfs_context_t);
int nfs_vfs_start(mount_t, int, vfs_context_t);
int nfs_vfs_unmount(mount_t, int, vfs_context_t);
int nfs_vfs_root(mount_t, vnode_t *, vfs_context_t);
int nfs_vfs_quotactl(mount_t, int, uid_t, caddr_t, vfs_context_t);
int nfs_vfs_getattr(mount_t, struct vfs_attr *, vfs_context_t);
int nfs_vfs_sync(mount_t, int, vfs_context_t);
int nfs_vfs_vget(mount_t, ino64_t, vnode_t *, vfs_context_t);
int nfs_vfs_vptofh(vnode_t, int *, unsigned char *, vfs_context_t);
int nfs_vfs_fhtovp(mount_t, int, unsigned char *, vnode_t *, vfs_context_t);
int nfs_vfs_init(struct vfsconf *);
int nfs_vfs_sysctl(int *, u_int, user_addr_t, size_t *, user_addr_t, size_t, vfs_context_t);
const struct vfsops nfs_vfsops = {
.vfs_mount = nfs_vfs_mount,
.vfs_start = nfs_vfs_start,
.vfs_unmount = nfs_vfs_unmount,
.vfs_root = nfs_vfs_root,
.vfs_quotactl = nfs_vfs_quotactl,
.vfs_getattr = nfs_vfs_getattr,
.vfs_sync = nfs_vfs_sync,
.vfs_vget = nfs_vfs_vget,
.vfs_fhtovp = nfs_vfs_fhtovp,
.vfs_vptofh = nfs_vfs_vptofh,
.vfs_init = nfs_vfs_init,
.vfs_sysctl = nfs_vfs_sysctl,
// We do not support the remaining VFS ops
};
/*
* version-specific NFS functions
*/
int nfs3_mount(struct nfsmount *, vfs_context_t, nfsnode_t *);
int nfs4_mount(struct nfsmount *, vfs_context_t, nfsnode_t *);
int nfs3_fsinfo(struct nfsmount *, nfsnode_t, vfs_context_t);
int nfs3_update_statfs(struct nfsmount *, vfs_context_t);
int nfs4_update_statfs(struct nfsmount *, vfs_context_t);
#if !QUOTA
#define nfs3_getquota NULL
#define nfs4_getquota NULL
#else
int nfs3_getquota(struct nfsmount *, vfs_context_t, uid_t, int, struct dqblk *);
int nfs4_getquota(struct nfsmount *, vfs_context_t, uid_t, int, struct dqblk *);
#endif
const struct nfs_funcs nfs3_funcs = {
.nf_mount = nfs3_mount,
.nf_update_statfs = nfs3_update_statfs,
.nf_getquota = nfs3_getquota,
.nf_access_rpc = nfs3_access_rpc,
.nf_getattr_rpc = nfs3_getattr_rpc,
.nf_setattr_rpc = nfs3_setattr_rpc,
.nf_read_rpc_async = nfs3_read_rpc_async,
.nf_read_rpc_async_finish = nfs3_read_rpc_async_finish,
.nf_readlink_rpc = nfs3_readlink_rpc,
.nf_write_rpc_async = nfs3_write_rpc_async,
.nf_write_rpc_async_finish = nfs3_write_rpc_async_finish,
.nf_commit_rpc = nfs3_commit_rpc,
.nf_lookup_rpc_async = nfs3_lookup_rpc_async,
.nf_lookup_rpc_async_finish = nfs3_lookup_rpc_async_finish,
.nf_remove_rpc = nfs3_remove_rpc,
.nf_rename_rpc = nfs3_rename_rpc,
.nf_setlock_rpc = nfs3_setlock_rpc,
.nf_unlock_rpc = nfs3_unlock_rpc,
.nf_getlock_rpc = nfs3_getlock_rpc
};
#if CONFIG_NFS4
const struct nfs_funcs nfs4_funcs = {
.nf_mount = nfs4_mount,
.nf_update_statfs = nfs4_update_statfs,
.nf_getquota = nfs4_getquota,
.nf_access_rpc = nfs4_access_rpc,
.nf_getattr_rpc = nfs4_getattr_rpc,
.nf_setattr_rpc = nfs4_setattr_rpc,
.nf_read_rpc_async = nfs4_read_rpc_async,
.nf_read_rpc_async_finish = nfs4_read_rpc_async_finish,
.nf_readlink_rpc = nfs4_readlink_rpc,
.nf_write_rpc_async = nfs4_write_rpc_async,
.nf_write_rpc_async_finish = nfs4_write_rpc_async_finish,
.nf_commit_rpc = nfs4_commit_rpc,
.nf_lookup_rpc_async = nfs4_lookup_rpc_async,
.nf_lookup_rpc_async_finish = nfs4_lookup_rpc_async_finish,
.nf_remove_rpc = nfs4_remove_rpc,
.nf_rename_rpc = nfs4_rename_rpc,
.nf_setlock_rpc = nfs4_setlock_rpc,
.nf_unlock_rpc = nfs4_unlock_rpc,
.nf_getlock_rpc = nfs4_getlock_rpc
};
#endif
/*
* Called once to initialize data structures...
*/
int
nfs_vfs_init(__unused struct vfsconf *vfsp)
{
#if CONFIG_NFS4
int i;
#endif
/*
* Check to see if major data structures haven't bloated.
*/
if (sizeof(struct nfsnode) > NFS_NODEALLOC) {
printf("struct nfsnode bloated (> %dbytes)\n", NFS_NODEALLOC);
printf("Try reducing NFS_SMALLFH\n");
}
if (sizeof(struct nfsmount) > NFS_MNTALLOC) {
printf("struct nfsmount bloated (> %dbytes)\n", NFS_MNTALLOC);
}
nfs_ticks = (hz * NFS_TICKINTVL + 500) / 1000;
if (nfs_ticks < 1) {
nfs_ticks = 1;
}
/* init async I/O thread pool state */
TAILQ_INIT(&nfsiodfree);
TAILQ_INIT(&nfsiodwork);
TAILQ_INIT(&nfsiodmounts);
/* initialize NFS request list */
TAILQ_INIT(&nfs_reqq);
nfs_nbinit(); /* Init the nfsbuf table */
#if CONFIG_NFS4
/* NFSv4 stuff */
NFS4_PER_FS_ATTRIBUTES(nfs_fs_attr_bitmap);
NFS4_PER_OBJECT_ATTRIBUTES(nfs_object_attr_bitmap);
NFS4_DEFAULT_WRITE_ATTRIBUTES(nfs4_getattr_write_bitmap);
NFS4_DEFAULT_ATTRIBUTES(nfs_getattr_bitmap);
for (i = 0; i < NFS_ATTR_BITMAP_LEN; i++) {
nfs_getattr_bitmap[i] &= nfs_object_attr_bitmap[i];
nfs4_getattr_write_bitmap[i] &= nfs_object_attr_bitmap[i];
}
TAILQ_INIT(&nfsclientids);
#endif
/* initialize NFS timer callouts */
nfs_request_timer_call = thread_call_allocate(nfs_request_timer, NULL);
nfs_buf_timer_call = thread_call_allocate(nfs_buf_timer, NULL);
#if CONFIG_NFS4
nfs4_callback_timer_call = thread_call_allocate(nfs4_callback_timer, NULL);
#endif
return 0;
}
bool
nfs_fs_path_init(struct nfs_fs_path *fsp, uint32_t count)
{
if (count) {
fsp->np_components = kalloc_type(char *, count, Z_WAITOK);
if (fsp->np_components) {
bzero(fsp->np_components, sizeof(char *) * count);
} else {
/*
* keep np_compcount initialized so that parsing still
* happens.
*/
fsp->np_compcount = count;
fsp->np_compsize = 0;
return false;
}
} else {
fsp->np_components = NULL;
}
fsp->np_compcount = fsp->np_compsize = count;
return true;
}
void
nfs_fs_path_replace(struct nfs_fs_path *dst, struct nfs_fs_path *src)
{
nfs_fs_path_destroy(dst);
*dst = *src;
bzero(src, sizeof(*src));
}
void
nfs_fs_path_destroy(struct nfs_fs_path *fsp)
{
if (fsp->np_components) {
for (uint32_t i = 0; i < fsp->np_compcount; i++) {
if (fsp->np_components[i]) {
kfree_data_addr(fsp->np_components[i]);
}
}
kfree_type(char *, fsp->np_compsize, fsp->np_components);
}
bzero(fsp, sizeof(*fsp));
}
/*
* nfs statfs call
*/
int
nfs3_update_statfs(struct nfsmount *nmp, vfs_context_t ctx)
{
nfsnode_t np;
int error = 0, lockerror, status, nfsvers;
u_int64_t xid;
struct nfsm_chain nmreq, nmrep;
uint32_t val = 0;
nfsvers = nmp->nm_vers;
np = nmp->nm_dnp;
if (!np) {
return ENXIO;
}
if ((error = vnode_get(NFSTOV(np)))) {
return error;
}
nfsm_chain_null(&nmreq);
nfsm_chain_null(&nmrep);
nfsm_chain_build_alloc_init(error, &nmreq, NFSX_FH(nfsvers));
nfsm_chain_add_fh(error, &nmreq, nfsvers, np->n_fhp, np->n_fhsize);
nfsm_chain_build_done(error, &nmreq);
nfsmout_if(error);
error = nfs_request2(np, NULL, &nmreq, NFSPROC_FSSTAT, vfs_context_thread(ctx),
vfs_context_ucred(ctx), NULL, R_SOFT, &nmrep, &xid, &status);
if (error == ETIMEDOUT) {
goto nfsmout;
}
if ((lockerror = nfs_node_lock(np))) {
error = lockerror;
}
if (nfsvers == NFS_VER3) {
nfsm_chain_postop_attr_update(error, &nmrep, np, &xid);
}
if (!lockerror) {
nfs_node_unlock(np);
}
if (!error) {
error = status;
}
nfsm_assert(error, NFSTONMP(np), ENXIO);
nfsmout_if(error);
lck_mtx_lock(&nmp->nm_lock);
NFS_BITMAP_SET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_SPACE_TOTAL);
NFS_BITMAP_SET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_SPACE_FREE);
NFS_BITMAP_SET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_SPACE_AVAIL);
if (nfsvers == NFS_VER3) {
NFS_BITMAP_SET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_FILES_AVAIL);
NFS_BITMAP_SET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_FILES_TOTAL);
NFS_BITMAP_SET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_FILES_FREE);
nmp->nm_fsattr.nfsa_bsize = NFS_FABLKSIZE;
nfsm_chain_get_64(error, &nmrep, nmp->nm_fsattr.nfsa_space_total);
nfsm_chain_get_64(error, &nmrep, nmp->nm_fsattr.nfsa_space_free);
nfsm_chain_get_64(error, &nmrep, nmp->nm_fsattr.nfsa_space_avail);
nfsm_chain_get_64(error, &nmrep, nmp->nm_fsattr.nfsa_files_total);
nfsm_chain_get_64(error, &nmrep, nmp->nm_fsattr.nfsa_files_free);
nfsm_chain_get_64(error, &nmrep, nmp->nm_fsattr.nfsa_files_avail);
// skip invarsec
} else {
nfsm_chain_adv(error, &nmrep, NFSX_UNSIGNED); // skip tsize?
nfsm_chain_get_32(error, &nmrep, nmp->nm_fsattr.nfsa_bsize);
nfsm_chain_get_32(error, &nmrep, val);
nfsmout_if(error);
if (nmp->nm_fsattr.nfsa_bsize <= 0) {
nmp->nm_fsattr.nfsa_bsize = NFS_FABLKSIZE;
}
nmp->nm_fsattr.nfsa_space_total = (uint64_t)val * nmp->nm_fsattr.nfsa_bsize;
nfsm_chain_get_32(error, &nmrep, val);
nfsmout_if(error);
nmp->nm_fsattr.nfsa_space_free = (uint64_t)val * nmp->nm_fsattr.nfsa_bsize;
nfsm_chain_get_32(error, &nmrep, val);
nfsmout_if(error);
nmp->nm_fsattr.nfsa_space_avail = (uint64_t)val * nmp->nm_fsattr.nfsa_bsize;
}
lck_mtx_unlock(&nmp->nm_lock);
nfsmout:
nfsm_chain_cleanup(&nmreq);
nfsm_chain_cleanup(&nmrep);
vnode_put(NFSTOV(np));
return error;
}
#if CONFIG_NFS4
int
nfs4_update_statfs(struct nfsmount *nmp, vfs_context_t ctx)
{
nfsnode_t np;
int error = 0, lockerror, status, nfsvers, numops;
u_int64_t xid;
struct nfsm_chain nmreq, nmrep;
uint32_t bitmap[NFS_ATTR_BITMAP_LEN];
struct nfs_vattr nvattr;
struct nfsreq_secinfo_args si;
nfsvers = nmp->nm_vers;
np = nmp->nm_dnp;
if (!np) {
return ENXIO;
}
if ((error = vnode_get(NFSTOV(np)))) {
return error;
}
NFSREQ_SECINFO_SET(&si, np, NULL, 0, NULL, 0);
NVATTR_INIT(&nvattr);
nfsm_chain_null(&nmreq);
nfsm_chain_null(&nmrep);
// PUTFH + GETATTR
numops = 2;
nfsm_chain_build_alloc_init(error, &nmreq, 15 * NFSX_UNSIGNED);
nfsm_chain_add_compound_header(error, &nmreq, "statfs", nmp->nm_minor_vers, numops);
numops--;
nfsm_chain_add_v4_op(error, &nmreq, NFS_OP_PUTFH);
nfsm_chain_add_fh(error, &nmreq, nfsvers, np->n_fhp, np->n_fhsize);
numops--;
nfsm_chain_add_v4_op(error, &nmreq, NFS_OP_GETATTR);
NFS_COPY_ATTRIBUTES(nfs_getattr_bitmap, bitmap);
NFS4_STATFS_ATTRIBUTES(bitmap);
nfsm_chain_add_bitmap_supported(error, &nmreq, bitmap, nmp, np);
nfsm_chain_build_done(error, &nmreq);
nfsm_assert(error, (numops == 0), EPROTO);
nfsmout_if(error);
error = nfs_request2(np, NULL, &nmreq, NFSPROC4_COMPOUND,
vfs_context_thread(ctx), vfs_context_ucred(ctx),
NULL, R_SOFT, &nmrep, &xid, &status);
nfsm_chain_skip_tag(error, &nmrep);
nfsm_chain_get_32(error, &nmrep, numops);
nfsm_chain_op_check(error, &nmrep, NFS_OP_PUTFH);
nfsm_chain_op_check(error, &nmrep, NFS_OP_GETATTR);
nfsm_assert(error, NFSTONMP(np), ENXIO);
nfsmout_if(error);
lck_mtx_lock(&nmp->nm_lock);
error = nfs4_parsefattr(&nmrep, &nmp->nm_fsattr, &nvattr, NULL, NULL, NULL);
lck_mtx_unlock(&nmp->nm_lock);
nfsmout_if(error);
if ((lockerror = nfs_node_lock(np))) {
error = lockerror;
}
if (!error) {
nfs_loadattrcache(np, &nvattr, &xid, 0);
}
if (!lockerror) {
nfs_node_unlock(np);
}
nfsm_assert(error, NFSTONMP(np), ENXIO);
nfsmout_if(error);
nmp->nm_fsattr.nfsa_bsize = NFS_FABLKSIZE;
nfsmout:
NVATTR_CLEANUP(&nvattr);
nfsm_chain_cleanup(&nmreq);
nfsm_chain_cleanup(&nmrep);
vnode_put(NFSTOV(np));
return error;
}
#endif /* CONFIG_NFS4 */
/*
* Return an NFS volume name from the mntfrom name.
*/
static void
nfs_get_volname(struct mount *mp, char *volname, size_t len, __unused vfs_context_t ctx)
{
const char *ptr, *cptr;
const char *mntfrom = vfs_statfs(mp)->f_mntfromname;
size_t mflen;
mflen = strnlen(mntfrom, MAXPATHLEN + 1);
if (mflen > MAXPATHLEN || mflen == 0) {
strlcpy(volname, "Bad volname", len);
return;
}
/* Move back over trailing slashes */
for (ptr = &mntfrom[mflen - 1]; ptr != mntfrom && *ptr == '/'; ptr--) {
mflen--;
}
/* Find first character after the last slash */
cptr = ptr = NULL;
for (size_t i = 0; i < mflen; i++) {
if (mntfrom[i] == '/') {
ptr = &mntfrom[i + 1];
}
/* And the first character after the first colon */
else if (cptr == NULL && mntfrom[i] == ':') {
cptr = &mntfrom[i + 1];
}
}
/*
* No slash or nothing after the last slash
* use everything past the first colon
*/
if (ptr == NULL || *ptr == '\0') {
ptr = cptr;
}
/* Otherwise use the mntfrom name */
if (ptr == NULL) {
ptr = mntfrom;
}
mflen = &mntfrom[mflen] - ptr;
len = mflen + 1 < len ? mflen + 1 : len;
strlcpy(volname, ptr, len);
}
/*
* The NFS VFS_GETATTR function: "statfs"-type information is retrieved
* using the nf_update_statfs() function, and other attributes are cobbled
* together from whatever sources we can (getattr, fsinfo, pathconf).
*/
int
nfs_vfs_getattr(mount_t mp, struct vfs_attr *fsap, vfs_context_t ctx)
{
struct nfsmount *nmp;
uint32_t bsize;
int error = 0, nfsvers;
nmp = VFSTONFS(mp);
if (nfs_mount_gone(nmp)) {
return ENXIO;
}
nfsvers = nmp->nm_vers;
if (VFSATTR_IS_ACTIVE(fsap, f_bsize) ||
VFSATTR_IS_ACTIVE(fsap, f_iosize) ||
VFSATTR_IS_ACTIVE(fsap, f_blocks) ||
VFSATTR_IS_ACTIVE(fsap, f_bfree) ||
VFSATTR_IS_ACTIVE(fsap, f_bavail) ||
VFSATTR_IS_ACTIVE(fsap, f_bused) ||
VFSATTR_IS_ACTIVE(fsap, f_files) ||
VFSATTR_IS_ACTIVE(fsap, f_ffree)) {
int statfsrate = nfs_statfs_rate_limit;
int refresh = 1;
/*
* Are we rate-limiting statfs RPCs?
* (Treat values less than 1 or greater than 1,000,000 as no limit.)
*/
if ((statfsrate > 0) && (statfsrate < 1000000)) {
struct timeval now;
time_t stamp;
microuptime(&now);
lck_mtx_lock(&nmp->nm_lock);
stamp = (now.tv_sec * statfsrate) + (now.tv_usec / (1000000 / statfsrate));
if (stamp != nmp->nm_fsattrstamp) {
refresh = 1;
nmp->nm_fsattrstamp = stamp;
} else {
refresh = 0;
}
lck_mtx_unlock(&nmp->nm_lock);
}
if (refresh && !nfs_use_cache(nmp)) {
error = nmp->nm_funcs->nf_update_statfs(nmp, ctx);
}
if ((error == ESTALE) || (error == ETIMEDOUT)) {
error = 0;
}
if (error) {
return NFS_MAPERR(error);
}
lck_mtx_lock(&nmp->nm_lock);
VFSATTR_RETURN(fsap, f_iosize, nfs_iosize);
VFSATTR_RETURN(fsap, f_bsize, nmp->nm_fsattr.nfsa_bsize);
bsize = nmp->nm_fsattr.nfsa_bsize;
if (NFS_BITMAP_ISSET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_SPACE_TOTAL)) {
VFSATTR_RETURN(fsap, f_blocks, nmp->nm_fsattr.nfsa_space_total / bsize);
}
if (NFS_BITMAP_ISSET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_SPACE_FREE)) {
VFSATTR_RETURN(fsap, f_bfree, nmp->nm_fsattr.nfsa_space_free / bsize);
}
if (NFS_BITMAP_ISSET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_SPACE_AVAIL)) {
VFSATTR_RETURN(fsap, f_bavail, nmp->nm_fsattr.nfsa_space_avail / bsize);
}
if (NFS_BITMAP_ISSET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_SPACE_TOTAL) &&
NFS_BITMAP_ISSET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_SPACE_FREE)) {
VFSATTR_RETURN(fsap, f_bused,
(nmp->nm_fsattr.nfsa_space_total / bsize) -
(nmp->nm_fsattr.nfsa_space_free / bsize));
}
if (NFS_BITMAP_ISSET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_FILES_TOTAL)) {
VFSATTR_RETURN(fsap, f_files, nmp->nm_fsattr.nfsa_files_total);
}
if (NFS_BITMAP_ISSET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_FILES_FREE)) {
VFSATTR_RETURN(fsap, f_ffree, nmp->nm_fsattr.nfsa_files_free);
}
lck_mtx_unlock(&nmp->nm_lock);
}
if (VFSATTR_IS_ACTIVE(fsap, f_vol_name)) {
/*%%% IF fail over support is implemented we may need to take nm_lock */
nfs_get_volname(mp, fsap->f_vol_name, MAXPATHLEN, ctx);
VFSATTR_SET_SUPPORTED(fsap, f_vol_name);
}
if (VFSATTR_IS_ACTIVE(fsap, f_capabilities)) {
u_int32_t caps, valid;
nfsnode_t np = nmp->nm_dnp;
nfsm_assert(error, VFSTONFS(mp) && np, ENXIO);
if (error) {
return NFS_MAPERR(error);
}
lck_mtx_lock(&nmp->nm_lock);
/*
* The capabilities[] array defines what this volume supports.
*
* The valid[] array defines which bits this code understands
* the meaning of (whether the volume has that capability or
* not). Any zero bits here means "I don't know what you're
* asking about" and the caller cannot tell whether that
* capability is present or not.
*/
caps = valid = 0;
if (NFS_BITMAP_ISSET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_SYMLINK_SUPPORT)) {
valid |= VOL_CAP_FMT_SYMBOLICLINKS;
if (nmp->nm_fsattr.nfsa_flags & NFS_FSFLAG_SYMLINK) {
caps |= VOL_CAP_FMT_SYMBOLICLINKS;
}
}
if (NFS_BITMAP_ISSET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_LINK_SUPPORT)) {
valid |= VOL_CAP_FMT_HARDLINKS;
if (nmp->nm_fsattr.nfsa_flags & NFS_FSFLAG_LINK) {
caps |= VOL_CAP_FMT_HARDLINKS;
}
}
if (NFS_BITMAP_ISSET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_CASE_INSENSITIVE)) {
valid |= VOL_CAP_FMT_CASE_SENSITIVE;
if (!(nmp->nm_fsattr.nfsa_flags & NFS_FSFLAG_CASE_INSENSITIVE)) {
caps |= VOL_CAP_FMT_CASE_SENSITIVE;
}
}
if (NFS_BITMAP_ISSET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_CASE_PRESERVING)) {
valid |= VOL_CAP_FMT_CASE_PRESERVING;
if (nmp->nm_fsattr.nfsa_flags & NFS_FSFLAG_CASE_PRESERVING) {
caps |= VOL_CAP_FMT_CASE_PRESERVING;
}
}
/* Note: VOL_CAP_FMT_2TB_FILESIZE is actually used to test for "large file support" */
if (NFS_BITMAP_ISSET(nmp->nm_fsattr.nfsa_bitmap, NFS_FATTR_MAXFILESIZE)) {
/* Is server's max file size at least 4GB? */
if (nmp->nm_fsattr.nfsa_maxfilesize >= 0x100000000ULL) {
caps |= VOL_CAP_FMT_2TB_FILESIZE;
}
} else if (nfsvers >= NFS_VER3) {
/*
* NFSv3 and up supports 64 bits of file size.
* So, we'll just assume maxfilesize >= 4GB
*/
caps |= VOL_CAP_FMT_2TB_FILESIZE;
}
#if CONFIG_NFS4
if (nfsvers >= NFS_VER4) {
caps |= VOL_CAP_FMT_HIDDEN_FILES;
valid |= VOL_CAP_FMT_HIDDEN_FILES;
// VOL_CAP_FMT_OPENDENYMODES
// caps |= VOL_CAP_FMT_OPENDENYMODES;
// valid |= VOL_CAP_FMT_OPENDENYMODES;
}
#endif
// no version of nfs supports immutable files
caps |= VOL_CAP_FMT_NO_IMMUTABLE_FILES;
valid |= VOL_CAP_FMT_NO_IMMUTABLE_FILES;
fsap->f_capabilities.capabilities[VOL_CAPABILITIES_FORMAT] =
// VOL_CAP_FMT_PERSISTENTOBJECTIDS |
// VOL_CAP_FMT_SYMBOLICLINKS |
// VOL_CAP_FMT_HARDLINKS |
// VOL_CAP_FMT_JOURNAL |
// VOL_CAP_FMT_JOURNAL_ACTIVE |
// VOL_CAP_FMT_NO_ROOT_TIMES |
// VOL_CAP_FMT_SPARSE_FILES |
// VOL_CAP_FMT_ZERO_RUNS |
// VOL_CAP_FMT_CASE_SENSITIVE |
// VOL_CAP_FMT_CASE_PRESERVING |
// VOL_CAP_FMT_FAST_STATFS |
// VOL_CAP_FMT_2TB_FILESIZE |
// VOL_CAP_FMT_OPENDENYMODES |
// VOL_CAP_FMT_HIDDEN_FILES |
caps;
fsap->f_capabilities.valid[VOL_CAPABILITIES_FORMAT] =
VOL_CAP_FMT_PERSISTENTOBJECTIDS |
// VOL_CAP_FMT_SYMBOLICLINKS |
// VOL_CAP_FMT_HARDLINKS |
// VOL_CAP_FMT_JOURNAL |
// VOL_CAP_FMT_JOURNAL_ACTIVE |
// VOL_CAP_FMT_NO_ROOT_TIMES |
// VOL_CAP_FMT_SPARSE_FILES |
// VOL_CAP_FMT_ZERO_RUNS |
// VOL_CAP_FMT_CASE_SENSITIVE |
// VOL_CAP_FMT_CASE_PRESERVING |
VOL_CAP_FMT_FAST_STATFS |
VOL_CAP_FMT_2TB_FILESIZE |
// VOL_CAP_FMT_OPENDENYMODES |
// VOL_CAP_FMT_HIDDEN_FILES |
valid;
/*
* We don't support most of the interfaces.
*
* We MAY support locking, but we don't have any easy way of
* probing. We can tell if there's no lockd running or if
* locks have been disabled for a mount, so we can definitely
* answer NO in that case. Any attempt to send a request to
* lockd to test for locking support may cause the lazily-
* launched locking daemons to be started unnecessarily. So
* we avoid that. However, we do record if we ever successfully
* perform a lock operation on a mount point, so if it looks
* like lock ops have worked, we do report that we support them.
*/
caps = valid = 0;
#if CONFIG_NFS4
if (nfsvers >= NFS_VER4) {
caps = VOL_CAP_INT_ADVLOCK | VOL_CAP_INT_FLOCK;
valid = VOL_CAP_INT_ADVLOCK | VOL_CAP_INT_FLOCK;
if (nmp->nm_fsattr.nfsa_flags & NFS_FSFLAG_ACL) {
caps |= VOL_CAP_INT_EXTENDED_SECURITY;
}
valid |= VOL_CAP_INT_EXTENDED_SECURITY;
if (nmp->nm_fsattr.nfsa_flags & NFS_FSFLAG_NAMED_ATTR) {
caps |= VOL_CAP_INT_EXTENDED_ATTR;
}
valid |= VOL_CAP_INT_EXTENDED_ATTR;
#if NAMEDSTREAMS
if (nmp->nm_fsattr.nfsa_flags & NFS_FSFLAG_NAMED_ATTR) {
caps |= VOL_CAP_INT_NAMEDSTREAMS;
}
valid |= VOL_CAP_INT_NAMEDSTREAMS;
#endif
} else
#endif
if (nmp->nm_lockmode == NFS_LOCK_MODE_DISABLED) {
/* locks disabled on this mount, so they definitely won't work */
valid = VOL_CAP_INT_ADVLOCK | VOL_CAP_INT_FLOCK;
} else if (nmp->nm_state & NFSSTA_LOCKSWORK) {
caps = VOL_CAP_INT_ADVLOCK | VOL_CAP_INT_FLOCK;
valid = VOL_CAP_INT_ADVLOCK | VOL_CAP_INT_FLOCK;
}
fsap->f_capabilities.capabilities[VOL_CAPABILITIES_INTERFACES] =
// VOL_CAP_INT_SEARCHFS |
// VOL_CAP_INT_ATTRLIST |
// VOL_CAP_INT_NFSEXPORT |
// VOL_CAP_INT_READDIRATTR |
// VOL_CAP_INT_EXCHANGEDATA |
// VOL_CAP_INT_COPYFILE |
// VOL_CAP_INT_ALLOCATE |
// VOL_CAP_INT_VOL_RENAME |
// VOL_CAP_INT_ADVLOCK |
// VOL_CAP_INT_FLOCK |
// VOL_CAP_INT_EXTENDED_SECURITY |
// VOL_CAP_INT_USERACCESS |
// VOL_CAP_INT_MANLOCK |
// VOL_CAP_INT_NAMEDSTREAMS |
// VOL_CAP_INT_EXTENDED_ATTR |
VOL_CAP_INT_REMOTE_EVENT |
caps;
fsap->f_capabilities.valid[VOL_CAPABILITIES_INTERFACES] =
VOL_CAP_INT_SEARCHFS |
VOL_CAP_INT_ATTRLIST |
VOL_CAP_INT_NFSEXPORT |
VOL_CAP_INT_READDIRATTR |