Add some ifdef __KERNEL__ to allow inclusion from userspace