MCPcopy Create free account
hub / github.com/HelenOS/helenos / write

Method write

tools/mkext2.py:489–500  ·  view source on GitHub ↗

Write a piece of data (arbitrarily long) as the contents of the inode

(self, data)

Source from the content-addressed store, hash-verified

487 self.fs.seek_to_block(real_block, offset)
488
489 def write(self, data):
490 "Write a piece of data (arbitrarily long) as the contents of the inode"
491
492 data_pos = 0
493 while data_pos < len(data):
494 bytes_remaining_in_block = self.fs.block_size - (self.pos % self.fs.block_size)
495 bytes_to_write = min(bytes_remaining_in_block, len(data)-data_pos)
496 self.do_seek()
497 self.fs.outf.write(data[data_pos:data_pos + bytes_to_write])
498 self.pos += bytes_to_write
499 data_pos += bytes_to_write
500 self.size = max(self.pos, self.size)
501
502 def align_size_to_block(self):
503 "Align the size of the inode up to block size"

Callers 15

subtree_addMethod · 0.95
create_outputFunction · 0.45
mainFunction · 0.45
write_fileFunction · 0.45
write_directoryFunction · 0.45
recursionFunction · 0.45
mainFunction · 0.45
write_inodeMethod · 0.45
write_gdtMethod · 0.45
write_superblockMethod · 0.45
write_all_metadataMethod · 0.45

Calls 1

do_seekMethod · 0.95

Tested by

no test coverage detected