summaryrefslogtreecommitdiff
path: root/src/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/misc.c b/src/misc.c
index 255533f..4163348 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -60,25 +60,27 @@ void addLocationLock(drivelocks* locks, uint64 beg, uint64 end)
}
}
-bool checkLocationLock(drivelocks* locks, uint64 sec)
+uint64 checkLocationLock(drivelocks* locks, uint64 sec)
{
- uint32 i;
+ uint64 locked;
+ uint32 i;
- if(locks->_locks)
- {
- /* Go through and check for a lock */
- for(i = 0; i < locks->_current; i++)
- {
- if(sec >= locks->_locks[i].beg &&
- sec < locks->_locks[i].end)
- {
- sec = locks->_locks[i].end;
- return true;
- }
- }
+ if(locks->_locks)
+ {
+ /* Go through and check for a lock */
+ for(i = 0; i < locks->_current; i++)
+ {
+ if(sec >= locks->_locks[i].beg &&
+ sec < locks->_locks[i].end)
+ {
+ locked = locks->_locks[i].end - sec;
+ assert(locked != 0);
+ return locked;
+ }
+ }
}
- return false;
+ return 0;
}
#ifdef _DEBUG