CFS_INIT_LIST_HEAD(&ptl_nal_table);
ptl_apini.apini_refcount = 0;
-#ifdef __KERNEL__
+#ifndef __KERNEL__
/* process */
/* Kernel NALs register themselves when their module loads, and
* unregister themselves when their module is unloaded. Userspace NALs
LASSERT (ptl_init);
CDEBUG(D_OTHER, "refs %d\n", ptl_apini.apini_refcount);
- if (ptl_apini.apini_refcount != 0) {
- rc = PTL_IFACE_DUP;
+ if (ptl_apini.apini_refcount > 0) {
ptl_apini.apini_refcount++;
+ rc = PTL_IFACE_DUP;
goto out;
}
requested_limits, actual_limits);
if (rc != PTL_OK)
goto out;
-
+
rc = ptl_startup_nalnis();
- if (rc != PTL_OK)
+ if (rc != PTL_OK) {
+ ptl_shutdown_apini();
goto out;
+ }
+
+ ptl_apini.apini_refcount = 1;
memset (handle, 0, sizeof(*handle));
LASSERT (!PtlHandleIsEqual(*handle, PTL_INVALID_HANDLE));
ptl_eq_t *eq;
unsigned long flags;
- if (!ptl_init)
- return PTL_NO_INIT;
-
- if (ptl_apini.apini_refcount == 0)
- return PTL_HANDLE_INVALID;
+ LASSERT (ptl_init);
+ LASSERT (ptl_apini.apini_refcount > 0);
/* We need count to be a power of 2 so that when eq_{enq,deq}_seq
* overflow, they don't skip entries, so the queue has the same
ptl_event_t *events;
unsigned long flags;
- if (!ptl_init)
- return PTL_NO_INIT;
-
- if (ptl_apini.apini_refcount == 0)
- return PTL_EQ_INVALID;
+ LASSERT (ptl_init);
+ LASSERT (ptl_apini.apini_refcount > 0);
PTL_LOCK(flags);
#endif
ENTRY;
- if (!ptl_init)
- RETURN(PTL_NO_INIT);
-
- if (ptl_apini.apini_refcount == 0)
- RETURN(PTL_HANDLE_INVALID);
+ LASSERT (ptl_init);
+ LASSERT (ptl_apini.apini_refcount > 0);
if (neq < 1)
RETURN(PTL_EQ_INVALID);