PX4 Firmware
PX4 Autopilot Software http://px4.io
test_file2.c File Reference

File write test. More...

#include <px4_platform_common/defines.h>
#include <sys/stat.h>
#include <dirent.h>
#include <stdio.h>
#include <stddef.h>
#include <unistd.h>
#include <fcntl.h>
#include <perf/perf_counter.h>
#include <string.h>
#include <stdlib.h>
#include <px4_platform_common/getopt.h>
#include "tests_main.h"
Include dependency graph for test_file2.c:

Go to the source code of this file.

Macros

#define FLAG_FSYNC   1
 
#define FLAG_LSEEK   2
 
#define LOG_PATH   PX4_STORAGEDIR
 

Functions

static uint8_t get_value (uint32_t ofs)
 
static int test_corruption (const char *filename, uint32_t write_chunk, uint32_t write_size, uint16_t flags)
 
static void usage (void)
 
int test_file2 (int argc, char *argv[])
 

Detailed Description

File write test.

Definition in file test_file2.c.

Macro Definition Documentation

◆ FLAG_FSYNC

#define FLAG_FSYNC   1

Definition at line 53 of file test_file2.c.

Referenced by test_corruption(), and test_file2().

◆ FLAG_LSEEK

#define FLAG_LSEEK   2

Definition at line 54 of file test_file2.c.

Referenced by test_corruption(), and test_file2().

◆ LOG_PATH

#define LOG_PATH   PX4_STORAGEDIR

Definition at line 56 of file test_file2.c.

Referenced by test_file2().

Function Documentation

◆ get_value()

static uint8_t get_value ( uint32_t  ofs)
static

Definition at line 61 of file test_file2.c.

Referenced by test_corruption().

Here is the caller graph for this function:

◆ test_corruption()

static int test_corruption ( const char *  filename,
uint32_t  write_chunk,
uint32_t  write_size,
uint16_t  flags 
)
static

Definition at line 71 of file test_file2.c.

References counter, fd, FLAG_FSYNC, FLAG_LSEEK, get_value(), read(), and write().

Referenced by test_file2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_file2()

int test_file2 ( int  argc,
char *  argv[] 
)

Definition at line 173 of file test_file2.c.

References FLAG_FSYNC, FLAG_LSEEK, LOG_PATH, test_corruption(), and usage().

Here is the call graph for this function:

◆ usage()

static void usage ( void  )
static

Definition at line 163 of file test_file2.c.

Referenced by test_file2().

Here is the caller graph for this function: