Not a bad idea, but it could use some extra error checking to make sure that somebody remembers to "#define __kstruct_foo" before "#include <linux/foo.h>" (perhaps indirectly through linux/bar.h). Maybe something like this (plays nice with the very-basic unifdef parsing too):
#ifdef __KERNEL__
# define __kstruct_stat stat
# define __kstruct_foo foo
# define __kstruct_bar bar
#endif
#ifdef __LINUX_KERNEL_EXPORT
# define __kstruct_stat stat
# define __kstruct_foo foo
# define __kstruct_bar bar
#endif
#ifndef __kstruct_stat
# error "Missing definition of __kstruct_stat, please insert:"
# error " #define __kstruct_stat <name-for-stat-struct>"
# error "into your C file before '#include <linux/foo.h>'"
#endif
struct __kstruct_stat {
}
Someone who wanted to keep the name __kstruct_stat could of course "#define __kstruct_stat __kstruct_stat" easily.