Commit 3d3ffb67 by rfkelly0

report a default disk space value in fs.expose.dokan

It's set to something stupidly high since pretending to have too much space
should cause less operations to fail than pretending to have too little.
parent e1ab4f52
...@@ -305,7 +305,12 @@ class FSOperations(object): ...@@ -305,7 +305,12 @@ class FSOperations(object):
finished = threading.Event() finished = threading.Event()
def reset_timeout_callback(): def reset_timeout_callback():
while not finished.isSet(): while not finished.isSet():
libdokan.DokanResetTimeout(5*60*1000,info) finished._Event__cond.acquire()
try:
if not finished.isSet():
libdokan.DokanResetTimeout(5*60*1000,info)
finally:
finished._Event__cond.release()
finished.wait(timeout=4*60) finished.wait(timeout=4*60)
threading.Thread(target=reset_timeout_callback).start() threading.Thread(target=reset_timeout_callback).start()
try: try:
...@@ -357,7 +362,12 @@ class FSOperations(object): ...@@ -357,7 +362,12 @@ class FSOperations(object):
finished = threading.Event() finished = threading.Event()
def reset_timeout_callback(): def reset_timeout_callback():
while not finished.isSet(): while not finished.isSet():
libdokan.DokanResetTimeout(5*60*1000,info) finished._Event__cond.acquire()
try:
if not finished.isSet():
libdokan.DokanResetTimeout(5*60*1000,info)
finally:
finished._Event__cond.release()
finished.wait(timeout=4*60) finished.wait(timeout=4*60)
threading.Thread(target=reset_timeout_callback).start() threading.Thread(target=reset_timeout_callback).start()
lock.acquire() lock.acquire()
...@@ -381,7 +391,12 @@ class FSOperations(object): ...@@ -381,7 +391,12 @@ class FSOperations(object):
finished = threading.Event() finished = threading.Event()
def reset_timeout_callback(): def reset_timeout_callback():
while not finished.isSet(): while not finished.isSet():
libdokan.DokanResetTimeout(5*60*1000,info) finished._Event__cond.acquire()
try:
if not finished.isSet():
libdokan.DokanResetTimeout(5*60*1000,info)
finally:
finished._Event__cond.release()
finished.wait(timeout=4*60) finished.wait(timeout=4*60)
threading.Thread(target=reset_timeout_callback).start() threading.Thread(target=reset_timeout_callback).start()
lock.acquire() lock.acquire()
...@@ -541,7 +556,12 @@ class FSOperations(object): ...@@ -541,7 +556,12 @@ class FSOperations(object):
finished = threading.Event() finished = threading.Event()
def reset_timeout_callback(): def reset_timeout_callback():
while not finished.isSet(): while not finished.isSet():
libdokan.DokanResetTimeout(5*60*1000,info) finished._Event__cond.acquire()
try:
if not finished.isSet():
libdokan.DokanResetTimeout(5*60*1000,info)
finally:
finished._Event__cond.release()
finished.wait(timeout=4*60) finished.wait(timeout=4*60)
threading.Thread(target=reset_timeout_callback).start() threading.Thread(target=reset_timeout_callback).start()
lock.acquire() lock.acquire()
...@@ -558,7 +578,12 @@ class FSOperations(object): ...@@ -558,7 +578,12 @@ class FSOperations(object):
@handle_fs_errors @handle_fs_errors
def GetDiskFreeSpaceEx(self, nBytesAvail, nBytesTotal, nBytesFree, info): def GetDiskFreeSpaceEx(self, nBytesAvail, nBytesTotal, nBytesFree, info):
pass # This returns a stupidly large number by default.
# It's better to pretend an operation is possible and have it fail
# than to pretend an operation will fail when it's actually possible.
nBytesAvail[0] = 100 * 1024*1024*1024
nBytesFree[0] = 100 * 1024*1024*1024
nBytesTotal[0] = 200 * 1024*1024*1024
@handle_fs_errors @handle_fs_errors
def GetVolumeInformation(self, vnmBuf, vnmSz, sNum, maxLen, flags, fnmBuf, fnmSz, info): def GetVolumeInformation(self, vnmBuf, vnmSz, sNum, maxLen, flags, fnmBuf, fnmSz, info):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment