From owner-freebsd-net Mon Oct 8 8: 4: 4 2001 Delivered-To: freebsd-net@freebsd.org Received: from rover.village.org (rover.bsdimp.com [204.144.255.66]) by hub.freebsd.org (Postfix) with ESMTP id 5D92137B401; Mon, 8 Oct 2001 08:03:56 -0700 (PDT) Received: from harmony.village.org (harmony.village.org [10.0.0.6]) by rover.village.org (8.11.3/8.11.3) with ESMTP id f98F3tu02313; Mon, 8 Oct 2001 09:03:55 -0600 (MDT) (envelope-from imp@harmony.village.org) Received: from harmony.village.org (localhost [127.0.0.1]) by harmony.village.org (8.11.6/8.11.6) with ESMTP id f98F3s759159; Mon, 8 Oct 2001 09:03:54 -0600 (MDT) (envelope-from imp@harmony.village.org) Message-Id: <200110081503.f98F3s759159@harmony.village.org> To: Yar Tikhiy Subject: Re: Some thoughts on if_ioctl() Cc: net@FreeBSD.ORG, hackers@FreeBSD.ORG In-reply-to: Your message of "Mon, 08 Oct 2001 11:32:14 +0400." <20011008113214.A68390@snark.rinet.ru> References: <20011008113214.A68390@snark.rinet.ru> Date: Mon, 08 Oct 2001 09:03:54 -0600 From: Warner Losh Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org In message <20011008113214.A68390@snark.rinet.ru> Yar Tikhiy writes: : First, the current implementation of the utility function : ether_ioctl(), which can do good job common to ethernet drivers, : won't indicate the situation when an ioctl command is unsupported : by it. It will return 0 in this case. Wouldn't it be better to : return EINVAL so the driver can do something about that? : Now each driver using ether_ioctl() has to maintain painfully the : list of the ioctl commands that may be passed to ether_ioctl(), or : the kernel will be likely to panic in copyout() dereferencing a : NULL pointer. Actaully, it should return ENOTTY rather than EINVAL. ENOTTY means that the ioctl isn't understood. I've had to fix several drivers at work that didn't follow this convention due to ignorance on the part of the driver writer. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message