2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afsconfig.h>
11 #include "afs/param.h"
14 #include "afs/sysincludes.h" /* Standard vendor system headers */
15 #include "afsincludes.h" /* Afs-based standard headers */
16 #include "afs/afs_stats.h" /* statistics gathering code */
18 struct afs_exporter
*root_exported
= 0; /* Head of "exporters" link list */
22 /* Add a new "afs exporter" entry to the table of exporters. The default initial values of the entry are passed in as parameters. */
23 static afs_int32 init_xexported
= 0;
26 exporter_add(afs_int32 size
, struct exporterops
*ops
, afs_int32 state
,
27 afs_int32 type
, char *data
)
29 struct afs_exporter
*ex
, *op
;
32 AFS_STATCNT(exporter_add
);
33 if (!init_xexported
) {
35 LOCK_INIT(&afs_xexp
, "afs_xexp");
37 length
= (size
? size
: sizeof(struct afs_exporter
));
38 ex
= afs_osi_Alloc(length
);
39 osi_Assert(ex
!= NULL
);
40 memset(ex
, 0, length
);
41 ObtainWriteLock(&afs_xexp
, 308);
42 for (op
= root_exported
; op
; op
= op
->exp_next
) {
50 ReleaseWriteLock(&afs_xexp
);
53 ex
->exp_states
= state
;
60 /* Returns the "afs exporter" structure of type, "type". NULL is returned if not found */
62 exporter_find(int type
)
64 struct afs_exporter
*op
;
66 AFS_STATCNT(exporter_add
);
67 ObtainReadLock(&afs_xexp
);
68 for (op
= root_exported
; op
; op
= op
->exp_next
) {
69 if (op
->exp_type
== type
) {
70 ReleaseReadLock(&afs_xexp
);
74 ReleaseReadLock(&afs_xexp
);
75 return (struct afs_exporter
*)0;
80 shutdown_exporter(void)
82 struct afs_exporter
*ex
, *op
;
84 for (op
= root_exported
; op
; op
= ex
) {
86 afs_osi_Free(op
, sizeof(struct afs_exporter
));