Whamcloud - gitweb
LU-16518 rsync: fix new clang error in lustre_rsync.c
[fs/lustre-release.git] / lustre / include / lustre_ioctl_old.h
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
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.
9  *
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).
15  *
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
19  *
20  * GPL HEADER END
21  */
22 /*
23  * This file is part of Lustre, http://www.lustre.org/
24  *
25  * Compatibility for deprecated ioctls that should no longer be used by tools.
26  *
27  * Copyright (c) 2023, DataDirect Networks Storage, all rights reserved.
28  */
29 #ifndef __LUSTRE_IOCTL_OLD_H
30 #define __LUSTRE_IOCTL_OLD_H
31
32 #include <linux/lnet/libcfs_ioctl.h> /* for IOCTL_LIBCFS_TYPE */
33
34 /* ioctl command is deprecated after release v1.v2 */
35 #define case_OBD_IOC_DEPRECATED(cmd, dev, v1, v2)                       \
36         case cmd:                                                       \
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);          \
42                 printed = true;                                         \
43         }
44
45 #define case_OBD_IOC_DEPRECATED_FT(cmd, dev, v1, v2)                    \
46         case_OBD_IOC_DEPRECATED(cmd, dev, v1, v2)                       \
47         fallthrough
48
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 */
51 #endif
52
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*/
56
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*/
59
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*/
63 #endif
64
65 #endif /* OBD_OCD_VERSION(2, 99, 53, 0) */
66
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.
69  */
70 #define OBD_IOC_CMD_LATE(cmd, name) unlikely(cmd == name)
71 #define OBD_IOC_CMD_GONE(cmd, name) (false)
72
73 #ifdef OBD_IOC_BARRIER
74 #define OBD_IOC_BARRIER_ALLOW(cmd) OBD_IOC_CMD_LATE(cmd, OBD_IOC_BARRIER)
75 #else
76 #define OBD_IOC_BARRIER_ALLOW(cmd) OBD_IOC_CMD_GONE(cmd)
77 #endif
78 #ifdef IOC_OSC_SET_ACTIVE
79 #define IOC_OSC_SET_ACTIVE_ALLOW(cmd) OBD_IOC_CMD_LATE(cmd, IOC_OSC_SET_ACTIVE)
80 #else
81 #define IOC_OSC_SET_ACTIVE_ALLOW(cmd) OBD_IOC_CMD_GONE(cmd)
82 #endif
83
84 #endif /* __LUSTRE_IOCTL_OLD_H */