Whamcloud - gitweb
LU-7659 mdc: expose changelog through char devices
[fs/lustre-release.git] / lustre / include / lustre_ioctl.h
index 8ead377..fa63359 100644 (file)
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2013, 2014, Intel Corporation.
+ * Copyright (c) 2014, 2016, Intel Corporation.
  */
 #ifndef LUSTRE_IOCTL_H_
 #define LUSTRE_IOCTL_H_
 
+#include <linux/types.h>
 #include <libcfs/libcfs.h>
 #include <lustre/lustre_idl.h>
 
@@ -38,6 +39,7 @@
 #else /* __KERNEL__ */
 # include <malloc.h>
 # include <string.h>
+#include <libcfs/util/ioctl.h>
 #endif /* !__KERNEL__ */
 
 #if !defined(__KERNEL__) && !defined(LUSTRE_UTILS)
@@ -55,6 +57,12 @@ enum md_echo_cmd {
        ECHO_MD_ALLOC_FID       = 8, /* Get FIDs from MDT */
 };
 
+#define OBD_DEV_ID 1
+#define OBD_DEV_NAME "obd"
+#define OBD_DEV_PATH "/dev/" OBD_DEV_NAME
+#define OBD_DEV_MAJOR 10
+#define OBD_DEV_MINOR 241
+
 #define OBD_IOCTL_VERSION      0x00010004
 #define OBD_DEV_BY_DEVNAME     0xffffd0de
 #define OBD_MAX_IOCTL_BUFFER   CONFIG_LUSTRE_OBD_MAX_IOCTL_BUFFER
@@ -240,17 +248,25 @@ static inline int obd_ioctl_pack(struct obd_ioctl_data *data, char **pbuf,
        memcpy(*pbuf, data, sizeof(*data));
 
        ptr = overlay->ioc_bulk;
-       if (data->ioc_inlbuf1 != NULL)
-               LOGL(data->ioc_inlbuf1, data->ioc_inllen1, ptr);
+       if (data->ioc_inlbuf1) {
+               memcpy(ptr, data->ioc_inlbuf1, data->ioc_inllen1);
+               ptr += cfs_size_round(data->ioc_inllen1);
+       }
 
-       if (data->ioc_inlbuf2 != NULL)
-               LOGL(data->ioc_inlbuf2, data->ioc_inllen2, ptr);
+       if (data->ioc_inlbuf2) {
+               memcpy(ptr, data->ioc_inlbuf2, data->ioc_inllen2);
+               ptr += cfs_size_round(data->ioc_inllen2);
+       }
 
-       if (data->ioc_inlbuf3 != NULL)
-               LOGL(data->ioc_inlbuf3, data->ioc_inllen3, ptr);
+       if (data->ioc_inlbuf3) {
+               memcpy(ptr, data->ioc_inlbuf3, data->ioc_inllen3);
+               ptr += cfs_size_round(data->ioc_inllen3);
+       }
 
-       if (data->ioc_inlbuf4 != NULL)
-               LOGL(data->ioc_inlbuf4, data->ioc_inllen4, ptr);
+       if (data->ioc_inlbuf4) {
+               memcpy(ptr, data->ioc_inlbuf4, data->ioc_inllen4);
+               ptr += cfs_size_round(data->ioc_inllen4);
+       }
 
        if (obd_ioctl_is_invalid(overlay)) {
                fprintf(stderr, "invalid ioctl data: ioc_len = %u, "
@@ -282,17 +298,25 @@ obd_ioctl_unpack(struct obd_ioctl_data *data, char *pbuf, int max_len)
        memcpy(data, pbuf, sizeof(*data));
 
        ptr = overlay->ioc_bulk;
-       if (data->ioc_inlbuf1 != NULL)
-               LOGU(data->ioc_inlbuf1, data->ioc_inllen1, ptr);
+       if (data->ioc_inlbuf1) {
+               memcpy(data->ioc_inlbuf1, ptr, data->ioc_inllen1);
+               ptr += cfs_size_round(data->ioc_inllen1);
+       }
 
-       if (data->ioc_inlbuf2 != NULL)
-               LOGU(data->ioc_inlbuf2, data->ioc_inllen2, ptr);
+       if (data->ioc_inlbuf2) {
+               memcpy(data->ioc_inlbuf2, ptr, data->ioc_inllen2);
+               ptr += cfs_size_round(data->ioc_inllen2);
+       }
 
-       if (data->ioc_inlbuf3 != NULL)
-               LOGU(data->ioc_inlbuf3, data->ioc_inllen3, ptr);
+       if (data->ioc_inlbuf3) {
+               memcpy(data->ioc_inlbuf3, ptr, data->ioc_inllen3);
+               ptr += cfs_size_round(data->ioc_inllen3);
+       }
 
-       if (data->ioc_inlbuf4 != NULL)
-               LOGU(data->ioc_inlbuf4, data->ioc_inllen4, ptr);
+       if (data->ioc_inlbuf4) {
+               memcpy(data->ioc_inlbuf4, ptr, data->ioc_inllen4);
+               ptr += cfs_size_round(data->ioc_inllen4);
+       }
 
        return 0;
 }
@@ -349,7 +373,7 @@ obd_ioctl_unpack(struct obd_ioctl_data *data, char *pbuf, int max_len)
 #define OBD_GET_VERSION                _IOWR('f', 144, OBD_IOC_DATA_TYPE)
 /*     OBD_IOC_GSS_SUPPORT     _IOWR('f', 145, OBD_IOC_DATA_TYPE) */
 /*     OBD_IOC_CLOSE_UUID      _IOWR('f', 147, OBD_IOC_DATA_TYPE) */
-#define OBD_IOC_CHANGELOG_SEND _IOW ('f', 148, OBD_IOC_DATA_TYPE)
+/*     OBD_IOC_CHANGELOG_SEND  _IOW ('f', 148, OBD_IOC_DATA_TYPE) */
 #define OBD_IOC_GETDEVICE      _IOWR('f', 149, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_FID2PATH       _IOWR('f', 150, OBD_IOC_DATA_TYPE)
 /*     lustre/lustre_user.h    151-153 */
@@ -389,6 +413,8 @@ obd_ioctl_unpack(struct obd_ioctl_data *data, char *pbuf, int max_len)
 /*     ECHO_IOC_ENQUEUE        _IOWR('f', 202, OBD_IOC_DATA_TYPE) */
 /*     ECHO_IOC_CANCEL         _IOWR('f', 203, OBD_IOC_DATA_TYPE) */
 
+#define OBD_IOC_LCFG_FORK      _IOWR('f', 208, OBD_IOC_DATA_TYPE)
+#define OBD_IOC_LCFG_ERASE     _IOWR('f', 209, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_GET_OBJ_VERSION        _IOR ('f', 210, OBD_IOC_DATA_TYPE)
 
 /*     lustre/lustre_user.h    212-217 */
@@ -397,9 +423,12 @@ obd_ioctl_unpack(struct obd_ioctl_data *data, char *pbuf, int max_len)
 #define OBD_IOC_ECHO_ALLOC_SEQ _IOWR('f', 222, struct obd_ioctl_data)
 #define OBD_IOC_START_LFSCK    _IOWR('f', 230, OBD_IOC_DATA_TYPE)
 #define OBD_IOC_STOP_LFSCK     _IOW ('f', 231, OBD_IOC_DATA_TYPE)
+#define OBD_IOC_QUERY_LFSCK    _IOR('f', 232, struct obd_ioctl_data)
 /*     lustre/lustre_user.h    240-249 */
 /*     LIBCFS_IOC_DEBUG_MASK   250 */
 
+#define OBD_IOC_BARRIER                _IOWR('f', 261, OBD_IOC_DATA_TYPE)
+
 #define IOC_OSC_SET_ACTIVE     _IOWR('h', 21, void *)
 
 #endif /* LUSTRE_IOCTL_H_ */