[med-svn] [aghermann] 21/31: rk1968: new opcode op_get_page_dirty

andrei zavada hmmr-guest at alioth.debian.org
Sun Nov 10 00:34:18 UTC 2013


This is an automated email from the git hooks/post-receive script.

hmmr-guest pushed a commit to branch WIP
in repository aghermann.

commit 0f37ff8f5fdd2cf77eb0d1d603f27a03534c8463
Author: Andrei Zavada <hmmr at ra>
Date:   Sat Nov 9 20:47:10 2013 +0200

    rk1968: new opcode op_get_page_dirty
---
 upstream/src/aghermann/rk1968/rk1968.cc |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/upstream/src/aghermann/rk1968/rk1968.cc b/upstream/src/aghermann/rk1968/rk1968.cc
index 9467326..47dbdae 100644
--- a/upstream/src/aghermann/rk1968/rk1968.cc
+++ b/upstream/src/aghermann/rk1968/rk1968.cc
@@ -182,6 +182,7 @@ enum TOpcode {
         op_get_swu,
 
         op_get_signal_envelope,
+        op_get_page_dirty,
 };
 
 
@@ -365,6 +366,30 @@ host_get_data( lua_State *L)
                 }
         }
 
+        case op_get_page_dirty: {
+                NEED_ARITY_EXACT(2);
+
+                const char* channel = lua_tostring( L, 3);
+                auto Hi = E.recordings.find( sigfile::SChannel (channel));
+                if ( Hi == E.recordings.end() ) {
+                        make_error_return( "No such channel (%s)", channel);
+                } else {
+                        auto& R = Hi->second;
+                        int p = lua_tointeger( L, 4);
+                        lua_settop( L, 0);
+
+                        if ( p < 0 || (size_t)p >= R.full_pages() )
+                                make_error_return( "Page %d out of valid range (%zu is last full)", p, R.full_pages());
+
+                        lua_pushnumber(
+                                L,
+                                R.F().artifacts(R.h()).region_dirty_fraction(
+                                        (p+0) * R.pagesize(),
+                                        (p+1) * R.pagesize()));
+                        return 1;
+                }
+        }
+
         default:
                 make_error_return( "Invalid host opcode %d", opcode);
         }

-- 
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/aghermann.git



More information about the debian-med-commit mailing list