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 "../afs/param.h" /* Should be always first */
11 #include "../afs/sysincludes.h" /* Standard vendor system headers */
12 #include "../afs/afsincludes.h" /* Afs-based standard headers */
13 #include "../afs/afs_stats.h" /* statistics gathering code */
15 struct afs_exporter *root_exported=0; /* Head of "exporters" link list */
19 /* Add a new "afs exporter" entry to the table of exporters. The default initial values of the entry are passed in as parameters. */
20 static afs_int32 init_xexported = 0;
21 struct afs_exporter *exporter_add(size, ops, state, type, data)
22 afs_int32 size, state, type;
23 struct exporterops *ops;
26 struct afs_exporter *ex, *op;
29 AFS_STATCNT(exporter_add);
30 if (!init_xexported) {
32 LOCK_INIT(&afs_xexp, "afs_xexp");
34 length = (size ? size : sizeof(struct afs_exporter));
35 ex = (struct afs_exporter *) afs_osi_Alloc(length);
36 bzero((char *)ex, length);
37 MObtainWriteLock(&afs_xexp,308);
38 for (op = root_exported; op; op = op->exp_next) {
46 MReleaseWriteLock(&afs_xexp);
49 ex->exp_states = state;
56 /* Returns the "afs exporter" structure of type, "type". NULL is returned if not found */
57 struct afs_exporter *exporter_find(type)
60 struct afs_exporter *op;
62 AFS_STATCNT(exporter_add);
63 MObtainReadLock(&afs_xexp);
64 for (op = root_exported; op; op = op->exp_next) {
65 if (op->exp_type == type) {
66 MReleaseReadLock(&afs_xexp);
70 MReleaseReadLock(&afs_xexp);
71 return (struct afs_exporter *)0;
77 struct afs_exporter *ex, *op;
79 for (op = root_exported; op; op = ex) {
81 afs_osi_Free(op, sizeof(struct afs_exporter));