From owner-freebsd-usb@FreeBSD.ORG Sat Sep 20 09:36:36 2008 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF317106567B for ; Sat, 20 Sep 2008 09:36:36 +0000 (UTC) (envelope-from admin@intron.ac) Received: from intron.ac (unknown [211.166.10.238]) by mx1.freebsd.org (Postfix) with ESMTP id 564788FC19 for ; Sat, 20 Sep 2008 09:36:36 +0000 (UTC) (envelope-from admin@intron.ac) Received: from localhost (localhost [127.0.0.1]) (uid 1003) by intron.ac with local; Sat, 20 Sep 2008 17:36:34 +0800 id 000EBC81.48D4C422.0000187B References: <20080919145320.GA2444@q.gid0.org> <20080919153415.GA1178@q.gid0.org> In-Reply-To: <20080919153415.GA1178@q.gid0.org> From: "Intron is my alias on the Internet" To: freebsd-usb@freebsd.org Date: Sat, 20 Sep 2008 17:36:34 +0800 Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312"; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Subject: Re: [usb2] new usb stack and suser in CURRENT X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Sep 2008 09:36:36 -0000 olivier wrote: > On Fri, Sep 19, 2008 at 04:53:22PM +0200, Olivier Smedts wrote: >> Since the suser interface has been removed from HEAD >> (http://www.freebsd.org/cgi/getmsg.cgi?fetch=284102+0+current/cvs-src) >> I use the following patch to use the new usb2 stack with >> latest CURRENT. Of course, PRIV_ROOT is not the right one to use, >> see include/sys/priv.h. > > Attachment seems to have been removed. Retrying with a different content-type > and disposition (mutt is so great). > > -- > Olivier Smedts _ > ASCII ribbon campaign ( ) > e-mail: olivier at gid0.org - against HTML email & vCards X > www: http://www.gid0.org - against proprietary attachments / \ > > "Il y a seulement 10 sortes de gens dans le monde : > ceux qui comprennent le binaire, > et ceux qui ne le comprennent pas." > -------------- next part -------------- > Index: i4b/src/sys/dev/usb2/core/usb2_dev.c > =================================================================== > --- i4b/src/sys/dev/usb2/core/usb2_dev.c (r?vision 880) > +++ i4b/src/sys/dev/usb2/core/usb2_dev.c (copie de travail) > @@ -262,7 +262,7 @@ > int error; > > /* only super-user can set permissions */ > - error = suser(curthread); > + error = priv_check(curthread, PRIV_ROOT); > if (error) { > return (error); > } > Index: i4b/src/sys/dev/usb2/core/usb2_generic.c > =================================================================== > --- i4b/src/sys/dev/usb2/core/usb2_generic.c (r?vision 880) > +++ i4b/src/sys/dev/usb2/core/usb2_generic.c (copie de travail) > @@ -878,7 +878,7 @@ > (req->bRequest == UR_SET_CONFIG)) || > ((req->bmRequestType == UT_WRITE_INTERFACE) && > (req->bRequest == UR_SET_INTERFACE))) { > - if (suser(curthread)) { > + if (priv_check(curthread, PRIV_ROOT)) { > return (EPERM); > } > } > @@ -887,7 +887,7 @@ > * not update the data toggle value in "struct usb2_pipe" ! > */ > if (req->bmRequestType == UT_WRITE_ENDPOINT) { > - if (suser(curthread)) { > + if (priv_check(curthread, PRIV_ROOT)) { > return (EPERM); > } > } > @@ -946,7 +946,7 @@ > /* control endpoint only */ > return (EINVAL); > } > - if (suser(curthread)) { > + if (priv_check(curthread, PRIV_ROOT)) { > return (EPERM); > } > mtx_lock(f->priv_mtx); > @@ -1738,7 +1738,7 @@ > (udev->parent_hub == NULL)) { > return (EINVAL); > } > - if (suser(curthread)) { > + if (priv_check(curthread, PRIV_ROOT)) { > return (EPERM); > } > switch (mode) { > @@ -1805,7 +1805,7 @@ > struct usb2_hub *hub; > int err; > > - if (suser(curthread)) { > + if (priv_check(curthread, PRIV_ROOT)) { > return (EPERM); > } > if (port_no == 0) { > @@ -2115,7 +2115,7 @@ > > case USB_IFACE_DRIVER_DETACH: > /* TODO */ > - if (suser(curthread)) > + if (priv_check(curthread, PRIV_ROOT)) > error = EPERM; > else > error = EINVAL; > Maybe PRIV_DRIVER is a more appropriate one for this case. ------------------------------------------------------------------------ From Beijing, China