These files are no longer used.
Change-Id: Iebf85590e18c2542663ebdd279b126a3ab058213
Reviewed-on: http://gerrit.openafs.org/11803
Reviewed-by: Perry Ruiter <pruiter@sinenomine.net>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Tested-by: Daria Brashear <shadow@your-file-system.com>
+++ /dev/null
-/*
- * Copyright 2000, International Business Machines Corporation and others.
- * All Rights Reserved.
- *
- * This software has been released under the terms of the IBM Public
- * License. For details, see the LICENSE file in the top-level source
- * directory or online at http://www.openafs.org/dl/license10.html
- */
-
-/*
- * rx_kmutex.c - mutex and condition variable macros for kernel environment.
- *
- * Linux implementation.
- */
-
-#include <afsconfig.h>
-#include "afs/param.h"
-
-
-#include "rx/rx_kcommon.h"
-#include "rx_kmutex.h"
-#include "rx/rx_kernel.h"
-
-void
-afs_mutex_init(afs_kmutex_t * l)
-{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
- mutex_init(&l->mutex);
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
- init_MUTEX(&l->sem);
-#else
- l->sem = MUTEX;
-#endif
- l->owner = 0;
-}
-
-void
-afs_mutex_enter(afs_kmutex_t * l)
-{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
- mutex_lock(&l->mutex);
-#else
- down(&l->sem);
-#endif
- if (l->owner)
- osi_Panic("mutex_enter: 0x%lx held by %d", (unsigned long)l, l->owner);
- l->owner = current->pid;
-}
-
-int
-afs_mutex_tryenter(afs_kmutex_t * l)
-{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
- if (mutex_trylock(&l->mutex) == 0)
-#else
- if (down_trylock(&l->sem))
-#endif
- return 0;
- l->owner = current->pid;
- return 1;
-}
-
-void
-afs_mutex_exit(afs_kmutex_t * l)
-{
- if (l->owner != current->pid)
- osi_Panic("mutex_exit: 0x%lx held by %d", (unsigned long)l, l->owner);
- l->owner = 0;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
- mutex_unlock(&l->mutex);
-#else
- up(&l->sem);
-#endif
-}
-
-/* CV_WAIT and CV_TIMEDWAIT sleep until the specified event occurs, or, in the
- * case of CV_TIMEDWAIT, until the specified timeout occurs.
- * - NOTE: that on Linux, there are circumstances in which TASK_INTERRUPTIBLE
- * can wake up, even if all signals are blocked
- * - TODO: handle signals correctly by passing an indication back to the
- * caller that the wait has been interrupted and the stack should be cleaned
- * up preparatory to signal delivery
- */
-int
-afs_cv_wait(afs_kcondvar_t * cv, afs_kmutex_t * l, int sigok)
-{
- int seq, isAFSGlocked = ISAFS_GLOCK();
- sigset_t saved_set;
-#ifdef DECLARE_WAITQUEUE
- DECLARE_WAITQUEUE(wait, current);
-#else
- struct wait_queue wait = { current, NULL };
-#endif
- sigemptyset(&saved_set);
- seq = cv->seq;
-
- set_current_state(TASK_INTERRUPTIBLE);
- add_wait_queue(&cv->waitq, &wait);
-
- if (isAFSGlocked)
- AFS_GUNLOCK();
- MUTEX_EXIT(l);
-
- if (!sigok) {
- SIG_LOCK(current);
- saved_set = current->blocked;
- sigfillset(¤t->blocked);
- RECALC_SIGPENDING(current);
- SIG_UNLOCK(current);
- }
-
- while(seq == cv->seq) {
- schedule();
- }
-
- remove_wait_queue(&cv->waitq, &wait);
- set_current_state(TASK_RUNNING);
-
- if (!sigok) {
- SIG_LOCK(current);
- current->blocked = saved_set;
- RECALC_SIGPENDING(current);
- SIG_UNLOCK(current);
- }
-
- if (isAFSGlocked)
- AFS_GLOCK();
- MUTEX_ENTER(l);
-
- return (sigok && signal_pending(current)) ? EINTR : 0;
-}
-
-void
-afs_cv_timedwait(afs_kcondvar_t * cv, afs_kmutex_t * l, int waittime)
-{
- int seq, isAFSGlocked = ISAFS_GLOCK();
- long t = waittime * HZ / 1000;
-#ifdef DECLARE_WAITQUEUE
- DECLARE_WAITQUEUE(wait, current);
-#else
- struct wait_queue wait = { current, NULL };
-#endif
- seq = cv->seq;
-
- set_current_state(TASK_INTERRUPTIBLE);
- add_wait_queue(&cv->waitq, &wait);
-
- if (isAFSGlocked)
- AFS_GUNLOCK();
- MUTEX_EXIT(l);
-
- while(seq == cv->seq) {
- t = schedule_timeout(t);
- if (!t) /* timeout */
- break;
- }
-
- remove_wait_queue(&cv->waitq, &wait);
- set_current_state(TASK_RUNNING);
-
- if (isAFSGlocked)
- AFS_GLOCK();
- MUTEX_ENTER(l);
-}
+++ /dev/null
-/*
- * Copyright 2000, International Business Machines Corporation and others.
- * All Rights Reserved.
- *
- * This software has been released under the terms of the IBM Public
- * License. For details, see the LICENSE file in the top-level source
- * directory or online at http://www.openafs.org/dl/license10.html
- */
-
-/*
- * rx_kmutex.h - mutex and condition variable macros for kernel environment.
- *
- * Linux implementation.
- * This are noops until such time as the kernel no longer has a global lock.
- */
-#ifndef RX_KMUTEX_H_
-#define RX_KMUTEX_H_
-
-#include "rx/rx_kernel.h" /* for osi_Panic() */
-
-#define RX_ENABLE_LOCKS 1
-
-#ifndef _LINUX_CODA_FS_I
-#define _LINUX_CODA_FS_I
-struct coda_inode_info {
-};
-#endif
-#include <linux/version.h>
-#include <linux/wait.h>
-#include <linux/sched.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
-#include <linux/mutex.h>
-#else
-#include <asm/semaphore.h>
-#endif
-
-typedef struct afs_kmutex {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16)
- struct mutex mutex;
-#else
- struct semaphore sem;
-#endif
- int owner;
-} afs_kmutex_t;
-
-#ifndef set_current_state
-#define set_current_state(X) current->state=X
-#endif
-
-typedef struct afs_kcondvar {
- int seq;
-#if defined(AFS_LINUX24_ENV)
- wait_queue_head_t waitq;
-#else
- struct wait_queue *waitq;
-#endif
-} afs_kcondvar_t;
-
-static inline void
-MUTEX_ASSERT(afs_kmutex_t * l)
-{
- osi_Assert(l->owner == current->pid);
-}
-
-#define MUTEX_INIT(a,b,c,d) afs_mutex_init(a)
-#define MUTEX_DESTROY(a)
-#define MUTEX_ENTER afs_mutex_enter
-#define MUTEX_TRYENTER afs_mutex_tryenter
-#define MUTEX_EXIT afs_mutex_exit
-
-#if defined(AFS_LINUX24_ENV)
-#define CV_INIT(cv,b,c,d) do { (cv)->seq = 0; init_waitqueue_head(&(cv)->waitq); } while (0)
-#else
-#define CV_INIT(cv,b,c,d) do { (cv)->seq = 0; init_waitqueue(&(cv)->waitq); } while (0)
-#endif
-#define CV_DESTROY(cv)
-#define CV_WAIT_SIG(cv, m) afs_cv_wait(cv, m, 1)
-#define CV_WAIT(cv, m) afs_cv_wait(cv, m, 0)
-#define CV_TIMEDWAIT afs_cv_timedwait
-
-#define CV_SIGNAL(cv) do { ++(cv)->seq; wake_up(&(cv)->waitq); } while (0)
-#if defined(AFS_LINUX24_ENV)
-#define CV_BROADCAST(cv) do { ++(cv)->seq; wake_up_all(&(cv)->waitq); } while (0)
-#else
-#define CV_BROADCAST(cv) do { ++(cv)->seq; wake_up(&(cv)->waitq); } while (0)
-#endif
-
-#endif /* RX_KMUTEX_H_ */
+++ /dev/null
-/*
- * Copyright 2000, International Business Machines Corporation and others.
- * All Rights Reserved.
- *
- * This software has been released under the terms of the IBM Public
- * License. For details, see the LICENSE file in the top-level source
- * directory or online at http://www.openafs.org/dl/license10.html
- */
-
-/*
- * rx_knet.c - RX kernel send, receive and timer routines.
- *
- * Linux implementation.
- */
-#include <afsconfig.h>
-#include "afs/param.h"
-
-
-#include <linux/version.h>
-#ifdef AFS_LINUX22_ENV
-#include "rx/rx_kcommon.h"
-#if defined(AFS_LINUX24_ENV)
-#include "h/smp_lock.h"
-#endif
-#include <asm/uaccess.h>
-
-/* rxk_NewSocket
- * open and bind RX socket
- */
-osi_socket *
-rxk_NewSocketHost(afs_uint32 ahost, short aport)
-{
- struct socket *sockp;
- struct sockaddr_in myaddr;
- int code;
- KERNEL_SPACE_DECL;
- int pmtu = IP_PMTUDISC_DONT;
-
- /* We need a better test for this. if you need it back, tell us
- * how to detect it.
- */
-#ifdef LINUX_KERNEL_SOCK_CREATE_V
- code = sock_create(AF_INET, SOCK_DGRAM, IPPROTO_UDP, &sockp, 0);
-#else
- code = sock_create(AF_INET, SOCK_DGRAM, IPPROTO_UDP, &sockp);
-#endif
- if (code < 0)
- return NULL;
-
- /* Bind socket */
- myaddr.sin_family = AF_INET;
- myaddr.sin_addr.s_addr = ahost;
- myaddr.sin_port = aport;
- code =
- sockp->ops->bind(sockp, (struct sockaddr *)&myaddr, sizeof(myaddr));
-
- if (code < 0) {
-#if defined(AFS_LINUX24_ENV)
- printk("sock_release(rx_socket) FIXME\n");
-#else
- sock_release(sockp);
-#endif
- return NULL;
- }
-
- TO_USER_SPACE();
- sockp->ops->setsockopt(sockp, SOL_IP, IP_MTU_DISCOVER, (char *)&pmtu,
- sizeof(pmtu));
- TO_KERNEL_SPACE();
- return (osi_socket *)sockp;
-}
-
-osi_socket *
-rxk_NewSocket(short aport)
-{
- return rxk_NewSocketHost(htonl(INADDR_ANY), aport);
-}
-
-/* free socket allocated by osi_NetSocket */
-int
-rxk_FreeSocket(struct socket *asocket)
-{
- AFS_STATCNT(osi_FreeSocket);
- return 0;
-}
-
-/* osi_NetSend
- *
- * Return codes:
- * 0 = success
- * non-zero = failure
- */
-int
-osi_NetSend(osi_socket sop, struct sockaddr_in *to, struct iovec *iovec,
- int iovcnt, afs_int32 size, int istack)
-{
- KERNEL_SPACE_DECL;
- struct msghdr msg;
- int code;
-
- msg.msg_iovlen = iovcnt;
- msg.msg_iov = iovec;
- msg.msg_name = to;
- msg.msg_namelen = sizeof(*to);
- msg.msg_control = NULL;
- msg.msg_controllen = 0;
- msg.msg_flags = 0;
-
- TO_USER_SPACE();
- code = sock_sendmsg(sop, &msg, size);
- TO_KERNEL_SPACE();
- return (code < 0) ? code : 0;
-}
-
-
-/* osi_NetReceive
- * OS dependent part of kernel RX listener thread.
- *
- * Arguments:
- * so socket to receive on, typically rx_socket
- * from pointer to a sockaddr_in.
- * iov array of iovecs to fill in.
- * iovcnt how many iovecs there are.
- * lengthp IN/OUT in: total space available in iovecs. out: size of read.
- *
- * Return
- * 0 if successful
- * error code (such as EINTER) if not
- *
- * Environment
- * Note that the maximum number of iovecs is 2 + RX_MAXWVECS. This is
- * so we have a little space to look for packets larger than
- * rx_maxReceiveSize.
- */
-int rxk_lastSocketError;
-int rxk_nSocketErrors;
-int
-osi_NetReceive(osi_socket so, struct sockaddr_in *from, struct iovec *iov,
- int iovcnt, int *lengthp)
-{
- KERNEL_SPACE_DECL;
- struct msghdr msg;
- int code;
- struct iovec tmpvec[RX_MAXWVECS + 2];
- struct socket *sop = (struct socket *)so;
-
- if (iovcnt > RX_MAXWVECS + 2) {
- osi_Panic("Too many (%d) iovecs passed to osi_NetReceive\n", iovcnt);
- }
- memcpy(tmpvec, iov, iovcnt * sizeof(struct iovec));
- msg.msg_name = from;
- msg.msg_iov = tmpvec;
- msg.msg_iovlen = iovcnt;
- msg.msg_control = NULL;
- msg.msg_controllen = 0;
- msg.msg_flags = 0;
-
- TO_USER_SPACE();
- code = sock_recvmsg(sop, &msg, *lengthp, 0);
- TO_KERNEL_SPACE();
-
- if (code < 0) {
- /* Clear the error before using the socket again.
- * Oh joy, Linux has hidden header files as well. It appears we can
- * simply call again and have it clear itself via sock_error().
- */
-#ifdef AFS_LINUX22_ENV
- flush_signals(current); /* We don't want no stinkin' signals. */
-#else
- current->signal = 0; /* We don't want no stinkin' signals. */
-#endif
- rxk_lastSocketError = code;
- rxk_nSocketErrors++;
- } else {
- *lengthp = code;
- code = 0;
- }
-
- return code;
-}
-#ifdef EXPORTED_TASKLIST_LOCK
-extern rwlock_t tasklist_lock __attribute__((weak));
-#endif
-void
-osi_StopListener(void)
-{
- extern struct task_struct *rxk_ListenerTask;
-
- while (rxk_ListenerTask) {
- if (rxk_ListenerTask) {
- flush_signals(rxk_ListenerTask);
- force_sig(SIGKILL, rxk_ListenerTask);
- }
- if (!rxk_ListenerTask)
- break;
- afs_osi_Sleep(&rxk_ListenerTask);
- }
- sock_release(rx_socket);
- rx_socket = NULL;
-}
-
-#endif /* AFS_LINUX22_ENV */