Skip to content

Use TempFile as owned File to avoid manual File reopening - waiting on support from rust-vmm/vmm-sys-util #1466

@iulianbarbu

Description

@iulianbarbu

There are two ways of approaching a better implementation for achieving with ease temporary file/directory creation/management:

  1. We consume rust-vmm/vmm-sys-util crate TempFile and TempDir structs inside Firecracker. These structs miss file operations implementations, like read, write and seek. We need this support from within rust-vmm/vmm-sys-util crate, and consume it like that in Firecracker, because otherwise it would mean to add wrappers inside Firecracker. It is worth mentioning that while we would implement these file operations, we should take into account that when we read and write to files, we have to open files with specific file permissions. So we might want to add support for file permissions too.

  2. There is another suggestion that says that when creating a temporary file/directory, we should unlink it immediately, then return a File that represent the handle for that unliked file/directory, that we're gonna operate with, and leave altogether the TempFile/TempDir structs as builders for these temporary files. This would simplify a lot the implementation, and wouldn't need any support for file operation, as the current implementation needs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions