Skip to content
This repository has been archived by the owner on Mar 7, 2021. It is now read-only.

Add API equivalent to kernel's nonseekable_open #163

Open
alex opened this issue Sep 1, 2019 · 4 comments
Open

Add API equivalent to kernel's nonseekable_open #163

alex opened this issue Sep 1, 2019 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@alex
Copy link
Member

alex commented Sep 1, 2019

Needed for #110

@alex alex added enhancement New feature or request good first issue Good for newcomers labels Sep 1, 2019
@nelhage nelhage changed the title Add API equivilant to kernel's nonseekable_open Add API equivalent to kernel's nonseekable_open Aug 28, 2020
@nelhage
Copy link
Collaborator

nelhage commented Aug 28, 2020

Does this mean:

(1) Somehow bind nonseekable_open so that you can call into it from Rust in your open implementation, or
(2) Somehow implement support for directly binding any of the common C open functions: https://github.com/torvalds/linux/blob/v5.8/fs/open.c#L1326-L1372

You could imagine (2) working by removing open from the FileOperations trait, and adding an Open trait, and in addition to the open builder method, adding e.g. open_nonseekable() that binds to the kernel method.

@alex
Copy link
Member Author

alex commented Aug 28, 2020

Either! Would need someone to look into it.

@alex
Copy link
Member Author

alex commented Aug 30, 2020

The API for this is much more obvious with our new FileOperations API:

impl FileOperations for Foo {
    const SEEK: SeekFn<Self> = Some(open_nonseekable::<Self>);
}

@alex
Copy link
Member Author

alex commented Aug 30, 2020

Err, I apparently don't have brain cells to rub together. open is a function on the trait, not a function-ptr in a const on it. Which means this just needs to be a function that open delegates to. Functions calling functions is good.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants