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.";
else
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.";
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))
#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 */

View File

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

View File

@@ -115,7 +115,7 @@ static DEFINE_SPINLOCK(dnetmap_lock);
static DEFINE_MUTEX(dnetmap_mutex);
#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
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 = {
.open = dnetmap_seq_open,
.read = seq_read,
.write = dnetmap_tg_proc_write,
.release = seq_release_private,
.owner = THIS_MODULE,
static const struct proc_ops dnetmap_tg_fops = {
.proc_open = dnetmap_seq_open,
.proc_read = seq_read,
.proc_write = dnetmap_tg_proc_write,
.proc_release = seq_release_private,
};
/* 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));
}
static const struct file_operations dnetmap_stat_proc_fops = {
.open = dnetmap_stat_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
static const struct proc_ops dnetmap_stat_proc_fops = {
.proc_open = dnetmap_stat_proc_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release,
};
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;
}
static const struct file_operations condition_proc_fops = {
.open = condition_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.write = condition_proc_write,
.release = single_release,
static const struct proc_ops condition_proc_fops = {
.proc_open = condition_proc_open,
.proc_read = seq_read,
.proc_write = condition_proc_write,
.proc_lseek = seq_lseek,
.proc_release = single_release,
};
static bool

View File

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