From owner-svn-src-head@FreeBSD.ORG Wed Jun 13 17:18:16 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (unknown [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E10D51065670; Wed, 13 Jun 2012 17:18:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [69.147.83.44]) by mx1.freebsd.org (Postfix) with ESMTP id B33E68FC0C; Wed, 13 Jun 2012 17:18:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5DHIGGo037906; Wed, 13 Jun 2012 17:18:16 GMT (envelope-from mjg@svn.freebsd.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5DHIGH5037904; Wed, 13 Jun 2012 17:18:16 GMT (envelope-from mjg@svn.freebsd.org) Message-Id: <201206131718.q5DHIGH5037904@svn.freebsd.org> From: Mateusz Guzik Date: Wed, 13 Jun 2012 17:18:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237013 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2012 17:18:17 -0000 Author: mjg Date: Wed Jun 13 17:18:16 2012 New Revision: 237013 URL: http://svn.freebsd.org/changeset/base/237013 Log: Remove 'low' argument from fd_last_used(). This function is static and the only caller always passes 0 as low. While here update note about return values in comment. Reviewed by: pjd Approved by: trasz (mentor) MFC after: 1 month Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Wed Jun 13 17:12:53 2012 (r237012) +++ head/sys/kern/kern_descrip.c Wed Jun 13 17:18:16 2012 (r237013) @@ -119,7 +119,7 @@ static int closefp(struct filedesc *fdp, static int do_dup(struct thread *td, int flags, int old, int new, register_t *retval); static int fd_first_free(struct filedesc *, int, int); -static int fd_last_used(struct filedesc *, int, int); +static int fd_last_used(struct filedesc *, int); static void fdgrowtable(struct filedesc *, int); static void fdunused(struct filedesc *fdp, int fd); static void fdused(struct filedesc *fdp, int fd); @@ -217,19 +217,16 @@ fd_first_free(struct filedesc *fdp, int } /* - * Find the highest non-zero bit in the given bitmap, starting at low and - * not exceeding size - 1. + * Find the highest non-zero bit in the given bitmap, starting at 0 and + * not exceeding size - 1. Return -1 if not found. */ static int -fd_last_used(struct filedesc *fdp, int low, int size) +fd_last_used(struct filedesc *fdp, int size) { NDSLOTTYPE *map = fdp->fd_map; NDSLOTTYPE mask; int off, minoff; - if (low >= size) - return (-1); - off = NDSLOT(size); if (size % NDENTRIES) { mask = ~(~(NDSLOTTYPE)0 << (size % NDENTRIES)); @@ -237,10 +234,10 @@ fd_last_used(struct filedesc *fdp, int l return (off * NDENTRIES + flsl(mask) - 1); --off; } - for (minoff = NDSLOT(low); off >= minoff; --off) + for (minoff = NDSLOT(0); off >= minoff; --off) if (map[off] != 0) return (off * NDENTRIES + flsl(map[off]) - 1); - return (low - 1); + return (-1); } static int @@ -286,7 +283,7 @@ fdunused(struct filedesc *fdp, int fd) if (fd < fdp->fd_freefile) fdp->fd_freefile = fd; if (fd == fdp->fd_lastfile) - fdp->fd_lastfile = fd_last_used(fdp, 0, fd); + fdp->fd_lastfile = fd_last_used(fdp, fd); } /*