4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.gnu.org/licenses/gpl-2.0.html
23 * This file is part of Lustre, http://www.lustre.org/
25 * Compatibility for deprecated ioctls that should no longer be used by tools.
27 * Copyright (c) 2023, DataDirect Networks Storage, all rights reserved.
29 #ifndef __LUSTRE_IOCTL_OLD_H
30 #define __LUSTRE_IOCTL_OLD_H
32 #include <linux/lnet/libcfs_ioctl.h> /* for IOCTL_LIBCFS_TYPE */
34 /* ioctl command is deprecated after release v1.v2 */
35 #define case_OBD_IOC_DEPRECATED(cmd, dev, v1, v2) \
37 if (LUSTRE_VERSION_CODE > OBD_OCD_VERSION(v1, v2, 53, 0)) { \
38 static bool printed; \
39 obd_ioctl_msg(__FILE__, __func__, __LINE__, \
40 printed ? D_IOCTL : D_WARNING, dev, cmd, \
41 "deprecated " #cmd " usage", 0); \
45 #define case_OBD_IOC_DEPRECATED_FT(cmd, dev, v1, v2) \
46 case_OBD_IOC_DEPRECATED(cmd, dev, v1, v2) \
49 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 19, 53, 0)
50 #define OBD_GET_VERSION _IOWR('f', 144, OBD_IOC_DATA_TYPE) /*< 2.8.55 */
53 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 99, 53, 0)
54 /* for binary compatibility until 3.0, no more compiling into tools */
55 #define OBD_IOC_GETNAME_OLD _IOWR('f', 131, OBD_IOC_DATA_TYPE) /*< 2.14.52*/
57 #define IOC_LIBCFS_GET_NI _IOWR('e', 50, IOCTL_LIBCFS_TYPE) /*< 2.15.53*/
58 #define IOC_LIBCFS_PING _IOWR('e', 61, IOCTL_LIBCFS_TYPE) /*< 2.15.53*/
60 #if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 19, 53, 0)
61 #define OBD_IOC_BARRIER _IOWR('g', 5, OBD_IOC_DATA_TYPE) /*< 2.16.55*/
62 #define IOC_OSC_SET_ACTIVE _IOWR('h', 21, void *) /*< 2.16.55*/
65 #endif /* OBD_OCD_VERSION(2, 99, 53, 0) */
67 /* We don't need *_ALLOW() macros for most ioctls, just a few using a bad
68 * _IOC_TYPE value (i.e. not 'f') so that "early exit" type checks work.
70 #define OBD_IOC_CMD_LATE(cmd, name) unlikely(cmd == name)
71 #define OBD_IOC_CMD_GONE(cmd, name) (false)
73 #ifdef OBD_IOC_BARRIER
74 #define OBD_IOC_BARRIER_ALLOW(cmd) OBD_IOC_CMD_LATE(cmd, OBD_IOC_BARRIER)
76 #define OBD_IOC_BARRIER_ALLOW(cmd) OBD_IOC_CMD_GONE(cmd)
78 #ifdef IOC_OSC_SET_ACTIVE
79 #define IOC_OSC_SET_ACTIVE_ALLOW(cmd) OBD_IOC_CMD_LATE(cmd, IOC_OSC_SET_ACTIVE)
81 #define IOC_OSC_SET_ACTIVE_ALLOW(cmd) OBD_IOC_CMD_GONE(cmd)
84 #endif /* __LUSTRE_IOCTL_OLD_H */