Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Nov 2010 22:28:04 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r215443 - in head/sys: kern sys
Message-ID:  <201011172228.oAHMS4PV006140@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011172228.oAHMS4PV006140>