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 = (struct afs_exporter *)afs_osi_Alloc(length);
39 memset(ex, 0, length);
40 ObtainWriteLock(&afs_xexp, 308);
41 for (op = root_exported; op; op = op->exp_next) {
49 ReleaseWriteLock(&afs_xexp);
52 ex->exp_states = state;
59 /* Returns the "afs exporter" structure of type, "type". NULL is returned if not found */
61 exporter_find(int type)
63 struct afs_exporter *op;
65 AFS_STATCNT(exporter_add);
66 ObtainReadLock(&afs_xexp);
67 for (op = root_exported; op; op = op->exp_next) {
68 if (op->exp_type == type) {
69 ReleaseReadLock(&afs_xexp);
73 ReleaseReadLock(&afs_xexp);
74 return (struct afs_exporter *)0;
79 shutdown_exporter(void)
81 struct afs_exporter *ex, *op;
83 for (op = root_exported; op; op = ex) {
85 afs_osi_Free(op, sizeof(struct afs_exporter));