move magic out of kernel, into src.
clean up/remove a ton of includes, especially of types.h (include in header if you need it, not in every .c file).