Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <linux/bitops.h>
#include <linux/init_task.h>
#include <linux/uaccess.h>
#include <lttle/trigger.h>

#include "internal.h"
#include "mount.h"
Expand Down Expand Up @@ -4928,6 +4929,10 @@ int do_renameat2(int olddfd, struct filename *from, int newdfd,
rd.delegated_inode = &delegated_inode;
rd.flags = flags;
error = vfs_rename(&rd);
if (!error) {
struct path rpath = { .dentry = old_dentry, .mnt = new_path.mnt };
lttle_check_rename(&rpath);
}
exit5:
dput(new_dentry);
exit4:
Expand Down
2 changes: 2 additions & 0 deletions fs/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <linux/dnotify.h>
#include <linux/compat.h>
#include <linux/mnt_idmapping.h>
#include <lttle/trigger.h>

#include "internal.h"

Expand Down Expand Up @@ -1423,6 +1424,7 @@ int filp_close(struct file *filp, fl_owner_t id)
dnotify_flush(filp, id);
locks_remove_posix(filp, id);
}
lttle_check_close(filp);
fput(filp);
return retval;
}
Expand Down
46 changes: 46 additions & 0 deletions include/lttle/trigger.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#ifndef _LTTLE_TRIGGER_H
#define _LTTLE_TRIGGER_H

#include <linux/io.h>
#include <linux/ioctl.h>

struct file;
struct path;

struct lttle_watch_req {
__u32 index;
char path[256];
};

#define LTTLE_IOC_MAGIC 'L'
#define LTTLE_IOC_WATCH _IOW(LTTLE_IOC_MAGIC, 1, struct lttle_watch_req)

/* Triggers are sent via PIO port 0x510 (8-byte outl pairs).
* No MMIO mapping needed. */
#define LTTLE_TRIGGER_PIO_PORT (0x510)

#define LTTLE_SYS_AFTER_OFFSET 127
#define LTTLE_SYS_CMD_OFFSET 64

#define LTTLE_SYS_LISTEN_BEFORE 1
#define LTTLE_SYS_BIND_BEFORE 2
#define LTTLE_USERSPACE_READY 3
#define LTTLE_MANUAL_TRIGGER 10

#define LTTLE_SYS_LISTEN_AFTER (LTTLE_SYS_LISTEN_BEFORE + LTTLE_SYS_AFTER_OFFSET)
#define LTTLE_SYS_BIND_AFTER (LTTLE_SYS_BIND_BEFORE + LTTLE_SYS_AFTER_OFFSET)

#define LTTLE_CMD_FLASH_LOCK (LTTLE_SYS_CMD_OFFSET + 0)
#define LTTLE_CMD_FLASH_UNLOCK (LTTLE_SYS_CMD_OFFSET + 1)

#define LTTLE_FILE_WATCH_MAX 2

int __init lttle_subsystem_init(void);
void __exit lttle_subsystem_exit(void);
void lttle_sys_trigger(unsigned char code, char data[7]);
void lttle_sys_cmd(unsigned char cmd);
void lttle_set_watch(int index, const char *path);
void lttle_check_close(struct file *file);
void lttle_check_rename(const struct path *path);

#endif // _LTTLE_TRIGGER_H
3 changes: 2 additions & 1 deletion kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ obj-y = fork.o exec_domain.o panic.o \
extable.o params.o \
kthread.o sys_ni.o nsproxy.o \
notifier.o ksysfs.o cred.o reboot.o \
async.o range.o smpboot.o ucount.o regset.o
async.o range.o smpboot.o ucount.o regset.o \
lttle.o

obj-$(CONFIG_USERMODE_DRIVER) += usermode_driver.o
obj-$(CONFIG_MODULES) += kmod.o
Expand Down
Loading