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"
15 #include "../afs/sysincludes.h" /* Standard vendor system headers */
16 #include "../afs/afsincludes.h" /* Afs-based standard headers */
17 #include "../afs/afs_stats.h" /* statistics gathering code */
19 struct afs_exporter *root_exported=0; /* Head of "exporters" link list */
23 /* Add a new "afs exporter" entry to the table of exporters. The default initial values of the entry are passed in as parameters. */
24 static afs_int32 init_xexported = 0;
25 struct afs_exporter *exporter_add(size, ops, state, type, data)
26 afs_int32 size, state, type;
27 struct exporterops *ops;
30 struct afs_exporter *ex, *op;
33 AFS_STATCNT(exporter_add);
34 if (!init_xexported) {
36 LOCK_INIT(&afs_xexp, "afs_xexp");
38 length = (size ? size : sizeof(struct afs_exporter));
39 ex = (struct afs_exporter *) afs_osi_Alloc(length);
40 memset((char *)ex, 0, length);
41 MObtainWriteLock(&afs_xexp,308);
42 for (op = root_exported; op; op = op->exp_next) {
50 MReleaseWriteLock(&afs_xexp);
53 ex->exp_states = state;
60 /* Returns the "afs exporter" structure of type, "type". NULL is returned if not found */
61 struct afs_exporter *exporter_find(type)
64 struct afs_exporter *op;
66 AFS_STATCNT(exporter_add);
67 MObtainReadLock(&afs_xexp);
68 for (op = root_exported; op; op = op->exp_next) {
69 if (op->exp_type == type) {
70 MReleaseReadLock(&afs_xexp);
74 MReleaseReadLock(&afs_xexp);
75 return (struct afs_exporter *)0;
81 struct afs_exporter *ex, *op;
83 for (op = root_exported; op; op = ex) {
85 afs_osi_Free(op, sizeof(struct afs_exporter));