-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add statfs hook * + changelog.d * Fix test statfs_fstatfs.rs * Fix statfs_fstatfs.c * Fix statfs_fstatfs.c * Fix statfs_fstatfs.rs * Fix statfs_fstatfs.rs * Fix statfs_fstatfs.rs * Update file.rs * PR comments
- Loading branch information
1 parent
57bdab5
commit 0aa4f40
Showing
18 changed files
with
265 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add statfs support |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <unistd.h> | ||
#include <fcntl.h> | ||
#include <sys/stat.h> | ||
#include <sys/types.h> | ||
#include <sys/fcntl.h> | ||
|
||
#if defined(__APPLE__) && defined(__MACH__) | ||
#include <sys/param.h> | ||
#include <sys/mount.h> | ||
#else | ||
#include <sys/vfs.h> | ||
#endif | ||
|
||
/// Test `statfs / fstatfs`. | ||
/// | ||
/// Gets information about a mounted filesystem | ||
/// | ||
int main() | ||
{ | ||
char *tmp_test_path = "/statfs_fstatfs_test_path"; | ||
mkdir(tmp_test_path, 0777); | ||
|
||
// statfs | ||
struct statfs statfs_buf; | ||
if (statfs(tmp_test_path, &statfs_buf) == -1) | ||
{ | ||
perror("statfs failed"); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
// fstatfs | ||
int fd = open(tmp_test_path, O_RDONLY); | ||
|
||
if (fd == -1) | ||
{ | ||
perror("Error opening tmp_test_path"); | ||
return 1; | ||
} | ||
|
||
struct statfs fstatfs_buf; | ||
if (fstatfs(fd, &fstatfs_buf) == -1) | ||
{ | ||
perror("fstatfs failed"); | ||
close(fd); | ||
return EXIT_FAILURE; | ||
} | ||
|
||
close(fd); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.