Lines Matching full:magic
7 * binfmt_misc detects binaries via a magic or filename extension and invokes
17 #include <linux/magic.h>
43 enum {Enabled, Magic}; enumerator
52 int offset; /* offset of magic */
53 int size; /* size of magic/mask */
54 char *magic; /* magic or filename extension */ member
71 * - magic: 128 bytes (512 in escaped form)
106 if (!test_bit(Magic, &e->flags)) { in search_binfmt_handler()
107 if (p && !strcmp(e->magic, p + 1)) in search_binfmt_handler()
112 /* Do matching based on magic & mask. */ in search_binfmt_handler()
116 if ((*s++ ^ e->magic[j]) & e->mask[j]) in search_binfmt_handler()
120 if ((*s++ ^ e->magic[j])) in search_binfmt_handler()
346 * ':name:type:offset:magic:mask:interpreter:flags'
403 pr_debug("register: type: M (magic)\n"); in create_entry()
404 e->flags = (1 << Enabled) | (1 << Magic); in create_entry()
412 if (test_bit(Magic, &e->flags)) { in create_entry()
413 /* Handle the 'M' (magic) format. */ in create_entry()
431 /* Parse the 'magic' field. */ in create_entry()
432 e->magic = p; in create_entry()
436 if (!e->magic[0]) in create_entry()
440 KBUILD_MODNAME ": register: magic[raw]: ", in create_entry()
441 DUMP_PREFIX_NONE, e->magic, p - e->magic); in create_entry()
457 * Decode the magic & mask fields. in create_entry()
462 e->size = string_unescape_inplace(e->magic, UNESCAPE_HEX); in create_entry()
469 pr_debug("register: magic/mask length: %i\n", e->size); in create_entry()
472 KBUILD_MODNAME ": register: magic[decoded]: ", in create_entry()
473 DUMP_PREFIX_NONE, e->magic, e->size); in create_entry()
485 masked[i] = e->magic[i] & e->mask[i]; in create_entry()
487 KBUILD_MODNAME ": register: magic[masked]: ", in create_entry()
503 /* Parse the 'magic' field. */ in create_entry()
504 e->magic = p; in create_entry()
509 if (!e->magic[0] || strchr(e->magic, '/')) in create_entry()
511 pr_debug("register: extension: {%s}\n", e->magic); in create_entry()
604 if (!test_bit(Magic, &e->flags)) { in entry_status()
605 sprintf(dp, "extension .%s\n", e->magic); in entry_status()
608 dp = bin2hex(dp, e->magic, e->size); in entry_status()