OCaml Forge
SCM

Detail: [#1274] Add st_flags

Bugs: Browse | Download .csv | Monitor

[#1274] Add st_flags

Date:
2013-05-01 15:16
Priority:
3
State:
Closed
Submitted by:
Mehdi Dogguy (mehdi-admin)
Assigned to:
Nobody (None)
Resolution:
Fixed
Severity:
normal
Hardware:
None
 
Operating System:
Version:
0.0.6
 
URL:
Summary:
Add st_flags

Detailed description
Hi,

When using statvfs, I find it not easy to get the list of mount flags (except hard-coding some values in the ML files). I've come up with this patch to make it easier. (See attached file)

Best,

Mehdi

Followup

Message
Date: 2013-05-14 17:24
Sender: Mehdi Dogguy

Uh, you're right. I misread it. Thanks for having integrated the patch!
Date: 2013-05-14 02:30
Sender: ygrek

Code looks fine to me. And works as intended :
# U.statvfs "/run";;
- : U.statvfs =
{U.f_bsize = 4096; U.f_blocks = 199000L; U.f_bfree = 198872L;
U.f_bavail = 198872L; U.f_files = 994997L; U.f_ffree = 994564L;
U.f_favail = 994564L; U.f_fsid = 0L; U.f_flag = 4106;
U.f_flags = [U.ST_NOSUID; U.ST_NOEXEC; U.ST_RELATIME]; U.f_namemax = 255}
Date: 2013-05-13 23:01
Sender: Mehdi Dogguy

I think you inverted f_flag and f_flags in the C code (when doing Store_field).
Date: 2013-05-13 04:42
Sender: ygrek

Pushed with outlined above changes and minor style tweak. Thank you!
Date: 2013-05-03 03:45
Sender: ygrek

2) No, I mean that we should check that all (or at least the non-posix ones) ST_* constants are present when configuring, smth along the lines of
"STATVFS", L[
I "sys/statvfs.h";
T "struct statvfs";
S "statvfs"; S "fstatvfs";
V "ST_NODEV";
];
or better yet, check that they are defined in the C file and if not - just define to zero - this way we will have statvfs even when the platform doesn't support GNU flags
Date: 2013-05-02 17:25
Sender: Mehdi Dogguy

Good to hear! Thanks for considering.

1) Yeah, Sounds like a good idea. I'll do that. I wasn't sure keeping both would be okay for you.
2) Do you mean the __USE_GNU? IIRC, my patch adds that in discover.ml. or maybe I missed something else?
Date: 2013-05-02 09:11
Sender: ygrek

Thanks!
This change is welcome except for two small points that worry me :
1) backward compatibility - though it is not strictly promised by extunix now - but it is nice to have - and here we can have it for free - just leave the f_flag field as is.
2) posix doesn't define all the flags, so there is the risk of compilation failure on some platforms, one should probably check for some (all?) constants at configure (discover.ml) stage.

Attached Files:

Attachments:
0001-Add-st_flags.patch

Changes:

Field Old Value Date By
status_idOpen2013-05-13 04:42ygrek
close_dateNone2013-05-13 04:42ygrek
ResolutionNone2013-05-13 04:42ygrek
assigned_toygrek2013-05-02 17:25mehdi-admin
assigned_tonone2013-05-02 09:11ygrek
File Added210: 0001-Add-st_flags.patch2013-05-01 15:16mehdi-admin