# include <string.h>
#else
# include <asm/semaphore.h>
-#include <linux/kp30.h> /* XXX just for LASSERT! */
#endif
+#include <linux/types.h>
#include <linux/portals_lib.h>
+#include <linux/kp30.h> /* XXX just for LASSERT! */
#include <linux/lustre_idl.h>
+#ifndef LPU64
#if BITS_PER_LONG > 32
#define LPU64 "%lu"
#define LPD64 "%ld"
#define LPD64 "%Ld"
#define LPX64 "%#Lx"
#endif
+#endif
#ifdef __KERNEL__
/* l_net.c */
struct ptlrpc_request;
struct obd_device;
struct recovd_data;
+struct recovd_obd;
+#include <linux/lustre_ha.h>
int target_handle_connect(struct ptlrpc_request *req);
int target_handle_disconnect(struct ptlrpc_request *req);
int client_obd_connect(struct lustre_handle *conn, struct obd_device *obd,
- obd_uuid_t cluuid);
+ obd_uuid_t cluuid, struct recovd_obd *recovd,
+ ptlrpc_recovery_cb_t recover);
int client_obd_disconnect(struct lustre_handle *conn);
int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf);
int client_obd_cleanup(struct obd_device * obddev);
void l_lock_init(struct lustre_lock *);
void l_lock(struct lustre_lock *);
void l_unlock(struct lustre_lock *);
+int l_has_lock(struct lustre_lock *);
-
-/* page.c */
#define CB_PHASE_START 12
#define CB_PHASE_FINISH 13
-/*
- * io_cb_data: io callback data merged into one struct to simplify
- * memory managment. This may be turn out to be too simple.
- */
-struct io_cb_data;
-typedef int (*brw_callback_t)(struct io_cb_data *, int err, int phase);
+/* This list head doesn't need to be locked, because it's only manipulated by
+ * one thread at a time. */
+struct obd_brw_set {
+ struct list_head brw_desc_head; /* list of ptlrpc_bulk_desc */
+ wait_queue_head_t brw_waitq;
+ atomic_t brw_refcount;
+ int brw_flags;
-struct io_cb_data {
- wait_queue_head_t waitq;
- atomic_t refcount;
- int complete;
- int err;
- struct ptlrpc_bulk_desc *desc;
- brw_callback_t cb;
- void *data;
+ int (*brw_callback)(struct obd_brw_set *, int phase);
};
-int ll_sync_io_cb(struct io_cb_data *data, int err, int phase);
-struct io_cb_data *ll_init_cb(void);
-
/* simple.c */
struct obd_run_ctxt;
struct obd_ucred;
-void push_ctxt(struct obd_run_ctxt *save, struct obd_run_ctxt *new,
+void push_ctxt(struct obd_run_ctxt *save, struct obd_run_ctxt *new_ctx,
struct obd_ucred *cred);
-void pop_ctxt(struct obd_run_ctxt *saved);
+void pop_ctxt(struct obd_run_ctxt *saved, struct obd_run_ctxt *new_ctx,
+ struct obd_ucred *cred);
struct dentry *simple_mkdir(struct dentry *dir, char *name, int mode);
struct dentry *simple_mknod(struct dentry *dir, char *name, int mode);
int lustre_fread(struct file *file, char *str, int len, loff_t *off);
data->ioc_len = obd_ioctl_packlen(data);
data->ioc_version = OBD_IOCTL_VERSION;
- if (*pbuf && obd_ioctl_packlen(data) > max)
+ if (*pbuf && data->ioc_len > max)
return 1;
if (*pbuf == NULL) {
*pbuf = malloc(data->ioc_len);
return 0;
}
+static inline int obd_ioctl_unpack(struct obd_ioctl_data *data, char *pbuf,
+ int max)
+{
+ char *ptr;
+ struct obd_ioctl_data *overlay;
+
+ if (!pbuf)
+ return 1;
+ overlay = (struct obd_ioctl_data *)pbuf;
+
+ /* Preserve the caller's buffer pointers */
+ overlay->ioc_inlbuf1 = data->ioc_inlbuf1;
+ overlay->ioc_inlbuf2 = data->ioc_inlbuf2;
+ overlay->ioc_inlbuf3 = data->ioc_inlbuf3;
+
+ memcpy(data, pbuf, sizeof(*data));
+
+ ptr = overlay->ioc_bulk;
+ if (data->ioc_inlbuf1)
+ LOGU(data->ioc_inlbuf1, data->ioc_inllen1, ptr);
+ if (data->ioc_inlbuf2)
+ LOGU(data->ioc_inlbuf2, data->ioc_inllen2, ptr);
+ if (data->ioc_inlbuf3)
+ LOGU(data->ioc_inlbuf3, data->ioc_inllen3, ptr);
+
+ return 0;
+}
#else
#include <linux/obd_support.h>
int err;
ENTRY;
-
err = copy_from_user(&hdr, (void *)arg, sizeof(hdr));
if ( err ) {
EXIT;
#define OBD_IOC_UUID2DEV _IOWR('f', 130, long)
#define OBD_IOC_RECOVD_NEWCONN _IOWR('f', 131, long)
-#define OBD_IOC_LOV_CONFIG _IOWR('f', 132, long)
-
-#define OBD_IOC_DEC_FS_USE_COUNT _IO ('f', 133 )
+#define OBD_IOC_LOV_SET_CONFIG _IOWR('f', 132, long)
+#define OBD_IOC_LOV_GET_CONFIG _IOWR('f', 133, long)
+#define OBD_IOC_LOV_CONFIG OBD_IOC_LOV_SET_CONFIG
#define OBD_IOC_OPEN _IOWR('f', 134, long)
#define OBD_IOC_CLOSE _IOWR('f', 135, long)
#define OBD_IOC_RECOVD_FAILCONN _IOWR('f', 136, long)
+#define OBD_IOC_DEC_FS_USE_COUNT _IO ('f', 139 )
+
+#define OBD_GET_VERSION _IOWR ('f', 144, long)
+
/*
* l_wait_event is a flexible sleeping function, permitting simple caller
* configuration of interrupt and timeout sensitivity along with actions to
* waitq or some similar mechanism, or an interrupt occurs (if the caller has
* asked for interrupts to be detected). The timeout will only fire once, so
* callers should take care that a timeout_handler which returns zero will take
- * future steps to awaken the process. N.B. that these steps must include making
- * the provided condition become true.
+ * future steps to awaken the process. N.B. that these steps must include
+ * making the provided condition become true.
*
* If the interrupt flag (lwi_signals) is non-zero, then the process will be
* interruptible, and will be awakened by any "killable" signal (SIGTERM,
if (condition) \
break; \
if (__state == TASK_INTERRUPTIBLE && l_killable_pending(current)) {\
- CERROR("lwe: interrupt\n"); \
if (info->lwi_on_signal) \
info->lwi_on_signal(info->lwi_cb_data); \
ret = -EINTR; \
} \
if (info->lwi_timeout && !__timed_out) { \
if (schedule_timeout(info->lwi_timeout) == 0) { \
- CERROR("lwe: timeout\n"); \
__timed_out = 1; \
if (!info->lwi_on_timeout || \
info->lwi_on_timeout(info->lwi_cb_data)) { \
__state = TASK_INTERRUPTIBLE; \
/* Check for a pending interrupt. */ \
if (info->lwi_signals && l_killable_pending(current)) {\
- CERROR("lwe: pending interrupt\n"); \
if (info->lwi_on_signal) \
info->lwi_on_signal(info->lwi_cb_data); \
ret = -EINTR; \