Commit 09e77d26 authored by 恒宇 梁's avatar 恒宇 梁
Browse files

create a global var by using global functions

parent 499dd723
......@@ -3645,8 +3645,17 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
}
EXPORT_SYMBOL(vfs_mkdir);
int print_flag_namei = 0;
long do_mkdirat(int dfd, const char __user *pathname, umode_t mode)
{
/////////////////////change start:
if (print_flag_namei == 0){
printk("from namei, address of print_flag_namei: %llu\n", &print_flag_namei);
printk("from namei, number of flag_openat_sBPF: %d\n", get_flag_openat_sBPF());
print_flag_namei = 1;
}
/////////////////////change end
struct dentry *dentry;
struct path path;
int error;
......
......@@ -1160,11 +1160,24 @@ struct file *file_open_root(struct dentry *dentry, struct vfsmount *mnt,
}
EXPORT_SYMBOL(file_open_root);
///////////////////////////////////change start:
int flag_openat_sBPF = 0;
//////////////////////////////////
//const char* default_sBPF_openat_prog(const char * filename){
// return filename;
//}
int get_flag_openat_sBPF()
{
return flag_openat_sBPF;
}
void set_flag_openat_sBPF(int num)
{
flag_openat_sBPF = num;
}
EXPORT_SYMBOL(get_flag_openat_sBPF);
EXPORT_SYMBOL(set_flag_openat_sBPF);
static const char* (*sBPF_hook_openat_prog)(const char * filename)=NULL;
//////////////////////////////////change end
int print_flag = 0;
......
......@@ -88,12 +88,11 @@ extern int sysctl_protected_regular;
//const char* default_sBPF_openat_prog(const char * filename);
static int flag_openat_sBPF=0;
static const char* (*sBPF_hook_openat_prog)(const char * filename)=NULL;
//EXPORT_SYMBOL(flag_openat_sBPF);
//EXPORT_SYMBOL(sBPF_hook_openat_prog);
//static int flag_openat_sBPF=0;
//static const char* (*sBPF_hook_openat_prog)(const char * filename)=NULL;
extern int get_flag_openat_sBPF(void);
extern void set_flag_openat_sBPF(int num);
/////////////////////////////////
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment