aboutgitcodelistschat:MatrixIRC
path: root/cooker/match.c
diff options
context:
space:
mode:
authorAlice Frosi <afrosi@redhat.com>2023-06-07 14:07:23 +0200
committerAlice Frosi <afrosi@redhat.com>2023-06-07 15:35:59 +0200
commitb2e31a6e7493c56f923cb7d86f7a8a32940393ec (patch)
tree764d0d6e5853be5b1d99bd0207ffa8f382c4f7cb /cooker/match.c
parent9812b2002de051f0051383365b2fb9863885bb60 (diff)
downloadseitan-b2e31a6e7493c56f923cb7d86f7a8a32940393ec.tar
seitan-b2e31a6e7493c56f923cb7d86f7a8a32940393ec.tar.gz
seitan-b2e31a6e7493c56f923cb7d86f7a8a32940393ec.tar.bz2
seitan-b2e31a6e7493c56f923cb7d86f7a8a32940393ec.tar.lz
seitan-b2e31a6e7493c56f923cb7d86f7a8a32940393ec.tar.xz
seitan-b2e31a6e7493c56f923cb7d86f7a8a32940393ec.tar.zst
seitan-b2e31a6e7493c56f923cb7d86f7a8a32940393ec.zip
seitan,cooker: op_resolvefd
ops: - update resolvefd with the description - add debug prints cooker: - add emit_resolvefd when match has type FDPATH
Diffstat (limited to 'cooker/match.c')
-rw-r--r--cooker/match.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/cooker/match.c b/cooker/match.c
index e9aed16..3c7650c 100644
--- a/cooker/match.c
+++ b/cooker/match.c
@@ -78,13 +78,14 @@ static union value parse_field(struct gluten_ctx *g,
enum op_cmp_type cmp, enum jump_type jump,
int index, struct field *f, JSON_Value *jvalue)
{
- struct gluten_offset const_offset, mask_offset, data_offset;
+ struct gluten_offset const_offset, mask_offset, data_offset, seccomp_offset;
union value v = { .v_num = 0 };
struct field *f_inner;
const char *tag_name;
JSON_Object *tmp;
JSON_Array *set;
JSON_Value *sel;
+ size_t size;
if (f->name)
debug(" parsing field name %s", f->name);
@@ -202,6 +203,16 @@ xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
emit_cmp(g, CMP_NE, offset, const_offset, strlen(v.v_str) + 1,
JUMP_NEXT_BLOCK);
break;
+ case FDPATH:
+ v.v_str = json_value_get_string(jvalue);
+ size = strlen(v.v_str) + 1;
+ offset = gluten_rw_alloc(g, size);
+ const_offset = emit_data(g, STRING, size, &v);
+ seccomp_offset = emit_seccomp_data(index);
+ emit_resolvefd(g, seccomp_offset, offset, size);
+ emit_cmp(g, CMP_NE, offset, const_offset, size,
+ JUMP_NEXT_BLOCK);
+ break;
case STRUCT:
for (f_inner = f->desc.d_struct; f_inner->name; f_inner++) {
JSON_Value *field_value;