TFile - 2023.2 English

Vitis Unified Software Platform Documentation: Application Acceleration Development (UG1393)

Document ID
UG1393
Release Date
2023-12-13
Version
2023.2 English
The following are the commands followed by their options (if any) and the Python method for the option (if any).

tfile close

handle = <file_handle>
tfile = s.tfile()
tfile.ls('/tmp')
handle = tfile.open('/tmp/tfile_test.txt', flags=0x0F)
tfile.write(handle, 'hi, this is a test string')
print(tfile.read(handle, size=5))
fstat = tfile.fstat(handle)
print(fstat)
tfile.close(handle)

tfile copy

src = <src_file>, dest = <dest_file>

--owner (-o)
Copy owner information.
--permissions (-p)
Copy permissions.

tfile.copy('/tmp/rigel.txt', '/tmp/rigel2.txt')
tfile.copy('/tmp/rigel.txt', '/tmp/rigel2.txt','-o','-p')

tfile fsetstat

handle = <file_handle>, file_attr
handle = tfile.open('/tmp/tfile_test.txt', flags=0x0F)
tfile.write(handle, 'hi, this is a test string')
print(tfile.read(handle, size=5))
fstat = tfile.fstat(handle)
fstat.permissions = 65535
tfile.fsetstat(handle, fstat)

tfile fstat

handle = <file_handle>
handle = tfile.open('/tmp/tfile_test.txt', flags=0x0F)
tfile.write(handle, 'hi, this is a test string')
print(tfile.read(handle, size=5))
fstat = tfile.fstat(handle)

tfile ls

path = <dir_path>
tfile.ls('/tmp')

file lstat

path = <link>
lstat = tfile.lstat('/tmp/rigel.txt')

tfile mkdir

path = <dir_path>
tfile.mkdir('/tmp/new')

tfile open

flags = <flags>
read mode = 0x00000001
write mode = 0x00000002
append mode = 0x00000004
create mode= 0x00000008
trunc mode = 0x00000010
excl mode= 0x00000020
tfile.open('/tmp/tfile_test.txt', flags=0x0F)

tfile opendir

path = <dir_path>
f = tfile.opendir('/tmp')

tfile read

handle, size
handle = tfile.open('/tmp/tfile_test.txt', flags=0x0F)
tfile.write(handle, 'hi, this is a test string')
print(tfile.read(handle, size=5))

tfile readdir

handle = <dir_handle>
f = tfile.opendir('/tmp')
print(tfile.readdir(f))

tfile readlink

path = <file_path>
print(tfile.readlink('/tmp/rigel1.txt'))

tfile realpath

path = <file_path>
print(tfile.realpath('/tmp/../tmp/rigel.txt'))

tfile remove

path = <file_path>
tfile.remove('/tmp/rigel.txt')

tfile rename

old_path, new_path
tfile.rename('/tmp/tfile_test.txt', '/tmp/rigel.txt')

tfile rmdir

path = <dir_path>
tfile.rmdir('/tmp/new')

tfile roots

print(tfile.roots())

tfile setstat

path = <file_path>, attr = <file_attr>
stat = tfile.stat('/tmp/rigel.txt')
print(stat)
stat.permissions = 65535
tfile.setstat('/tmp/rigel.txt', stat)

tfile stat

path = <file_path>
lstat = tfile.stat('/tmp/rigel.txt')

file symlink

link = <link_path>, target = <target_path>
tfile.symlink('/tmp/rigel1.txt', '/tmp/rigel.txt')

tfile user

print(tfile.user())

tfile write

handle <file_handle>, data
Optional:
offset=<offset>
The offset (in bytes) relative to the beginning of the
file from where to start writing. Default is 0.
pos=<pos>
Offset in *data* to write. Default is 0.
size=<size>
Number of bytes to write.Default is length of *data*
handle = tfile.open('/tmp/tfile_test.txt', flags=0x0F)
tfile.write(handle, 'hi, this is a test string')