-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JIRA: CI-306
- Loading branch information
Showing
5 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
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,47 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
FS_MARK_VER="3.3" | ||
FS_MARK=fs_mark-${FS_MARK_VER} | ||
FS_MARK_COMMIT="2628be58146de63a13260ff64550f84275556c0e" | ||
PKG_URL="https://github.com/josefbacik/fs_mark/archive/${FS_MARK_COMMIT}.tar.gz" | ||
PKG_MIRROR_URL="https://files.phoesys.com/ports/${FS_MARK}.tar.gz" | ||
|
||
b_log "Building fs_mark" | ||
PREFIX_FS_MARK=${PREFIX_PROJECT}/phoenix-rtos-ports/fs_mark | ||
PREFIX_FS_MARK_BUILD="${PREFIX_BUILD}/fs_mark" | ||
PREFIX_FS_MARK_SRC="${PREFIX_FS_MARK_BUILD}/${FS_MARK}" | ||
PREFIX_FS_MARK_MARKERS="${PREFIX_FS_MARK_BUILD}/markers" | ||
|
||
# | ||
# Download and unpack | ||
# | ||
mkdir -p "$PREFIX_FS_MARK_BUILD" "$PREFIX_FS_MARK_MARKERS" | ||
if ! [ -f "${PREFIX_FS_MARK}/${FS_MARK}.tar.gz" ]; then | ||
if ! wget "$PKG_URL" -O "${PREFIX_FS_MARK}/${FS_MARK}.tar.gz" --no-check-certificate; then | ||
wget "$PKG_MIRROR_URL" -P "${PREFIX_FS_MARK}" --no-check-certificate | ||
fi | ||
fi | ||
|
||
if ! [ -d "${PREFIX_FS_MARK_SRC}" ]; then | ||
tar xzf "${PREFIX_FS_MARK}/${FS_MARK}.tar.gz" -C "${PREFIX_FS_MARK_BUILD}" && mv "${PREFIX_FS_MARK_BUILD}"/fs_mark-"${FS_MARK_COMMIT}" "${PREFIX_FS_MARK_BUILD}"/${FS_MARK} | ||
fi | ||
|
||
# | ||
# Apply patches | ||
# | ||
for patchfile in "$PREFIX_FS_MARK"/patch/*; do | ||
if [ ! -f "$PREFIX_FS_MARK_MARKERS/$(basename "$patchfile").applied" ]; then | ||
echo "applying patch: $patchfile" | ||
patch -d "$PREFIX_FS_MARK_SRC" -p1 < "$patchfile" | ||
touch "$PREFIX_FS_MARK_MARKERS/$(basename "$patchfile").applied" | ||
fi | ||
done | ||
|
||
# Build fs_mark | ||
cd "${PREFIX_FS_MARK_BUILD}/${FS_MARK}" && make | ||
|
||
cp -a "$PREFIX_FS_MARK_BUILD/${FS_MARK}/fs_mark" "$PREFIX_PROG/fs_mark" | ||
"${CROSS}strip" -s "${PREFIX_PROG}/fs_mark" -o "${PREFIX_PROG_STRIPPED}/fs_mark" | ||
b_install "$PREFIX_PORTS_INSTALL/fs_mark" /bin |
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,60 @@ | ||
--- fs_mark-3.3/fs_mark.c 2023-07-10 15:47:05.889696230 +0200 | ||
+++ fs_mark-3.3.phoenix/fs_mark.c 2023-07-31 12:40:45.016383503 +0200 | ||
@@ -29,7 +29,7 @@ | ||
#include <sys/types.h> | ||
#include <sys/wait.h> | ||
#include <sys/stat.h> | ||
-#include <sys/vfs.h> | ||
+#include <sys/statvfs.h> | ||
#include <sys/time.h> | ||
|
||
#include <fcntl.h> | ||
@@ -42,9 +42,8 @@ | ||
#include <ctype.h> | ||
#include <time.h> | ||
|
||
-#include <linux/types.h> | ||
-#include <linux/limits.h> | ||
-#include <linux/unistd.h> | ||
+#include <limits.h> | ||
+#include <signal.h> | ||
|
||
#include "fs_mark.h" | ||
|
||
@@ -142,7 +141,8 @@ | ||
break; | ||
|
||
case 'l': /* Log file name */ | ||
- strncpy(log_file_name, optarg, PATH_MAX); | ||
+ strncpy(log_file_name, optarg, sizeof(log_file_name)); | ||
+ log_file_name[sizeof(log_file_name) - 1] = '\0'; | ||
break; | ||
|
||
case 'L': /* number of iterations */ | ||
@@ -493,11 +493,11 @@ | ||
*/ | ||
int get_df_full(char *dir_name) | ||
{ | ||
- struct statfs fs_buf; | ||
+ struct statvfs fs_buf; | ||
float df_used, used_blocks; | ||
int df_percent_used; | ||
|
||
- if (statfs(dir_name, &fs_buf) == -1) { | ||
+ if (statvfs(dir_name, &fs_buf) == -1) { | ||
fprintf(stderr, "fs_mark: statfs failed on %s %s\n", dir_name, | ||
strerror(errno)); | ||
cleanup_exit(); | ||
@@ -517,10 +517,10 @@ | ||
*/ | ||
unsigned long long get_bytes_free(char *dir_name) | ||
{ | ||
- struct statfs fs_buf; | ||
+ struct statvfs fs_buf; | ||
unsigned long long bytes_free; | ||
|
||
- if (statfs(dir_name, &fs_buf) == -1) { | ||
+ if (statvfs(dir_name, &fs_buf) == -1) { | ||
fprintf(stderr, "fs_mark: statfs failed on %s %s\n", dir_name, | ||
strerror(errno)); | ||
cleanup_exit(); |
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,10 @@ | ||
--- fs_mark-3.3/fs_mark.h 2023-07-10 15:47:05.889696230 +0200 | ||
+++ fs_mark-3.3.phoenix/fs_mark.h 2023-08-01 12:19:29.380631828 +0200 | ||
@@ -125,7 +125,7 @@ | ||
int num_threads = 1; /* Number of threads */ | ||
int do_fill_fs = 0; /* Run until the file system is full */ | ||
int verbose_stats = 0; /* Print complete stats for each system call */ | ||
-char log_file_name[PATH_MAX] = "fs_log.txt"; /* Log file name for run */ | ||
+char log_file_name[PATH_MAX - 16] = "fs_log.txt"; /* Log file name for run - reserve place for suffix */ | ||
FILE *log_file_fp; /* Parent file pointer for log file */ | ||
FILE *child_log_file_fp; /* Child file pointer for log file */ |
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,9 @@ | ||
--- fs_mark-3.3/lib_timing.c 2023-07-10 14:20:00.192932272 +0200 | ||
+++ fs_mark-3.3.phoenix/lib_timing.c 2023-07-10 14:20:25.032448754 +0200 | ||
@@ -24,7 +24,6 @@ | ||
#include <unistd.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
-#include <linux/types.h> | ||
|
||
#define nz(x) ((x) == 0 ? 1 : (x)) |