Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/dm add function to get the inactive table size (for ...



details:   https://anonhg.NetBSD.org/src/rev/f21e7013eaaf
branches:  trunk
changeset: 768800:f21e7013eaaf
user:      ahoka <ahoka%NetBSD.org@localhost>
date:      Sat Aug 27 17:10:05 2011 +0000

description:
add function to get the inactive table size (for during target init)

diffstat:

 sys/dev/dm/dm_table.c |  27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diffs (55 lines):

diff -r 77debaced95f -r f21e7013eaaf sys/dev/dm/dm_table.c
--- a/sys/dev/dm/dm_table.c     Sat Aug 27 17:09:09 2011 +0000
+++ b/sys/dev/dm/dm_table.c     Sat Aug 27 17:10:05 2011 +0000
@@ -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 @@
 /*
  * 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 @@
 
        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 @@
 
        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
  */



Home | Main Index | Thread Index | Old Index