svn commit: r215443 - in head/sys: kern sys

John Baldwin jhb at FreeBSD.org
Wed Nov 17 22:28:04 UTC 2010


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);


More information about the svn-src-all mailing list