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"
16 #include "afs/sysincludes.h" /* Standard vendor system headers */
17 #include "afsincludes.h" /* Afs-based standard headers */
18 #include "afs/afs_stats.h" /* statistics gathering code */
20 struct afs_exporter *root_exported = 0; /* Head of "exporters" link list */
24 /* Add a new "afs exporter" entry to the table of exporters. The default initial values of the entry are passed in as parameters. */
25 static afs_int32 init_xexported = 0;
28 exporter_add(afs_int32 size, struct exporterops *ops, afs_int32 state,
29 afs_int32 type, char *data)
31 struct afs_exporter *ex, *op;
34 AFS_STATCNT(exporter_add);
35 if (!init_xexported) {
37 LOCK_INIT(&afs_xexp, "afs_xexp");
39 length = (size ? size : sizeof(struct afs_exporter));
40 ex = (struct afs_exporter *)afs_osi_Alloc(length);
41 memset((char *)ex, 0, length);
42 MObtainWriteLock(&afs_xexp, 308);
43 for (op = root_exported; op; op = op->exp_next) {
51 MReleaseWriteLock(&afs_xexp);
54 ex->exp_states = state;
61 /* Returns the "afs exporter" structure of type, "type". NULL is returned if not found */
63 exporter_find(int type)
65 struct afs_exporter *op;
67 AFS_STATCNT(exporter_add);
68 MObtainReadLock(&afs_xexp);
69 for (op = root_exported; op; op = op->exp_next) {
70 if (op->exp_type == type) {
71 MReleaseReadLock(&afs_xexp);
75 MReleaseReadLock(&afs_xexp);
76 return (struct afs_exporter *)0;
81 shutdown_exporter(void)
83 struct afs_exporter *ex, *op;
85 for (op = root_exported; op; op = ex) {
87 afs_osi_Free(op, sizeof(struct afs_exporter));