md: move compat_ioctl handling into md.c