⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lustre_lib.h

📁 lustre 1.6.5 source code
💻 H
📖 第 1 页 / 共 3 页
字号:
        ptr = overlay->ioc_bulk;        if (data->ioc_inlbuf1)                LOGL(data->ioc_inlbuf1, data->ioc_inllen1, ptr);        if (data->ioc_inlbuf2)                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 -EINVAL;        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;        overlay->ioc_inlbuf4 = data->ioc_inlbuf4;        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);        if (data->ioc_inlbuf4)                LOGU(data->ioc_inlbuf4, data->ioc_inllen4, ptr);        return 0;}#endif#include <obd_support.h>#ifdef __KERNEL__/* function defined in lustre/obdclass/<platform>/<platform>-module.c */int obd_ioctl_getdata(char **buf, int *len, void *arg);int obd_ioctl_popdata(void *arg, void *data, int len);#else/* buffer MUST be at least the size of obd_ioctl_hdr */static inline int obd_ioctl_getdata(char **buf, int *len, void *arg){        struct obd_ioctl_hdr hdr;        struct obd_ioctl_data *data;        int err;        int offset = 0;        ENTRY;        err = copy_from_user(&hdr, (void *)arg, sizeof(hdr));        if (err)                 RETURN(err);        if (hdr.ioc_version != OBD_IOCTL_VERSION) {                CERROR("Version mismatch kernel vs application\n");                RETURN(-EINVAL);        }        if (hdr.ioc_len > OBD_MAX_IOCTL_BUFFER) {                CERROR("User buffer len %d exceeds %d max buffer\n",                       hdr.ioc_len, OBD_MAX_IOCTL_BUFFER);                RETURN(-EINVAL);        }        if (hdr.ioc_len < sizeof(struct obd_ioctl_data)) {                CERROR("User buffer too small for ioctl (%d)\n", hdr.ioc_len);                RETURN(-EINVAL);        }        /* XXX allocate this more intelligently, using kmalloc when         * appropriate */        OBD_VMALLOC(*buf, hdr.ioc_len);        if (*buf == NULL) {                CERROR("Cannot allocate control buffer of len %d\n",                       hdr.ioc_len);                RETURN(-EINVAL);        }        *len = hdr.ioc_len;        data = (struct obd_ioctl_data *)*buf;        err = copy_from_user(*buf, (void *)arg, hdr.ioc_len);        if (err) {                OBD_VFREE(*buf, hdr.ioc_len);                RETURN(err);        }        if (obd_ioctl_is_invalid(data)) {                CERROR("ioctl not correctly formatted\n");                OBD_VFREE(*buf, hdr.ioc_len);                RETURN(-EINVAL);        }        if (data->ioc_inllen1) {                data->ioc_inlbuf1 = &data->ioc_bulk[0];                offset += size_round(data->ioc_inllen1);        }        if (data->ioc_inllen2) {                data->ioc_inlbuf2 = &data->ioc_bulk[0] + offset;                offset += size_round(data->ioc_inllen2);        }        if (data->ioc_inllen3) {                data->ioc_inlbuf3 = &data->ioc_bulk[0] + offset;                offset += size_round(data->ioc_inllen3);        }        if (data->ioc_inllen4) {                data->ioc_inlbuf4 = &data->ioc_bulk[0] + offset;        }        RETURN(0);}static inline int obd_ioctl_popdata(void *arg, void *data, int len){        int err = copy_to_user(arg, data, len);        if (err)                err = -EFAULT;        return err;}#endifstatic inline void obd_ioctl_freedata(char *buf, int len){        ENTRY;        OBD_VFREE(buf, len);        EXIT;        return;}/* * BSD ioctl description: * #define IOC_V1       _IOR(g, n1, long) * #define IOC_V2       _IOW(g, n2, long) * * ioctl(f, IOC_V1, arg); * arg will be treated as a long value, * * ioctl(f, IOC_V2, arg) * arg will be treated as a pointer, bsd will call * copyin(buf, arg, sizeof(long)) * * To make BSD ioctl handles argument correctly and simplely,  * we change _IOR to _IOWR so BSD will copyin obd_ioctl_data  * for us. Does this change affect Linux?  (XXX Liang) */#define OBD_IOC_CREATE                 _IOWR('f', 101, OBD_IOC_DATA_TYPE)#define OBD_IOC_DESTROY                _IOW ('f', 104, OBD_IOC_DATA_TYPE)#define OBD_IOC_PREALLOCATE            _IOWR('f', 105, OBD_IOC_DATA_TYPE)#define OBD_IOC_SETATTR                _IOW ('f', 107, OBD_IOC_DATA_TYPE)#define OBD_IOC_GETATTR                _IOWR ('f', 108, OBD_IOC_DATA_TYPE)#define OBD_IOC_READ                   _IOWR('f', 109, OBD_IOC_DATA_TYPE)#define OBD_IOC_WRITE                  _IOWR('f', 110, OBD_IOC_DATA_TYPE)#define OBD_IOC_STATFS                 _IOWR('f', 113, OBD_IOC_DATA_TYPE)#define OBD_IOC_SYNC                   _IOW ('f', 114, OBD_IOC_DATA_TYPE)#define OBD_IOC_READ2                  _IOWR('f', 115, OBD_IOC_DATA_TYPE)#define OBD_IOC_FORMAT                 _IOWR('f', 116, OBD_IOC_DATA_TYPE)#define OBD_IOC_PARTITION              _IOWR('f', 117, OBD_IOC_DATA_TYPE)#define OBD_IOC_COPY                   _IOWR('f', 120, OBD_IOC_DATA_TYPE)#define OBD_IOC_MIGR                   _IOWR('f', 121, OBD_IOC_DATA_TYPE)#define OBD_IOC_PUNCH                  _IOWR('f', 122, OBD_IOC_DATA_TYPE)#define OBD_IOC_MODULE_DEBUG           _IOWR('f', 124, OBD_IOC_DATA_TYPE)#define OBD_IOC_BRW_READ               _IOWR('f', 125, OBD_IOC_DATA_TYPE)#define OBD_IOC_BRW_WRITE              _IOWR('f', 126, OBD_IOC_DATA_TYPE)#define OBD_IOC_NAME2DEV               _IOWR('f', 127, OBD_IOC_DATA_TYPE)#define OBD_IOC_UUID2DEV               _IOWR('f', 130, OBD_IOC_DATA_TYPE)/* OBD_IOC_GETNAME_OLD is for compatibility with 1.4.x */#define OBD_IOC_GETNAME_OLD            _IOR ('f', 131, OBD_IOC_DATA_TYPE)#define OBD_IOC_GETNAME                _IOWR('f', 131, OBD_IOC_DATA_TYPE)#define OBD_IOC_LOV_GET_CONFIG         _IOWR('f', 132, OBD_IOC_DATA_TYPE)#define OBD_IOC_CLIENT_RECOVER         _IOW ('f', 133, OBD_IOC_DATA_TYPE)#define OBD_IOC_DEC_FS_USE_COUNT       _IO  ('f', 139      )#define OBD_IOC_NO_TRANSNO             _IOW ('f', 140, OBD_IOC_DATA_TYPE)#define OBD_IOC_SET_READONLY           _IOW ('f', 141, OBD_IOC_DATA_TYPE)#define OBD_IOC_ABORT_RECOVERY         _IOR ('f', 142, OBD_IOC_DATA_TYPE)#define OBD_GET_VERSION                _IOWR ('f', 144, OBD_IOC_DATA_TYPE)#define OBD_IOC_CLOSE_UUID             _IOWR ('f', 147, OBD_IOC_DATA_TYPE)#define OBD_IOC_GETDEVICE              _IOWR ('f', 149, OBD_IOC_DATA_TYPE)#define OBD_IOC_LOV_SETSTRIPE          _IOW ('f', 154, OBD_IOC_DATA_TYPE)#define OBD_IOC_LOV_GETSTRIPE          _IOW ('f', 155, OBD_IOC_DATA_TYPE)#define OBD_IOC_LOV_SETEA              _IOW ('f', 156, OBD_IOC_DATA_TYPE)#define OBD_IOC_QUOTACHECK             _IOW ('f', 160, int)#define OBD_IOC_POLL_QUOTACHECK        _IOR ('f', 161, struct if_quotacheck *)#define OBD_IOC_QUOTACTL               _IOWR('f', 162, struct if_quotactl *)#define OBD_IOC_MOUNTOPT               _IOWR('f', 170, OBD_IOC_DATA_TYPE)#define OBD_IOC_RECORD                 _IOWR('f', 180, OBD_IOC_DATA_TYPE)#define OBD_IOC_ENDRECORD              _IOWR('f', 181, OBD_IOC_DATA_TYPE)#define OBD_IOC_PARSE                  _IOWR('f', 182, OBD_IOC_DATA_TYPE)#define OBD_IOC_DORECORD               _IOWR('f', 183, OBD_IOC_DATA_TYPE)#define OBD_IOC_PROCESS_CFG            _IOWR('f', 184, OBD_IOC_DATA_TYPE)#define OBD_IOC_DUMP_LOG               _IOWR('f', 185, OBD_IOC_DATA_TYPE)#define OBD_IOC_CLEAR_LOG              _IOWR('f', 186, OBD_IOC_DATA_TYPE)#define OBD_IOC_PARAM                  _IOW ('f', 187, OBD_IOC_DATA_TYPE)#define OBD_IOC_CATLOGLIST             _IOWR('f', 190, OBD_IOC_DATA_TYPE)#define OBD_IOC_LLOG_INFO              _IOWR('f', 191, OBD_IOC_DATA_TYPE)#define OBD_IOC_LLOG_PRINT             _IOWR('f', 192, OBD_IOC_DATA_TYPE)#define OBD_IOC_LLOG_CANCEL            _IOWR('f', 193, OBD_IOC_DATA_TYPE)#define OBD_IOC_LLOG_REMOVE            _IOWR('f', 194, OBD_IOC_DATA_TYPE)#define OBD_IOC_LLOG_CHECK             _IOWR('f', 195, OBD_IOC_DATA_TYPE)#define OBD_IOC_LLOG_CATINFO           _IOWR('f', 196, OBD_IOC_DATA_TYPE)#define ECHO_IOC_GET_STRIPE            _IOWR('f', 200, OBD_IOC_DATA_TYPE)#define ECHO_IOC_SET_STRIPE            _IOWR('f', 201, OBD_IOC_DATA_TYPE)#define ECHO_IOC_ENQUEUE               _IOWR('f', 202, OBD_IOC_DATA_TYPE)#define ECHO_IOC_CANCEL                _IOWR('f', 203, OBD_IOC_DATA_TYPE)/* XXX _IOWR('f', 250, long) has been defined in * lnet/include/libcfs/kp30.h for debug, don't use it *//* Until such time as we get_info the per-stripe maximum from the OST, * we define this to be 2T - 4k, which is the ext3 maxbytes. */#define LUSTRE_STRIPE_MAXBYTES 0x1fffffff000ULL/* #define POISON_BULK 0 *//* * l_wait_event is a flexible sleeping function, permitting simple caller * configuration of interrupt and timeout sensitivity along with actions to * be performed in the event of either exception. * * The first form of usage looks like this: * * struct l_wait_info lwi = LWI_TIMEOUT_INTR(timeout, timeout_handler,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -