From: maxim Date: Tue, 10 Feb 2009 18:33:35 +0000 (+0000) Subject: b=17087 X-Git-Tag: v1_9_160~18 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=9f8e9741e1cc770c766cf714f8327254c0d5fed0;ds=sidebyside b=17087 i=matt i=liang Minor fix for winnt build problems introduced by landing patch making ksocklnd more os-neutral --- diff --git a/libcfs/include/libcfs/linux/linux-time.h b/libcfs/include/libcfs/linux/linux-time.h index 8428383..7d63338 100644 --- a/libcfs/include/libcfs/linux/linux-time.h +++ b/libcfs/include/libcfs/linux/linux-time.h @@ -306,6 +306,8 @@ static inline int cfs_time_beforeq_64(__u64 t1, __u64 t2) #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: diff --git a/libcfs/include/libcfs/winnt/winnt-lock.h b/libcfs/include/libcfs/winnt/winnt-lock.h index 4c96a3e..cbff12d 100644 --- a/libcfs/include/libcfs/winnt/winnt-lock.h +++ b/libcfs/include/libcfs/winnt/winnt-lock.h @@ -760,6 +760,44 @@ static inline int wait_for_completion_interruptible(struct completion *c) 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 diff --git a/libcfs/include/libcfs/winnt/winnt-mem.h b/libcfs/include/libcfs/winnt/winnt-mem.h index 211ffef..7f3d7ae 100644 --- a/libcfs/include/libcfs/winnt/winnt-mem.h +++ b/libcfs/include/libcfs/winnt/winnt-mem.h @@ -258,9 +258,10 @@ extern cfs_mem_cache_t *cfs_page_p_slab; #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) diff --git a/libcfs/include/libcfs/winnt/winnt-prim.h b/libcfs/include/libcfs/winnt/winnt-prim.h index 6bef4c1..c5cbf65 100644 --- a/libcfs/include/libcfs/winnt/winnt-prim.h +++ b/libcfs/include/libcfs/winnt/winnt-prim.h @@ -646,8 +646,9 @@ typedef struct _TASK_SLOT { } 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 { \ @@ -867,6 +868,7 @@ libcfs_arch_cleanup(void); #define NR_IRQS 512 #define in_interrupt() (0) +#define cfs_in_interrupt() in_interrupt() /* * printk flags diff --git a/libcfs/include/libcfs/winnt/winnt-tcpip.h b/libcfs/include/libcfs/winnt/winnt-tcpip.h index ebaa4f9..0fe6230 100644 --- a/libcfs/include/libcfs/winnt/winnt-tcpip.h +++ b/libcfs/include/libcfs/winnt/winnt-tcpip.h @@ -57,7 +57,6 @@ typedef struct socket ks_tconn_t, cfs_socket_t; 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) // @@ -483,7 +482,19 @@ struct socket { 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) diff --git a/libcfs/include/libcfs/winnt/winnt-time.h b/libcfs/include/libcfs/winnt/winnt-time.h index 3c46828..0a376b7 100644 --- a/libcfs/include/libcfs/winnt/winnt-time.h +++ b/libcfs/include/libcfs/winnt/winnt-time.h @@ -125,6 +125,8 @@ static inline void do_gettimeofday(struct timeval *tv) tv->tv_usec = (suseconds_t) (Time.QuadPart % 10000000) / 10; } +#define cfs_do_gettimeofday(tv) do_gettimeofday(tv) + static inline LONGLONG JIFFIES() { LARGE_INTEGER Tick; diff --git a/lnet/klnds/socklnd/socklnd.c b/lnet/klnds/socklnd/socklnd.c index 47f28ce..1e8128c 100644 --- a/lnet/klnds/socklnd/socklnd.c +++ b/lnet/klnds/socklnd/socklnd.c @@ -2247,6 +2247,21 @@ ksocknal_base_shutdown (void) 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) { @@ -2526,7 +2541,7 @@ ksocknal_startup (lnet_ni_t *ni) 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; diff --git a/lnet/klnds/socklnd/socklnd.h b/lnet/klnds/socklnd/socklnd.h index 6354f62..a18d47d 100644 --- a/lnet/klnds/socklnd/socklnd.h +++ b/lnet/klnds/socklnd/socklnd.h @@ -586,5 +586,4 @@ extern void ksocknal_lib_tunables_fini(void); 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); diff --git a/lnet/klnds/socklnd/socklnd_lib-linux.c b/lnet/klnds/socklnd/socklnd_lib-linux.c index 6ce7d03..5b97271 100644 --- a/lnet/klnds/socklnd/socklnd_lib-linux.c +++ b/lnet/klnds/socklnd/socklnd_lib-linux.c @@ -1253,21 +1253,6 @@ ksocknal_lib_memory_pressure(ksock_conn_t *conn) 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) { diff --git a/lnet/klnds/socklnd/socklnd_lib-winnt.c b/lnet/klnds/socklnd/socklnd_lib-winnt.c index 9631483..06ef0d6 100755 --- a/lnet/klnds/socklnd/socklnd_lib-winnt.c +++ b/lnet/klnds/socklnd/socklnd_lib-winnt.c @@ -658,3 +658,15 @@ ksocknal_lib_zc_capable(ksock_conn_t *conn) { return 0; } + +int +ksocknal_lib_memory_pressure(ksock_conn_t *conn) +{ + return 0; +} + +int +ksocknal_lib_bind_thread_to_cpu(int id) +{ + return 0; +}