aboutgitcodelistschat:MatrixIRC
path: root/seitan.c
diff options
context:
space:
mode:
authorAlice Frosi <afrosi@redhat.com>2023-05-02 17:21:57 +0200
committerAlice Frosi <afrosi@redhat.com>2023-05-08 14:36:43 +0200
commitc29157e78df7fa335c56d0d7f2cca7dc50bfffd6 (patch)
tree6c7ce428c01a602f89c8897015e7428b84038871 /seitan.c
parent82b77505f9420f11d614c2ae0f74153ca4ee3cb5 (diff)
downloadseitan-c29157e78df7fa335c56d0d7f2cca7dc50bfffd6.tar
seitan-c29157e78df7fa335c56d0d7f2cca7dc50bfffd6.tar.gz
seitan-c29157e78df7fa335c56d0d7f2cca7dc50bfffd6.tar.bz2
seitan-c29157e78df7fa335c56d0d7f2cca7dc50bfffd6.tar.lz
seitan-c29157e78df7fa335c56d0d7f2cca7dc50bfffd6.tar.xz
seitan-c29157e78df7fa335c56d0d7f2cca7dc50bfffd6.tar.zst
seitan-c29157e78df7fa335c56d0d7f2cca7dc50bfffd6.zip
seitan: refactor operations
Refactoring: - rename do_operations to eval and reduce the number of arguments - create macro HANDLE_OP - rename all functions with op_*(operation name) - exposed the op_* functions in the operations.h Fixes: - use pread for op_load
Diffstat (limited to 'seitan.c')
-rw-r--r--seitan.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/seitan.c b/seitan.c
index e2e5347..4a4cc86 100644
--- a/seitan.c
+++ b/seitan.c
@@ -184,6 +184,7 @@ int main(int argc, char **argv)
struct epoll_event ev, events[EPOLL_EVENTS];
struct seccomp_notif *req = (struct seccomp_notif *)req_b;
struct arguments arguments;
+ struct op operations[INST_MAX];
char path[PATH_MAX + 1];
bool running = true;
int pidfd, notifier;
@@ -236,19 +237,7 @@ int main(int argc, char **argv)
/* The notifier fd was closed by the target */
running = false;
} else if (notifier == events[i].data.fd) {
- /*
- * TODO: remove until we parse correctly the
- * operations from the bytecode
- */
- struct op operations[] = {
- { .type = OP_CONT },
- };
- if (do_operations(NULL, operations, req,
- sizeof(operations) /
- sizeof(operations[0]),
- notifier) == -1)
- die(" failed executing operation");
-
+ eval(NULL, &operations[0], req, notifier);
}
}
}