Skip to content

Commit

Permalink
fix mem_reserver in 5.10.35.bsk.1-amd64 #225
Browse files Browse the repository at this point in the history
  • Loading branch information
yapple committed Mar 20, 2022
1 parent a4b054c commit be6d983
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion terark-tools/mem_reserve/mem_reserve.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/kallsyms.h>
#include <linux/mmzone.h>
#include <linux/nodemask.h>
#include <linux/version.h>

struct mem_reserve {
unsigned long size;
Expand Down Expand Up @@ -93,14 +94,23 @@ static ssize_t size_write(struct file *file, const char __user *buf,

return count;
}

#if LINUX_VERSION_CODE <= KERNEL_VERSION(5,5,19)
static const struct file_operations size_fops = {
.open = size_open,
.read = seq_read,
.write = size_write,
.llseek = seq_lseek,
.release = single_release,
};
#else
static const struct proc_ops size_fops = {
.proc_open = size_open,
.proc_read = seq_read,
.proc_write = size_write,
.proc_lseek = seq_lseek,
.proc_release = single_release,
};
#endif

static __init int mem_reserve_init(void)
{
Expand Down

0 comments on commit be6d983

Please sign in to comment.