mirror of
https://github.com/AltraMayor/f3.git
synced 2025-09-15 01:56:39 -04:00
Fixes for FreeBSD
This commit is contained in:
parent
397648282d
commit
b4e8e6c9da
2
f3read.c
2
f3read.c
@ -1,4 +1,5 @@
|
|||||||
#define _POSIX_C_SOURCE 200112L
|
#define _POSIX_C_SOURCE 200112L
|
||||||
|
#define _XOPEN_SOURCE 600
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -10,6 +11,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
13
f3write.c
13
f3write.c
@ -1,4 +1,5 @@
|
|||||||
#define _POSIX_C_SOURCE 200112L
|
#define _POSIX_C_SOURCE 200112L
|
||||||
|
#define _XOPEN_SOURCE 600
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -9,10 +10,10 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/statvfs.h>
|
#include <sys/statvfs.h>
|
||||||
|
#include <sys/time.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <err.h>
|
#include <err.h>
|
||||||
#include <alloca.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
@ -341,7 +342,7 @@ static int create_and_fill_file(const char *path, long number, size_t size,
|
|||||||
char *full_fn;
|
char *full_fn;
|
||||||
const char *filename;
|
const char *filename;
|
||||||
int fd, fine;
|
int fd, fine;
|
||||||
void *buf;
|
char buf[fw->block_size];
|
||||||
size_t remaining;
|
size_t remaining;
|
||||||
uint64_t offset;
|
uint64_t offset;
|
||||||
ssize_t written;
|
ssize_t written;
|
||||||
@ -350,7 +351,7 @@ static int create_and_fill_file(const char *path, long number, size_t size,
|
|||||||
assert(size % fw->block_size == 0);
|
assert(size % fw->block_size == 0);
|
||||||
|
|
||||||
/* Create the file. */
|
/* Create the file. */
|
||||||
|
|
||||||
fine = 0;
|
fine = 0;
|
||||||
full_fn = full_fn_from_number(&filename, path, number);
|
full_fn = full_fn_from_number(&filename, path, number);
|
||||||
assert(full_fn);
|
assert(full_fn);
|
||||||
@ -366,10 +367,6 @@ static int create_and_fill_file(const char *path, long number, size_t size,
|
|||||||
}
|
}
|
||||||
assert(fd >= 0);
|
assert(fd >= 0);
|
||||||
|
|
||||||
/* Obtain the buffer. */
|
|
||||||
buf = alloca(fw->block_size);
|
|
||||||
assert(buf);
|
|
||||||
|
|
||||||
/* Write content. */
|
/* Write content. */
|
||||||
fine = 1;
|
fine = 1;
|
||||||
offset = (uint64_t)number * GIGABYTES;
|
offset = (uint64_t)number * GIGABYTES;
|
||||||
@ -392,7 +389,7 @@ static int create_and_fill_file(const char *path, long number, size_t size,
|
|||||||
assert(!fine || remaining == 0);
|
assert(!fine || remaining == 0);
|
||||||
end_measurement(fd, fw);
|
end_measurement(fd, fw);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
printf("OK!\n");
|
printf("OK!\n");
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user