UPB-FILS-SdE2 / questions

0 stars 1 forks source link

[filesystem] immutable data vector in inodes #116

Closed MassaoudiOmar closed 5 months ago

MassaoudiOmar commented 7 months ago

In order to actually be able to write into the INodes, shouldn't the data vector be mutable?

alexandruradovici commented 6 months ago

Are you referring to the write function?

MassaoudiOmar commented 6 months ago

Referring to the INode Enum, specifically INode::File

Currently, the way it is structured, the data vector is immutable.

This is a problem, in the context of the write function, because of the following reason:

While we can simply replace the INode inside the fd, and pass some tests (which is what I've done), other tests explicitly open the file again and check it's contents from a new fd, meaning the INode has to be modified.

In order to pass those tests, we really should be allowed to make the data vector in the file INode mutable, no?

On Tue, Apr 16, 2024, 09:02 Alexandru Radovici @.***> wrote:

Are you referring to the write function?

— Reply to this email directly, view it on GitHub https://github.com/UPB-FILS-SdE2/questions/issues/116#issuecomment-2058292206, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGWJ4EIVHZQ657GAWGBDH2TY5S5G5AVCNFSM6AAAAABGIJZ3X6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJYGI4TEMRQGY . You are receiving this because you authored the thread.Message ID: @.***>

alexandruradovici commented 6 months ago

The elements of an enum cannot be mutable or immutable. The FileSysyem's trait functions take &mut self and this allows you to mutate your structure.

alexandruradovici commented 6 months ago

Your are not allowed to keep the INode in an fd. You have to have a tree structure for your file sustem, the fd just points to one of them (most probably by keeping the file's full name).