#ifndef _LUSTRE_LIB_H
#define _LUSTRE_LIB_H
+#include <config.h>
+
#ifndef __KERNEL__
# include <string.h>
# include <sys/types.h>
/*
* OBD IOCTLS
*/
-#define OBD_IOCTL_VERSION 0x00010002
+#define OBD_IOCTL_VERSION 0x00010003
struct obd_ioctl_data {
uint32_t ioc_len;
uint32_t ioc_plen2;
char *ioc_pbuf2;
- /* two inline buffers */
+ /* inline buffers for various arguments */
uint32_t ioc_inllen1;
char *ioc_inlbuf1;
uint32_t ioc_inllen2;
char *ioc_inlbuf2;
uint32_t ioc_inllen3;
char *ioc_inlbuf3;
+ uint32_t ioc_inllen4;
+ char *ioc_inlbuf4;
char ioc_bulk[0];
};
len += size_round(data->ioc_inllen1);
len += size_round(data->ioc_inllen2);
len += size_round(data->ioc_inllen3);
+ len += size_round(data->ioc_inllen4);
return len;
}
printk("OBD ioctl: ioc_inllen2 larger than 1<<30\n");
return 1;
}
-
if (data->ioc_inllen3 > (1<<30)) {
printk("OBD ioctl: ioc_inllen3 larger than 1<<30\n");
return 1;
}
+ if (data->ioc_inllen4 > (1<<30)) {
+ printk("OBD ioctl: ioc_inllen4 larger than 1<<30\n");
+ return 1;
+ }
if (data->ioc_inlbuf1 && !data->ioc_inllen1) {
printk("OBD ioctl: inlbuf1 pointer but 0 length\n");
return 1;
printk("OBD ioctl: inlbuf3 pointer but 0 length\n");
return 1;
}
+ if (data->ioc_inlbuf4 && !data->ioc_inllen4) {
+ printk("OBD ioctl: inlbuf4 pointer but 0 length\n");
+ return 1;
+ }
if (data->ioc_pbuf1 && !data->ioc_plen1) {
printk("OBD ioctl: pbuf1 pointer but 0 length\n");
return 1;
printk("OBD ioctl: pbuf2 pointer but 0 length\n");
return 1;
}
- /*
- if (data->ioc_inllen1 && !data->ioc_inlbuf1) {
- printk("OBD ioctl: inllen1 set but NULL pointer\n");
- return 1;
- }
- if (data->ioc_inllen2 && !data->ioc_inlbuf2) {
- printk("OBD ioctl: inllen2 set but NULL pointer\n");
- return 1;
- }
- if (data->ioc_inllen3 && !data->ioc_inlbuf3) {
- printk("OBD ioctl: inllen3 set but NULL pointer\n");
- return 1;
- }
- */
if (data->ioc_plen1 && !data->ioc_pbuf1) {
printk("OBD ioctl: plen1 set but NULL pointer\n");
return 1;
obd_ioctl_packlen(data), data->ioc_len);
return 1;
}
-#if 0
- if (data->ioc_inllen1 &&
- data->ioc_bulk[data->ioc_inllen1 - 1] != '\0') {
- printk("OBD ioctl: inlbuf1 not 0 terminated\n");
- return 1;
- }
- if (data->ioc_inllen2 &&
- data->ioc_bulk[size_round(data->ioc_inllen1) + data->ioc_inllen2 - 1] != '\0') {
- printk("OBD ioctl: inlbuf2 not 0 terminated\n");
- return 1;
- }
- if (data->ioc_inllen3 &&
- data->ioc_bulk[size_round(data->ioc_inllen1) + size_round(data->ioc_inllen2)
- + data->ioc_inllen3 - 1] != '\0') {
- printk("OBD ioctl: inlbuf3 not 0 terminated\n");
- return 1;
- }
-#endif
return 0;
}
LOGL(data->ioc_inlbuf2, data->ioc_inllen2, ptr);
if (data->ioc_inlbuf3)
LOGL(data->ioc_inlbuf3, data->ioc_inllen3, ptr);
+ if (data->ioc_inlbuf4)
+ LOGL(data->ioc_inlbuf4, data->ioc_inllen4, ptr);
if (obd_ioctl_is_invalid(overlay))
return 1;
overlay->ioc_inlbuf1 = data->ioc_inlbuf1;
overlay->ioc_inlbuf2 = data->ioc_inlbuf2;
overlay->ioc_inlbuf3 = data->ioc_inlbuf3;
+ overlay->ioc_inlbuf4 = data->ioc_inlbuf4;
memcpy(data, pbuf, sizeof(*data));
LOGU(data->ioc_inlbuf2, data->ioc_inllen2, ptr);
if (data->ioc_inlbuf3)
LOGU(data->ioc_inlbuf3, data->ioc_inllen3, ptr);
+ if (data->ioc_inlbuf4)
+ LOGU(data->ioc_inlbuf4, data->ioc_inllen4, ptr);
return 0;
}
#include <linux/obd_support.h>
-#define OBD_MAX_IOCTL_BUFFER 8192
-
/* buffer MUST be at least the size of obd_ioctl_hdr */
static inline int obd_ioctl_getdata(char **buf, int *len, void *arg)
{
size_round(data->ioc_inllen2);
}
+ if (data->ioc_inllen4) {
+ data->ioc_inlbuf4 = &data->ioc_bulk[0] +
+ size_round(data->ioc_inllen1) +
+ size_round(data->ioc_inllen2) +
+ size_round(data->ioc_inllen3) ;
+ }
+
EXIT;
return 0;
}