- nfs_export **epp;
- int type = exp->m_client->m_type;
- int slen = strlen(exp->m_export.e_path);
-
- if (type < 0 || type >= MCL_MAXTYPES)
- xlog(L_FATAL, "unknown client type in export_add");
-
- epp = exportlist + type;
- while (*epp && slen <= strlen((*epp)->m_export.e_path))
- epp = &((*epp)->m_next);
- exp->m_next = *epp;
- *epp = exp;
+ exp_hash_table *p_tbl;
+ exp_hash_entry *p_hen;
+ nfs_export *p_next;
+
+ int type = exp->m_client->m_type;
+ int pos;
+
+ pos = export_hash(exp->m_export.e_path);
+ p_tbl = &(exportlist[type]); /* pointer to hash table */
+ p_hen = &(p_tbl->entries[pos]); /* pointer to hash table entry */
+
+ if (!(p_hen->p_first)) { /* hash table entry is empty */
+ p_hen->p_first = exp;
+ p_hen->p_last = exp;
+
+ exp->m_next = p_tbl->p_head;
+ p_tbl->p_head = exp;
+ } else { /* hash table entry is NOT empty */
+ p_next = p_hen->p_last->m_next;
+ p_hen->p_last->m_next = exp;
+ exp->m_next = p_next;
+ p_hen->p_last = exp;
+ }