From owner-svn-src-all@FreeBSD.ORG Wed Nov 17 22:28:04 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF95C1065672; Wed, 17 Nov 2010 22:28:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDD918FC08; Wed, 17 Nov 2010 22:28:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAHMS4MA006144; Wed, 17 Nov 2010 22:28:04 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAHMS4PV006140; Wed, 17 Nov 2010 22:28:04 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201011172228.oAHMS4PV006140@svn.freebsd.org> From: John Baldwin Date: Wed, 17 Nov 2010 22:28:04 +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: r215443 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Nov 2010 22:28:04 -0000 Author: jhb Date: Wed Nov 17 22:28:04 2010 New Revision: 215443 URL: http://svn.freebsd.org/changeset/base/215443 Log: Add a resource_list_reserved() method that returns true if a resource list entry contains a reserved resource. Modified: head/sys/kern/subr_bus.c head/sys/sys/bus.h Modified: head/sys/kern/subr_bus.c ============================================================================== --- head/sys/kern/subr_bus.c Wed Nov 17 21:45:11 2010 (r215442) +++ head/sys/kern/subr_bus.c Wed Nov 17 22:28:04 2010 (r215443) @@ -2934,6 +2934,30 @@ resource_list_busy(struct resource_list } /** + * @brief Determine if a resource entry is reserved. + * + * Returns true if a resource entry is reserved meaning that it has an + * associated "reserved" resource. The resource can either be + * allocated or unallocated. + * + * @param rl the resource list to search + * @param type the resource entry type (e.g. SYS_RES_MEMORY) + * @param rid the resource identifier + * + * @returns Non-zero if the entry is reserved, zero otherwise. + */ +int +resource_list_reserved(struct resource_list *rl, int type, int rid) +{ + struct resource_list_entry *rle; + + rle = resource_list_find(rl, type, rid); + if (rle != NULL && rle->flags & RLE_RESERVED) + return (1); + return (0); +} + +/** * @brief Find a resource entry by type and rid. * * @param rl the resource list to search Modified: head/sys/sys/bus.h ============================================================================== --- head/sys/sys/bus.h Wed Nov 17 21:45:11 2010 (r215442) +++ head/sys/sys/bus.h Wed Nov 17 22:28:04 2010 (r215443) @@ -256,6 +256,7 @@ int resource_list_add_next(struct resour u_long start, u_long end, u_long count); int resource_list_busy(struct resource_list *rl, int type, int rid); +int resource_list_reserved(struct resource_list *rl, int type, int rid); struct resource_list_entry* resource_list_find(struct resource_list *rl, int type, int rid);