Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OS_fsBlocksFree returns a 32-bit value, but OS_statvfs_t.blocks_free is 64 bit #573

Closed
ghost opened this issue Aug 20, 2020 · 8 comments · Fixed by #717 or #750
Closed

OS_fsBlocksFree returns a 32-bit value, but OS_statvfs_t.blocks_free is 64 bit #573

ghost opened this issue Aug 20, 2020 · 8 comments · Fixed by #717 or #750
Assignees
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Aug 20, 2020

OS_fsBlocksFree returns a 32-bit value, but OS_statvfs_t.blocks_free is 64 bit.

@jphickey
Copy link
Contributor

Similar to #570 -- while this return type (int32) is small for modern storages and filesystems, it was seen in previous reviews as being "good enough" for what you'd likely find on a flight system. Particularly because its returning blocks, not bytes. It's also overloaded with an error code on failure, which needs to be the int32 type.

I wouldn't recommend changing the return type for that reason. Would recommend to deprecate this API rather than change it, if it is really a problem. New code should just use the existing OS_statfs() call anyway, which returns everything.

@skliper skliper changed the title OS_fsBlocksFree OS_fsBlocksFree returns a 32-bit value, but OS_statvfs_t.blocks_free is 64 bit Aug 20, 2020
@ghost
Copy link
Author

ghost commented Aug 20, 2020

I'm fine with not changing it. I just wanted to bring it to the group's attention.

@skliper
Copy link
Contributor

skliper commented Aug 21, 2020

Recommending deprecate in favor of using OS_statfs

@skliper
Copy link
Contributor

skliper commented Dec 9, 2020

There is no OS_statfs. If OS_fsBlocksFree is removed, seems like there's no replacement (other than using statvfs directly).

@skliper
Copy link
Contributor

skliper commented Dec 29, 2020

@jphickey could you clarify the "New code should just use the existing OS_statfs()" recommendation?

@jphickey
Copy link
Contributor

Hmm, you are correct, it looks like we do not expose the OS_FileSysStatVolume_Impl info via a public API currently.

I can easily implement one as long as folks are in agreement that it is a reasonable solution. The structure currently is defined as:

typedef struct
{
    size_t            block_size;
    osal_blockcount_t total_blocks;
    osal_blockcount_t blocks_free;
} OS_statvfs_t;

Prototype would be:

int32 OS_FileSysStatVolume(const char *path, OS_statvfs_t *statbuf);

Filesystem code has traditionally used strings/pathnames to identify objects so this is consistent with other filesystem calls, as opposed to using an osal_id_t to identify the filesystem (which would be more like the rest of OSAL).

@jphickey
Copy link
Contributor

After this, we would deprecate OS_fsBlocksFree() and OS_fsBytesFree(). For the latter, applications would simply multiply blocks_free * block_size on their own.

@skliper
Copy link
Contributor

skliper commented Dec 29, 2020

I'm good with your suggestions above to resolve this issue.

@skliper skliper added this to the 6.0.0 milestone Dec 29, 2020
jphickey added a commit to jphickey/osal that referenced this issue Dec 29, 2020
Add OS_FileSysStatVolume as replacement for OS_fsBytesFree and
OS_fsBlocksFree.
jphickey added a commit to jphickey/osal that referenced this issue Dec 29, 2020
Update unit tests and stubs for the new API call.
jphickey added a commit to jphickey/osal that referenced this issue Dec 29, 2020
Add OS_FileSysStatVolume as replacement for OS_fsBytesFree and
OS_fsBlocksFree.  Update unit tests and stubs for the new API
call.

Does not (yet) deprecate the existing functions, as references
still need to be updated elsewhere in apps.
@astrogeco astrogeco added bug and removed enhancement labels Jan 12, 2021
astrogeco added a commit that referenced this issue Jan 12, 2021
jphickey added a commit to jphickey/osal that referenced this issue Aug 10, 2022
Bring the example toolchain for i686-rtems4.11 back into sync with
the current PSP and platform build module for this system.
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants