Lines Matching full:magic
7 * binfmt_misc detects binaries via a magic or filename extension and invokes
18 #include <linux/magic.h>
44 enum {Enabled, Magic}; enumerator
53 int offset; /* offset of magic */
54 int size; /* size of magic/mask */
55 char *magic; /* magic or filename extension */ member
72 * - magic: 128 bytes (512 in escaped form)
107 if (!test_bit(Magic, &e->flags)) { in search_binfmt_handler()
108 if (p && !strcmp(e->magic, p + 1)) in search_binfmt_handler()
113 /* Do matching based on magic & mask. */ in search_binfmt_handler()
117 if ((*s++ ^ e->magic[j]) & e->mask[j]) in search_binfmt_handler()
121 if ((*s++ ^ e->magic[j])) in search_binfmt_handler()
347 * ':name:type:offset:magic:mask:interpreter:flags'
404 pr_debug("register: type: M (magic)\n"); in create_entry()
405 e->flags = (1 << Enabled) | (1 << Magic); in create_entry()
413 if (test_bit(Magic, &e->flags)) { in create_entry()
414 /* Handle the 'M' (magic) format. */ in create_entry()
432 /* Parse the 'magic' field. */ in create_entry()
433 e->magic = p; in create_entry()
437 if (!e->magic[0]) in create_entry()
441 KBUILD_MODNAME ": register: magic[raw]: ", in create_entry()
442 DUMP_PREFIX_NONE, e->magic, p - e->magic); in create_entry()
458 * Decode the magic & mask fields. in create_entry()
463 e->size = string_unescape_inplace(e->magic, UNESCAPE_HEX); in create_entry()
470 pr_debug("register: magic/mask length: %i\n", e->size); in create_entry()
473 KBUILD_MODNAME ": register: magic[decoded]: ", in create_entry()
474 DUMP_PREFIX_NONE, e->magic, e->size); in create_entry()
486 masked[i] = e->magic[i] & e->mask[i]; in create_entry()
488 KBUILD_MODNAME ": register: magic[masked]: ", in create_entry()
504 /* Parse the 'magic' field. */ in create_entry()
505 e->magic = p; in create_entry()
510 if (!e->magic[0] || strchr(e->magic, '/')) in create_entry()
512 pr_debug("register: extension: {%s}\n", e->magic); in create_entry()
605 if (!test_bit(Magic, &e->flags)) { in entry_status()
606 sprintf(dp, "extension .%s\n", e->magic); in entry_status()
609 dp = bin2hex(dp, e->magic, e->size); in entry_status()