#define LINUX_VERSION_CODE 1
#define KERNEL_VERSION(a,b,c) 0
+static inline void inter_module_put(void *a)
+{
+ return;
+}
+
+extern ptl_handle_ni_t tcpnal_ni;
+
+static inline void *inter_module_get(char *arg)
+{
+
+ if (strcmp(arg, "tcpnal_ni") == 0 )
+ return &tcpnal_ni;
+ else
+ return NULL;
+
+}
+
+
/* cheats for now */
struct work_struct {
#define strnlen(a,b) strlen(a)
-#define kmalloc(a,b) malloc(a)
+static inline void *kmalloc(int size, int prot)
+{
+ return malloc(size);
+}
#define vmalloc malloc
#define vfree free
#define kfree(a) free(a)
#define MOD_INC_USE_COUNT do {int a = 1; a++; } while (0)
#define MOD_DEC_USE_COUNT do {int a = 1; a++; } while (0)
+/* module initialization */
+extern int init_obdclass(void);
+extern int ptlrpc_init(void);
+extern int ldlm_init(void);
+extern int osc_init(void);
+extern int echo_client_init(void);
+
+
/* general stuff */
+#define jiffies 0
#define EXPORT_SYMBOL(S)
#define spin_lock(l) do {int a = 1; a++; } while (0)
#define spin_unlock(l) do {int a= 1; a++; } while (0)
#define spin_lock_init(l) do {int a= 1; a++; } while (0)
+static inline void spin_lock_bh(spinlock_t *l)
+{
+ return;
+}
+static inline void spin_unlock_bh(spinlock_t *l)
+{
+ return;
+}
static inline void spin_lock_irqrestore(a,b)
{
return;
#define barrier() do {int a= 1; a++; } while (0)
/* registering symbols */
-extern void *inter_module_get(char *name);
-extern void inter_module_put(char *name);
#define ERESTARTSYS ERESTART
#define HZ 1
typedef struct {
int size;
} kmem_cache_t;
-
+#define SLAB_HWCACHE_ALIGN 0
static inline kmem_cache_t *kmem_cache_create(name,objsize,c,d,e,f)
{
return malloc(objsize);
struct timer_list {
struct list_head tl_list;
+ void (*function)(unsigned long unused);
+ void *data;
+ int expires;
};
+static inline int timer_pending(struct timer_list *l)
+{
+ if (l->expires > jiffies)
+ return 1;
+ else
+ return 0;
+}
+
+static inline int init_timer(struct timer_list *l)
+{
+ INIT_LIST_HEAD(&l->tl_list);
+}
+
+static inline void mod_timer(struct timer_list *l, int thetime)
+{
+ l->expires = thetime;
+
+}
+
+static inline void del_timer(struct timer_list *l)
+{
+ free(l);
+}
+
typedef struct { volatile int counter; } atomic_t;
#define atomic_read(a) ((a)->counter)
--- /dev/null
+#include <stdio.h>
+
+#include <liblustre.h>
+#include <../user/procbridge/procbridge.h>
+
+ptl_handle_ni_t tcpnal_ni;
+
+struct pingcli_args {
+ ptl_nid_t mynid;
+ ptl_nid_t nid;
+ ptl_pid_t port;
+ int count;
+ int size;
+};
+
+struct task_struct *current;
+
+/* portals interfaces */
+inline const ptl_handle_ni_t *
+kportal_get_ni (int nal)
+{
+ return &tcpnal_ni;
+}
+
+inline void
+kportal_put_ni (int nal)
+{
+ return;
+}
+
+void init_current(int argc, char **argv)
+{
+ current = malloc(sizeof(*current));
+ strncpy(current->comm, argv[0], sizeof(current->comm));
+ current->pid = getpid();
+
+}
+
+int init_lib_portals(struct pingcli_args *args)
+{
+ int rc;
+
+ PtlInit();
+
+ rc = PtlNIInit(procbridge_interface, 0, 0, args->mynid, &tcpnal_ni);
+ if (rc != 0) {
+ CERROR("ksocknal: PtlNIInit failed: error %d\n", rc);
+ PtlFini();
+ RETURN (rc);
+ }
+ PtlNIDebug(tcpnal_ni, ~0);
+ return rc;
+}
+
+int main(int arc, char **argv)
+{
+ struct pingcli_args *args;
+ args= malloc(sizeof(*args));
+ if (!args) {
+ printf("Malloc error\n");
+ exit(1);
+ }
+
+ args->mynid = atoi(argv[1]);
+ args->nid = atoi(argv[2]);
+ args->port = 9999;
+ args->count = atoi(argv[3]);
+ args->size = atoi(argv[4]);
+
+ init_obdclass();
+ init_lib_portals(args);
+ ptlrpc_init();
+ ldlm_init();
+ osc_init();
+ echo_client_init();
+ /* XXX lov and mdc are next */
+
+ /* XXX RR parse an lctl dump file here */
+ /* XXX RR parse dumpfile here with obdclass/class_obd.c ioct command */
+
+ printf("Hello\n");
+ return 0;
+}
+