#include <afsconfig.h>
#include "afs/param.h"
-RCSID
- ("$Header$");
#include "afs/sysincludes.h" /* Standard vendor system headers */
#include "afsincludes.h" /* Afs-based standard headers */
#include "afs/afs_stats.h" /* afs statistics */
-
-static int osi_TimedSleep(char *event, afs_int32 ams, int aintok);
+#include "osi_compat.h"
static char waitV, dummyV;
do {
AFS_ASSERT_GLOCK();
- code = osi_TimedSleep(&waitV, ams, 1);
+ code = afs_osi_TimedSleep(&waitV, ams, 1);
if (code)
break;
if (ahandle && (ahandle->proc == (caddr_t) 0)) {
int seq; /* Sequence number: this is incremented
* by wakeup calls; wait will not return until
* it changes */
-#if defined(AFS_LINUX24_ENV)
wait_queue_head_t cond;
-#else
- struct wait_queue *cond;
-#endif
} afs_event_t;
#define HASHSIZE 128
#define afs_evhash(event) (afs_uint32) ((((long)event)>>2) & (HASHSIZE-1));
int afs_evhashcnt = 0;
+void
+osi_event_shutdown(void)
+{
+ int i;
+
+ for (i=0;i<HASHSIZE;i++) {
+ while (afs_evhasht[i] != NULL) {
+ afs_event_t *tmp = afs_evhasht[i];
+ afs_evhasht[i] = tmp->next;
+ kfree(tmp);
+ }
+ }
+}
+
/* Get and initialize event structure corresponding to lwp event (i.e. address)
* */
static afs_event_t *
* address.
*
* Locks:
- * Called with GLOCK held. However the function might drop
- * GLOCK when it calls osi_AllocSmallSpace for allocating
- * a new event (In Linux, the allocator drops GLOCK to avoid
- * a deadlock).
+ * Called with GLOCK held.
*/
static void
AFS_ASSERT_GLOCK();
hashcode = afs_evhash(event);
- newp = osi_linux_alloc(sizeof(afs_event_t), 0);
+ newp = kzalloc(sizeof(afs_event_t), GFP_NOFS);
afs_evhashcnt++;
newp->next = afs_evhasht[hashcode];
afs_evhasht[hashcode] = newp;
-#if defined(AFS_LINUX24_ENV)
init_waitqueue_head(&newp->cond);
-#else
- init_waitqueue(&newp->cond);
-#endif
- newp->seq = 0;
newp->event = &dummyV; /* Dummy address for new events */
- newp->refcount = 0;
}
#ifndef set_current_state
AFS_ASSERT_GLOCK();
AFS_GUNLOCK();
schedule();
-#ifdef AFS_LINUX26_ENV
-#ifdef CONFIG_PF
- if (current->flags & PF_FREEZE)
- refrigerator(PF_FREEZE);
-#endif
-#endif
+ afs_try_to_freeze();
+
AFS_GLOCK();
if (signal_pending(current)) {
retval = EINTR;
SIG_UNLOCK(current);
}
-/* osi_TimedSleep
+/* afs_osi_TimedSleep
*
* Arguments:
* event - event to sleep on
* Returns 0 if timeout, EINTR if signalled, and EGAIN if it might
* have raced.
*/
-static int
-osi_TimedSleep(char *event, afs_int32 ams, int aintok)
+int
+afs_osi_TimedSleep(void *event, afs_int32 ams, int aintok)
{
int code = 0;
long ticks = (ams * HZ / 1000) + 1;
* from artifically increasing. */
AFS_GUNLOCK();
- if (aintok) {
- if (schedule_timeout(ticks))
+ if (schedule_timeout(ticks)) {
+ if (aintok)
code = EINTR;
- } else
- schedule_timeout(ticks);
-#ifdef AFS_LINUX26_ENV
-#ifdef CONFIG_PF
- if (current->flags & PF_FREEZE)
- refrigerator(PF_FREEZE);
-#endif
-#endif
+ }
+
+ afs_try_to_freeze();
AFS_GLOCK();
remove_wait_queue(&evp->cond, &wait);