fs_rom "follows" files
Norman Feske
norman.feske at genode-labs.com
Wed Sep 9 17:17:55 CEST 2020
Hi Roman,
> Then, I execute the following commands on the interactive shell:
>
> ```bash
>> echo "1st-cfg" > /tmp/test.config` # "1st-cfg" is logged
>> mv /tmp/test.config /tmp/test.backup` # nothing is logged
>> echo "2nd-cfg" > /tmp/test.config` # nothing is logged
>> echo "3rd-cfg" > /tmp/test.backup` # "3rd-cfg" is logged
> ```
>
> Is it the intended behavior that `fs_rom` "follows" the file or should
> it always provide the ROM content of the file with the specified name
> instead?
the behavior is the result of a combination of two things:
- The fs_rom component keeps the file handle for the watched file open
during the whole lifetime of the ROM session.
- The <ram> VFS plugin implements the rename operation by modifying
the meta data (the naming) but the physical object remains the same.
The resolution of the physical object from its name is done only once
when the file is opened. The file handle then keeps a reference to the
underlying object. Hence, any open file descriptor will "follow" the
rename operation.
I think that both points are quite reasonable. Or the other way around,
I wonder what would be a sensible alternative?
You can avoid this situation be replacing the 'mv' by 'cp', which will
keep the relationship of the original file and its original name intact
for open file handles that refer to the file. You can also 'rm' the
original file, which will result in an empty ROM, as expected.
Cheers
Norman
--
Dr.-Ing. Norman Feske
Genode Labs
https://www.genode-labs.com · https://genode.org
Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.genode.org/pipermail/users/attachments/20200909/3cbc059f/attachment.sig>
More information about the users
mailing list