Subject: Re: COPYIN/COPYOUT macro problems Re: IOCTL implementation and kernel/userland
To: <>
From: Roland Illig <rillig@NetBSD.org>
List: tech-kern
Date: 08/25/2005 21:58:59
Reinoud Zandijk wrote:
> int kucopyin(int kernelspace, void *uaddr, void *kaddr, int len) {
> 	int retval;
> 
> 	if (!kernelspace) {
> 		return copyin(uaddr, kaddr, len);
> 	};

Bah. Please remove the semicolon.

> 
> 	/*
> 	 * returning anything other than 0 is meaningless for it would have 
> 	 * panicked the kernel allready if the address was not valid.
> 	 */
> 	kcopy(uaddr, kaddr, len);
> 	return 0;
> }

To make reading of the code easier, use as few negations as possible. I 
would reverse the "then" and the "else" part. According to 
/usr/share/misc/style, the braces around the "then" part should be removed.

Roland