| Line 730... |
Line 730... |
| 730 |
|
730 |
|
| 731 |
@command(timeout = 30000)
|
731 |
@command(timeout = 30000)
|
| 732 |
def file_truncate(self, fd, length):
|
732 |
def file_truncate(self, fd, length):
|
| 733 |
""" Truncates a file referenced by a handle to a specified length """
|
733 |
""" Truncates a file referenced by a handle to a specified length """
|
| 734 |
self.logger.debug("Truncating file with handle 0x%X to 0x%X bytes\n" % (fd, length))
|
734 |
self.logger.debug("Truncating file with handle 0x%X to 0x%X bytes\n" % (fd, length))
|
| 735 |
result = self.lib.monitorcommand(struct.pack("<IIII", 35, fd, offset, 0), "III", ("rc", None, None))
|
735 |
result = self.lib.monitorcommand(struct.pack("<IIII", 35, fd, length, 0), "III", ("rc", None, None))
|
| 736 |
if result.rc > 0x80000000:
|
736 |
if result.rc > 0x80000000:
|
| 737 |
raise DeviceError("file_truncate(fd=%d, length=0x%08X) failed with RC=0x%08X, errno=%d" % (fd, length, result.rc, self.errno()))
|
737 |
raise DeviceError("file_truncate(fd=%d, length=0x%08X) failed with RC=0x%08X, errno=%d" % (fd, length, result.rc, self.errno()))
|
| 738 |
self.logger.debug("File truncate result: 0x%X\n" % (result.rc))
|
738 |
self.logger.debug("File truncate result: 0x%X\n" % (result.rc))
|
| 739 |
return result.rc
|
739 |
return result.rc
|
| 740 |
|
740 |
|