Support for Linux 5.6 procfs API

This commit is contained in:
Jan Engelhardt
2020-02-25 07:28:23 +01:00
parent fc44fcb94f
commit d31067b32e
6 changed files with 38 additions and 31 deletions

View File

@@ -57,7 +57,7 @@ if test -n "$kbuilddir"; then
echo "WARNING: Version detection did not succeed. Continue at own luck."; echo "WARNING: Version detection did not succeed. Continue at own luck.";
else else
echo "$kmajor.$kminor.$kmicro.$kstable in $kbuilddir"; echo "$kmajor.$kminor.$kmicro.$kstable in $kbuilddir";
if test "$kmajor" -gt 5 -o "$kmajor" -eq 5 -a "$kminor" -gt 4; then if test "$kmajor" -gt 5 -o "$kmajor" -eq 5 -a "$kminor" -gt 6; then
echo "WARNING: That kernel version is not officially supported yet. Continue at own luck."; echo "WARNING: That kernel version is not officially supported yet. Continue at own luck.";
elif test "$kmajor" -eq 5 -a "$kminor" -ge 0; then elif test "$kmajor" -eq 5 -a "$kminor" -ge 0; then
: :

View File

@@ -51,4 +51,13 @@ static inline struct net *par_net(const struct xt_action_param *par)
# define NF_CT_ASSERT(x) WARN_ON(!(x)) # define NF_CT_ASSERT(x) WARN_ON(!(x))
#endif #endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
# define proc_ops file_operations
# define proc_open open
# define proc_read read
# define proc_write write
# define proc_lseek llseek
# define proc_release release
#endif
#endif /* _XTABLES_COMPAT_H */ #endif /* _XTABLES_COMPAT_H */

View File

@@ -295,12 +295,11 @@ pknock_proc_open(struct inode *inode, struct file *file)
return ret; return ret;
} }
static const struct file_operations pknock_proc_ops = { static const struct proc_ops pknock_proc_ops = {
.owner = THIS_MODULE, .proc_open = pknock_proc_open,
.open = pknock_proc_open, .proc_read = seq_read,
.read = seq_read, .proc_lseek = seq_lseek,
.llseek = seq_lseek, .proc_release = seq_release,
.release = seq_release
}; };
/** /**

View File

@@ -115,7 +115,7 @@ static DEFINE_SPINLOCK(dnetmap_lock);
static DEFINE_MUTEX(dnetmap_mutex); static DEFINE_MUTEX(dnetmap_mutex);
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static const struct file_operations dnetmap_tg_fops, dnetmap_stat_proc_fops; static const struct proc_ops dnetmap_tg_fops, dnetmap_stat_proc_fops;
#endif #endif
static inline unsigned int dnetmap_entry_hash(const __be32 addr) static inline unsigned int dnetmap_entry_hash(const __be32 addr)
@@ -768,12 +768,11 @@ dnetmap_tg_proc_write(struct file *file, const char __user *input,size_t size, l
} }
static const struct file_operations dnetmap_tg_fops = { static const struct proc_ops dnetmap_tg_fops = {
.open = dnetmap_seq_open, .proc_open = dnetmap_seq_open,
.read = seq_read, .proc_read = seq_read,
.write = dnetmap_tg_proc_write, .proc_write = dnetmap_tg_proc_write,
.release = seq_release_private, .proc_release = seq_release_private,
.owner = THIS_MODULE,
}; };
/* for statistics */ /* for statistics */
@@ -817,11 +816,11 @@ 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 file_operations dnetmap_stat_proc_fops = { static const struct proc_ops dnetmap_stat_proc_fops = {
.open = dnetmap_stat_proc_open, .proc_open = dnetmap_stat_proc_open,
.read = seq_read, .proc_read = seq_read,
.llseek = seq_lseek, .proc_lseek = seq_lseek,
.release = single_release, .proc_release = single_release,
}; };
static int __net_init dnetmap_proc_net_init(struct net *net) static int __net_init dnetmap_proc_net_init(struct net *net)

View File

@@ -111,12 +111,12 @@ condition_proc_write(struct file *file, const char __user *buffer,
return length; return length;
} }
static const struct file_operations condition_proc_fops = { static const struct proc_ops condition_proc_fops = {
.open = condition_proc_open, .proc_open = condition_proc_open,
.read = seq_read, .proc_read = seq_read,
.llseek = seq_lseek, .proc_write = condition_proc_write,
.write = condition_proc_write, .proc_lseek = seq_lseek,
.release = single_release, .proc_release = single_release,
}; };
static bool static bool

View File

@@ -117,12 +117,12 @@ quota_proc_write(struct file *file, const char __user *input,
return size; return size;
} }
static const struct file_operations quota_proc_fops = { static const struct proc_ops quota_proc_fops = {
.open = quota_proc_open, .proc_open = quota_proc_open,
.read = seq_read, .proc_read = seq_read,
.llseek = seq_lseek, .proc_write = quota_proc_write,
.write = quota_proc_write, .proc_lseek = seq_lseek,
.release = single_release, .proc_release = single_release,
}; };
static struct xt_quota_counter * static struct xt_quota_counter *