From owner-freebsd-arch@FreeBSD.ORG Mon Feb 27 08:38:18 2006 Return-Path: X-Original-To: arch@FreeBSD.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B3D3216A420; Mon, 27 Feb 2006 08:38:18 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (cell.sick.ru [217.72.144.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id DC09243D45; Mon, 27 Feb 2006 08:38:17 +0000 (GMT) (envelope-from glebius@FreeBSD.org) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.13.3/8.13.3) with ESMTP id k1R8cFXO005056 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 27 Feb 2006 11:38:16 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.sick.ru (8.13.3/8.13.1/Submit) id k1R8cFu2005055; Mon, 27 Feb 2006 11:38:15 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.sick.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 27 Feb 2006 11:38:15 +0300 From: Gleb Smirnoff To: arch@FreeBSD.org Message-ID: <20060227083815.GW55275@cell.sick.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline User-Agent: Mutt/1.5.6i Cc: yar@FreeBSD.org, jlemon@FreeBSD.org Subject: changing EINVAL for SIOCSIFCAP to something else X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Feb 2006 08:38:18 -0000 Colleagues, I'd like to replace the unpleasant one-for-all error code EINVAL to something else in this part of code of src/sys/net/if.c:ifhwioctl() case SIOCSIFCAP: error = suser(td); if (error) return (error); if (ifp->if_ioctl == NULL) return (EOPNOTSUPP); if (ifr->ifr_reqcap & ~ifp->if_capabilities) return (EINVAL); IFF_LOCKGIANT(ifp); error = (*ifp->if_ioctl)(ifp, cmd, data); IFF_UNLOCKGIANT(ifp); if (error == 0) getmicrotime(&ifp->if_lastchange); break; The possible variants are: #define ENODEV 19 /* Operation not supported by device */ #define ENOTTY 25 /* Inappropriate ioctl for device */ #define ENOPROTOOPT 42 /* Protocol not available */ #define EPROTONOSUPPORT 43 /* Protocol not supported */ I prefer this variant: if (ifp->if_ioctl == NULL) return (ENOTTY); if (ifr->ifr_reqcap & ~ifp->if_capabilities) return (ENODEV); Any objections? -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE