The `PDE_DATA` function for retrieving private data from a procfs inode
has been replaced by `pde_data` in 5.17. Replace all instances of the
former with the latter, but add a macro to xtables_compat.h in order to
preserve compatibility with older kernels.
Link: https://lore.kernel.org/lkml/20211124081956.87711-1-songmuchun@bytedance.com/
Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
# define ip_route_me_harder(xnet, xsk, xskb, xaddrtype) ip_route_me_harder((xnet), (xskb), (xaddrtype))
# define ip6_route_me_harder(xnet, xsk, xskb) ip6_route_me_harder((xnet), (xskb))
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
+# define pde_data(inode) PDE_DATA(inode)
+#endif
static inline struct net *par_net(const struct xt_action_param *par)
{
int ret = seq_open(file, &pknock_seq_ops);
if (ret == 0) {
struct seq_file *sf = file->private_data;
- sf->private = PDE_DATA(inode);
+ sf->private = pde_data(inode);
}
return ret;
}
st = __seq_open_private(file, &dnetmap_seq_ops, sizeof(*st));
if (st == NULL)
return -ENOMEM;
-
- st->p = PDE_DATA(inode);
+ st->p = pde_data(inode);
return 0;
}
static ssize_t
dnetmap_tg_proc_write(struct file *file, const char __user *input,size_t size, loff_t *loff)
{
- struct dnetmap_prefix *p = PDE_DATA(file_inode(file));
+ struct dnetmap_prefix *p = pde_data(file_inode(file));
struct dnetmap_entry *e;
char buf[sizeof("+192.168.100.100:200.200.200.200")];
const char *c = buf;
static int dnetmap_stat_proc_open(struct inode *inode, struct file *file)
{
- return single_open(file, dnetmap_stat_proc_show, PDE_DATA(inode));
+ return single_open(file, dnetmap_stat_proc_show, pde_data(inode));
}
static const struct proc_ops dnetmap_stat_proc_fops = {
static int condition_proc_open(struct inode *inode, struct file *file)
{
- return single_open(file, condition_proc_show, PDE_DATA(inode));
+ return single_open(file, condition_proc_show, pde_data(inode));
}
static ssize_t
condition_proc_write(struct file *file, const char __user *buffer,
size_t length, loff_t *loff)
{
- struct condition_variable *var = PDE_DATA(file_inode(file));
+ struct condition_variable *var = pde_data(file_inode(file));
char newval;
if (length > 0) {
static int quota_proc_open(struct inode *inode, struct file *file)
{
- return single_open(file, quota_proc_show, PDE_DATA(inode));
+ return single_open(file, quota_proc_show, pde_data(inode));
}
static ssize_t
quota_proc_write(struct file *file, const char __user *input,
size_t size, loff_t *loff)
{
- struct xt_quota_counter *e = PDE_DATA(file_inode(file));
+ struct xt_quota_counter *e = pde_data(file_inode(file));
char buf[sizeof("+-18446744073709551616")];
if (size > sizeof(buf))