summaryrefslogtreecommitdiff
path: root/sys/dev/dm/dm_table.c
diff options
context:
space:
mode:
authorahoka <ahoka@NetBSD.org>2011-08-27 17:10:05 +0000
committerahoka <ahoka@NetBSD.org>2011-08-27 17:10:05 +0000
commitbdb667b645d66d171abf3ec35feb63f7264fb8fd (patch)
treede7b48e6847e4e6778cc59afc7fa54707cd4a2cd /sys/dev/dm/dm_table.c
parent2ba1b7b41caf4f35f97d545510113569f826f091 (diff)
add function to get the inactive table size (for during target init)
Diffstat (limited to 'sys/dev/dm/dm_table.c')
-rw-r--r--sys/dev/dm/dm_table.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/sys/dev/dm/dm_table.c b/sys/dev/dm/dm_table.c
index 3e8d9afc498..c298e3176c2 100644
--- a/sys/dev/dm/dm_table.c
+++ b/sys/dev/dm/dm_table.c
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_table.c,v 1.6 2010/12/23 14:58:13 mlelstv Exp $ */
+/* $NetBSD: dm_table.c,v 1.7 2011/08/27 17:10:05 ahoka Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -176,8 +176,8 @@ dm_table_destroy(dm_table_head_t * head, uint8_t table_id)
/*
* Return length of active table in device.
*/
-uint64_t
-dm_table_size(dm_table_head_t * head)
+static inline uint64_t
+dm_table_size_impl(dm_table_head_t * head, int table)
{
dm_table_t *tbl;
dm_table_entry_t *table_en;
@@ -186,7 +186,7 @@ dm_table_size(dm_table_head_t * head)
length = 0;
- id = dm_table_busy(head, DM_TABLE_ACTIVE);
+ id = dm_table_busy(head, table);
/* Select active table */
tbl = &head->tables[id];
@@ -202,6 +202,25 @@ dm_table_size(dm_table_head_t * head)
return length;
}
+
+/*
+ * Return length of active table in device.
+ */
+uint64_t
+dm_table_size(dm_table_head_t * head)
+{
+ return dm_table_size_impl(head, DM_TABLE_ACTIVE);
+}
+
+/*
+ * Return length of active table in device.
+ */
+uint64_t
+dm_inactive_table_size(dm_table_head_t * head)
+{
+ return dm_table_size_impl(head, DM_TABLE_INACTIVE);
+}
+
/*
* Return combined disk geometry
*/