*
* max_name_len: maximum file name length
* page_size: memory page size to use with 'mmap()'
+ * nospc_size_ok: file size is updated even if the write operation failed with
+ * ENOSPC error
+ * can_mmap: file-system supports share writable 'mmap()' operation
* fstype: file-system type (e.g., "ubifs")
*/
static struct {
int max_name_len;
int page_size;
+ unsigned int nospc_size_ok:1;
+ unsigned int can_mmap:1;
const char *fstype;
-} fsinfo;
+} fsinfo = {
+ .nospc_size_ok = 1,
+ .can_mmap = 1,
+};
/* Structures to store data written to the test file system,
so that we can check whether the file system is correct. */
test starts */
static unsigned log10_initial_free_space = 0; /* log10 of initial_free_space */
-static int check_nospc_files = 1; /* Also check data in files that incurred a
- "no space" error */
-
-static int can_mmap = 1; /* Can write via mmap */
-
static unsigned int check_run_no;
/*
CHECK(errno = ENOSPC);
file->no_space_error = 1;
/* Delete errored files */
- if (!check_nospc_files)
+ if (!fsinfo.nospc_size_ok)
file_delete(file);
return 0;
}
unsigned seed;
int truncate = 0;
- if (can_mmap && !full && !file->deleted && tests_random_no(100) == 1) {
+ if (fsinfo.can_mmap && !full && !file->deleted &&
+ tests_random_no(100) == 1) {
file_mmap_write(file);
return;
}
file_write_info(file, offset, actual, seed);
/* Delete errored files */
- if (!check_nospc_files && file->no_space_error) {
+ if (!fsinfo.nospc_size_ok && file->no_space_error) {
file_delete(file);
return;
}
struct stat st;
/* Do not check files that have errored */
- if (!check_nospc_files && file->no_space_error)
+ if (!fsinfo.nospc_size_ok && file->no_space_error)
return;
/* Do not check the same file twice */
if (file->check_run_no == check_run_no)
}
}
/* Close any open files that have errored */
- if (!check_nospc_files) {
+ if (!fsinfo.nospc_size_ok) {
ofi = open_files;
while (ofi) {
if (ofi->fdi->file->no_space_error) {
/* Get memory page size for 'mmap()' */
fsinfo.page_size = sysconf(_SC_PAGE_SIZE);
CHECK(fsinfo.page_size > 0);
+
+ /*
+ * JFFS2 does not support shared writable mmap and it may report
+ * incorrect file size after "no space" errors.
+ */
+ if (strcmp(fsinfo.fstype, "jffs2") == 0) {
+ fsinfo.nospc_size_ok = 0;
+ fsinfo.can_mmap = 0;
+ }
+
}
static const char doc[] = PROGRAM_NAME " version " PROGRAM_VERSION
tests_file_system_mount_dir = (void *)args.mount_point;
tests_file_system_type = (void *)fsinfo.fstype;
- /*
- * JFFS2 does not support shared writable mmap and it may report
- * incorrect file size after "no space" errors.
- */
- if (strcmp(tests_file_system_type, "jffs2") == 0) {
- check_nospc_files = 0;
- can_mmap = 0;
- }
-
/* Do the actual test */
ret = integck();
if (ret)