#define CFS_TIME_T "%lu"
#define CFS_DURATION_T "%ld"
+#define cfs_do_gettimeofday(tv) do_gettimeofday(tv)
+
#endif /* __LIBCFS_LINUX_LINUX_TIME_H__ */
/*
* Local variables:
return 0;
}
+/*
+ * spinlock "implementation"
+ */
+
+typedef spinlock_t cfs_spinlock_t;
+
+#define cfs_spin_lock_init(lock) spin_lock_init(lock)
+#define cfs_spin_lock(lock) spin_lock(lock)
+#define cfs_spin_lock_bh(lock) spin_lock_bh(lock)
+#define cfs_spin_unlock(lock) spin_unlock(lock)
+#define cfs_spin_unlock_bh(lock) spin_unlock_bh(lock)
+
+/*
+ * rwlock "implementation"
+ */
+
+typedef rwlock_t cfs_rwlock_t;
+
+#define cfs_rwlock_init(lock) rwlock_init(lock)
+#define cfs_read_lock(lock) read_lock(lock)
+#define cfs_read_unlock(lock) read_unlock(lock)
+#define cfs_write_lock_bh(lock) write_lock_bh(lock)
+#define cfs_write_unlock_bh(lock) write_unlock_bh(lock)
+
+/*
+ * atomic
+ */
+
+typedef atomic_t cfs_atomic_t;
+
+#define cfs_atomic_read(atom) atomic_read(atom)
+#define cfs_atomic_inc(atom) atomic_inc(atom)
+#define cfs_atomic_dec(atom) atomic_dec(atom)
+#define cfs_atomic_dec_and_test(atom) atomic_dec_and_test(atom)
+#define cfs_atomic_set(atom, value) atomic_set(atom, value)
+#define cfs_atomic_add(value, atom) atomic_add(value, atom)
+#define cfs_atomic_sub(value, atom) atomic_sub(value, atom)
+
#else /* !__KERNEL__ */
#endif /* !__KERNEL__ */
#endif
#define CFS_MMSPACE_CLOSE do {} while(0)
-#define mb() do {} while(0)
-#define rmb() mb()
-#define wmb() mb()
+#define mb() do {} while(0)
+#define rmb() mb()
+#define wmb() mb()
+#define cfs_mb() mb()
/*
* MM defintions from (linux/mm.h)
} TASK_SLOT, *PTASK_SLOT;
-#define current cfs_current()
-#define set_current_state(s) do {;} while (0)
+#define current cfs_current()
+#define set_current_state(s) do {;} while (0)
+#define cfs_set_current_state(state) set_current_state(state)
#define wait_event(wq, condition) \
do { \
#define NR_IRQS 512
#define in_interrupt() (0)
+#define cfs_in_interrupt() in_interrupt()
/*
* printk flags
typedef VOID (*ks_schedule_cb)(struct socket*, int);
-#define SOCK_ERROR(s) ((s->kstc_state >= ksts_disconnected) ? ECONNRESET : 0)
#define SOCK_TEST_NOSPACE(s) (1)
//
ks_schedule_cb kstc_sched_cb; /* notification callback routine of completion */
};
-#define SOCK_WMEM_QUEUED(sock) (0)
+static inline int
+libcfs_sock_error(struct socket *sock)
+{
+ return (sock->kstc_state >= ksts_disconnected) ? ECONNRESET : 0;
+}
+
+
+static inline int
+libcfs_sock_wmem_queued(struct socket *sock)
+{
+ return 0;
+}
+
#define TDINAL_WINDOW_DEFAULT_SIZE (0x100000)
#define TDINAL_MAX_TSDU_QUEUE_SIZE (0x200000)
tv->tv_usec = (suseconds_t) (Time.QuadPart % 10000000) / 10;
}
+#define cfs_do_gettimeofday(tv) do_gettimeofday(tv)
+
static inline LONGLONG JIFFIES()
{
LARGE_INTEGER Tick;
PORTAL_MODULE_UNUSE;
}
+__u64
+ksocknal_new_incarnation (void)
+{
+ struct timeval tv;
+
+ /* The incarnation number is the time this module loaded and it
+ * identifies this particular instance of the socknal. Hopefully
+ * we won't be able to reboot more frequently than 1MHz for the
+ * forseeable future :) */
+
+ cfs_do_gettimeofday(&tv);
+
+ return (((__u64)tv.tv_sec) * 1000000) + tv.tv_usec;
+}
+
int
ksocknal_base_startup (void)
{
memset(net, 0, sizeof(*net));
cfs_spin_lock_init(&net->ksnn_lock);
- net->ksnn_incarnation = ksocknal_lib_new_incarnation();
+ net->ksnn_incarnation = ksocknal_new_incarnation();
ni->ni_data = net;
ni->ni_maxtxcredits = *ksocknal_tunables.ksnd_credits;
ni->ni_peertxcredits = *ksocknal_tunables.ksnd_peercredits;
extern void ksocknal_lib_csum_tx(ksock_tx_t *tx);
extern int ksocknal_lib_memory_pressure(ksock_conn_t *conn);
-extern __u64 ksocknal_lib_new_incarnation(void);
extern int ksocknal_lib_bind_thread_to_cpu(int id);
return rc;
}
-__u64
-ksocknal_lib_new_incarnation(void)
-{
- struct timeval tv;
-
- /* The incarnation number is the time this module loaded and it
- * identifies this particular instance of the socknal. Hopefully
- * we won't be able to reboot more frequently than 1MHz for the
- * forseeable future :) */
-
- do_gettimeofday(&tv);
-
- return (((__u64)tv.tv_sec) * 1000000) + tv.tv_usec;
-}
-
int
ksocknal_lib_bind_thread_to_cpu(int id)
{
{
return 0;
}
+
+int
+ksocknal_lib_memory_pressure(ksock_conn_t *conn)
+{
+ return 0;
+}
+
+int
+ksocknal_lib_bind_thread_to_cpu(int id)
+{
+ return 0;
+}