long imglen; // length of image
char *data; // image data
-void display_help (int error)
+static void display_help (int error)
{
printf("Usage: %s [OPTION]... INPUTFILE\n"
"Dump the contents of a binary JFFS2 image.\n\n"
exit(error ? EXIT_FAILURE : EXIT_SUCCESS);
}
-void display_version (void)
+static void display_version (void)
{
common_print_version();
printf("Copyright (C) 2003 Thomas Gleixner \n"
int datsize; // Size of data chunks, when oob data is inside the binary image
int oobsize; // Size of oob chunks, when oob data is inside the binary image
-void process_options (int argc, char *argv[])
+static void process_options (int argc, char *argv[])
{
int error = 0;
/*
* Dump image contents
*/
-void do_dumpcontent (void)
+static void do_dumpcontent (void)
{
char *p = data, *p_free_begin;
union jffs2_node_union *node;
/*
* Convert endianess
*/
-void do_endianconvert (void)
+static void do_endianconvert (void)
{
char *p = data;
union jffs2_node_union *node, newnode;
int target_endian = __BYTE_ORDER;
-void putblock(char *, size_t, size_t *, struct jffs2_raw_inode *);
-struct dir *putdir(struct dir *, struct jffs2_raw_dirent *);
-void printdir(char *o, size_t size, struct dir *d, const char *path,
- int recurse, int want_ctime);
-void freedir(struct dir *);
+static struct jffs2_raw_inode *find_raw_inode(char *, size_t, uint32_t);
-struct jffs2_raw_inode *find_raw_inode(char *o, size_t size, uint32_t ino);
-struct jffs2_raw_dirent *resolvedirent(char *, size_t, uint32_t, uint32_t,
- char *, uint8_t);
-struct jffs2_raw_dirent *resolvename(char *, size_t, uint32_t, char *, uint8_t);
-struct jffs2_raw_dirent *resolveinode(char *, size_t, uint32_t);
-
-struct jffs2_raw_dirent *resolvepath0(char *, size_t, uint32_t, const char *,
- uint32_t *, int);
-struct jffs2_raw_dirent *resolvepath(char *, size_t, uint32_t, const char *,
- uint32_t *);
-
-void lsdir(char *, size_t, const char *, int, int);
-void catfile(char *, size_t, char *, char *, size_t, size_t *);
-
-int main(int, char **);
+static void lsdir(char *, size_t, const char *, int, int);
/* writes file node into buffer, to the proper position. */
/* reading all valid nodes in version order reconstructs the file. */
n - node
*/
-void putblock(char *b, size_t bsize, size_t * rsize,
+static void putblock(char *b, size_t bsize, size_t * rsize,
struct jffs2_raw_inode *n)
{
uLongf dlen = je32_to_cpu(n->dsize);
return value: directory struct value replacing dd
*/
-struct dir *putdir(struct dir *dd, struct jffs2_raw_dirent *n)
+static struct dir *putdir(struct dir *dd, struct jffs2_raw_dirent *n)
{
struct dir *o, *d, *p;
* Return the standard ls-like mode string from a file mode.
* This is static and so is overwritten on each call.
*/
-const char *mode_string(int mode)
+static const char *mode_string(int mode)
{
static char buf[12];
d - dir struct
*/
-void printdir(char *o, size_t size, struct dir *d, const char *path, int recurse,
- int want_ctime)
+static void printdir(char *o, size_t size, struct dir *d, const char *path,
+ int recurse, int want_ctime)
{
char m;
char *filetime;
d - dir struct
*/
-void freedir(struct dir *d)
+static void freedir(struct dir *d)
{
struct dir *t;
inode, or NULL
*/
-struct jffs2_raw_inode *find_raw_inode(char *o, size_t size, uint32_t ino)
+static struct jffs2_raw_inode *find_raw_inode(char *o, size_t size,
+ uint32_t ino)
{
/* aligned! */
union jffs2_node_union *n;
return value: result directory structure, replaces d.
*/
-struct dir *collectdir(char *o, size_t size, uint32_t ino, struct dir *d)
+static struct dir *collectdir(char *o, size_t size, uint32_t ino, struct dir *d)
{
/* aligned! */
union jffs2_node_union *n;
filesystem image or NULL
*/
-struct jffs2_raw_dirent *resolvedirent(char *o, size_t size,
+static struct jffs2_raw_dirent *resolvedirent(char *o, size_t size,
uint32_t ino, uint32_t pino,
char *name, uint8_t nsize)
{
filesystem image or NULL
*/
-struct jffs2_raw_dirent *resolvename(char *o, size_t size, uint32_t pino,
+static struct jffs2_raw_dirent *resolvename(char *o, size_t size, uint32_t pino,
char *name, uint8_t nsize)
{
return resolvedirent(o, size, 0, pino, name, nsize);
filesystem image or NULL
*/
-struct jffs2_raw_dirent *resolveinode(char *o, size_t size, uint32_t ino)
+static struct jffs2_raw_dirent *resolveinode(char *o, size_t size, uint32_t ino)
{
return resolvedirent(o, size, ino, 0, NULL, 0);
}
(return value is NULL), but it has inode (*inos=1)
*/
-struct jffs2_raw_dirent *resolvepath0(char *o, size_t size, uint32_t ino,
+static struct jffs2_raw_dirent *resolvepath0(char *o, size_t size, uint32_t ino,
const char *p, uint32_t * inos, int recc)
{
struct jffs2_raw_dirent *dir = NULL;
(return value is NULL), but it has inode (*inos=1)
*/
-struct jffs2_raw_dirent *resolvepath(char *o, size_t size, uint32_t ino,
+static struct jffs2_raw_dirent *resolvepath(char *o, size_t size, uint32_t ino,
const char *p, uint32_t * inos)
{
return resolvepath0(o, size, ino, p, inos, 0);
p - path to be resolved
*/
-void lsdir(char *o, size_t size, const char *path, int recurse, int want_ctime)
+static void lsdir(char *o, size_t size, const char *path, int recurse,
+ int want_ctime)
{
struct jffs2_raw_dirent *dd;
struct dir *d = NULL;
rsize - file result size
*/
-void catfile(char *o, size_t size, char *path, char *b, size_t bsize,
- size_t * rsize)
+static void catfile(char *o, size_t size, char *path, char *b, size_t bsize,
+ size_t * rsize)
{
struct jffs2_raw_dirent *dd;
struct jffs2_raw_inode *ri;
static int fake_times = 0;
int target_endian = __BYTE_ORDER;
-uint32_t find_hardlink(struct filesystem_entry *e)
+static uint32_t find_hardlink(struct filesystem_entry *e)
{
struct filesystem_entry *f;
struct rb_node **n = &hardlinks.rb_node;
return 0;
}
-extern char *xreadlink(const char *path)
+static char *xreadlink(const char *path)
{
static const int GROWBY = 80; /* how large we will grow strings by */
" -V, --version Display version information\n"
" -i, --incremental=FILE Parse FILE and generate appendage output for it\n\n";
-int load_next_block() {
+static int load_next_block(void) {
int ret;
ret = read(in_fd, file_buffer, erase_block_size);
return ret;
}
-void process_buffer(int inp_size) {
+static void process_buffer(int inp_size) {
uint8_t *p = file_buffer;
union jffs2_node_union *node;
uint16_t type;
}
}
-void parse_image(){
+static void parse_image(void){
int ret;
file_buffer = xmalloc(erase_block_size);
static void full_write(void *target_buff, const void *buf, int len);
-void setup_cleanmarker(void)
+static void setup_cleanmarker(void)
{
cleanmarker.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
cleanmarker.nodetype = cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER);
cleanmarker.hdr_crc = cpu_to_je32(mtd_crc32(0, &cleanmarker, sizeof(struct jffs2_unknown_node)-4));
}
-void process_options (int argc, char **argv)
+static void process_options (int argc, char **argv)
{
int opt,c;
}
-void init_buffers(void)
+static void init_buffers(void)
{
data_buffer = xmalloc(erase_block_size);
file_buffer = xmalloc(erase_block_size);
}
-void init_sumlist(void)
+static void init_sumlist(void)
{
sum_collected = xzalloc(sizeof(*sum_collected));
}
-void clean_buffers(void)
+static void clean_buffers(void)
{
free(data_buffer);
free(file_buffer);
}
-void clean_sumlist(void)
+static void clean_sumlist(void)
{
union jffs2_sum_mem *temp;
}
}
-int load_next_block(void)
+static int load_next_block(void)
{
int ret;
ret = read(in_fd, file_buffer, erase_block_size);
return ret;
}
-void write_buff_to_file(void)
+static void write_buff_to_file(void)
{
int ret;
int len = data_ofs;
data_ofs = 0;
}
-void dump_sum_records(void)
+static void dump_sum_records(void)
{
struct jffs2_raw_summary isum;
}
}
-void flush_buffers(void)
+static void flush_buffers(void)
{
if ((add_cleanmarkers == 1) && (found_cleanmarkers == 1)) { /* CLEANMARKER */
}
}
-int add_sum_mem(union jffs2_sum_mem *item)
+static int add_sum_mem(union jffs2_sum_mem *item)
{
if (!sum_collected->sum_list_head)
return 0;
}
-void add_sum_inode_mem(union jffs2_node_union *node)
+static void add_sum_inode_mem(union jffs2_node_union *node)
{
struct jffs2_sum_inode_mem *temp = xmalloc(sizeof(*temp));
add_sum_mem((union jffs2_sum_mem *) temp);
}
-void add_sum_dirent_mem(union jffs2_node_union *node)
+static void add_sum_dirent_mem(union jffs2_node_union *node)
{
struct jffs2_sum_dirent_mem *temp = xmalloc(sizeof(*temp) + node->d.nsize);
add_sum_mem((union jffs2_sum_mem *) temp);
}
-void add_sum_xattr_mem(union jffs2_node_union *node)
+static void add_sum_xattr_mem(union jffs2_node_union *node)
{
struct jffs2_sum_xattr_mem *temp = xmalloc(sizeof(*temp));
add_sum_mem((union jffs2_sum_mem *) temp);
}
-void add_sum_xref_mem(union jffs2_node_union *node)
+static void add_sum_xref_mem(union jffs2_node_union *node)
{
struct jffs2_sum_xref_mem *temp = xmalloc(sizeof(*temp));
add_sum_mem((union jffs2_sum_mem *) temp);
}
-void write_dirent_to_buff(union jffs2_node_union *node)
+static void write_dirent_to_buff(union jffs2_node_union *node)
{
pad_block_if_less_than(je32_to_cpu (node->d.totlen),JFFS2_SUMMARY_DIRENT_SIZE(node->d.nsize));
add_sum_dirent_mem(node);
}
-void write_inode_to_buff(union jffs2_node_union *node)
+static void write_inode_to_buff(union jffs2_node_union *node)
{
pad_block_if_less_than(je32_to_cpu (node->i.totlen),JFFS2_SUMMARY_INODE_SIZE);
add_sum_inode_mem(node); /* Add inode summary mem to summary list */
padword();
}
-void write_xattr_to_buff(union jffs2_node_union *node)
+static void write_xattr_to_buff(union jffs2_node_union *node)
{
pad_block_if_less_than(je32_to_cpu(node->x.totlen), JFFS2_SUMMARY_XATTR_SIZE);
add_sum_xattr_mem(node); /* Add xdatum summary mem to summary list */
padword();
}
-void write_xref_to_buff(union jffs2_node_union *node)
+static void write_xref_to_buff(union jffs2_node_union *node)
{
pad_block_if_less_than(je32_to_cpu(node->r.totlen), JFFS2_SUMMARY_XREF_SIZE);
add_sum_xref_mem(node); /* Add xref summary mem to summary list */
padword();
}
-void create_summed_image(int inp_size)
+static void create_summed_image(int inp_size)
{
uint8_t *p = file_buffer;
union jffs2_node_union *node;
*/
#include <stdint.h>
+#include "crc32.h"
static const uint32_t crc32_table[256] = {
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
* q = values of the polynomial (known)
*/
-int
+static int
invert_vdm(gf *src, int k)
{
int i, j, row, col ;
return 0;
}
-int do_oob_op(libmtd_t desc, const struct mtd_dev_info *mtd, int fd,
- uint64_t start, uint64_t length, void *data, unsigned int cmd64,
- unsigned int cmd)
+static int do_oob_op(libmtd_t desc, const struct mtd_dev_info *mtd, int fd,
+ uint64_t start, uint64_t length, void *data,
+ unsigned int cmd64, unsigned int cmd)
{
int ret, oob_offs;
struct mtd_oob_buf64 oob64;
#define MAXSCAN 10
-void show_header(int mhoffs) {
+static void show_header(int mhoffs) {
int i, unitsize, numunits, bmbits, numpart;
int start, end, num, nextunit;
unsigned int flags;
#include <common.h>
#include <mtd/mtd-user.h>
-ssize_t xread(int fd, void *buf, size_t count)
+static ssize_t xread(int fd, void *buf, size_t count)
{
ssize_t ret, done = 0;
} /* format_partition */
/* Show usage information */
-void showusage(void)
+static void showusage(void)
{
fprintf(stderr, "usage: %s device\n", PROGRAM_NAME);
}
return 0;
}
-int erase_flash(int fd, u_int32_t offset, u_int32_t bytes)
+static int erase_flash(int fd, u_int32_t offset, u_int32_t bytes)
{
int err;
struct erase_info_user erase;
return 0;
}
-void printsize(u_int32_t x)
+static void printsize(u_int32_t x)
{
int i;
static const char *flags = "KMGT";
printf("(%u%c)", x, flags[i]);
}
-int flash_to_file(int fd, off_t offset, size_t len, const char *filename)
+static int flash_to_file(int fd, off_t offset, size_t len, const char *filename)
{
u_int8_t *buf = NULL;
int outfd, err;
return 1;
}
-int file_to_flash(int fd, off_t offset, u_int32_t len, const char *filename)
+static int file_to_flash(int fd, off_t offset, u_int32_t len,
+ const char *filename)
{
u_int8_t *buf = NULL;
FILE *fp;
return 0;
}
-int showinfo(int fd)
+static int showinfo(int fd)
{
int i, err, n;
struct mtd_info_user mtd;
return 0;
}
-void showusage(void)
+static void showusage(void)
{
fprintf(stderr, "usage: %1$s info <device>\n"
" %1$s read <device> <offset> <len> <dest-filename>\n"
#include "mtd/mtd-user.h"
#include "common.h"
-void usage(int status)
+static void usage(int status)
{
fprintf(status ? stderr : stdout,
"usage: %s [OPTIONS] <device>\n\n"
int markbad=0;
int seed;
-int read_and_compare(loff_t ofs, unsigned char *data, unsigned char *rbuf)
+static int read_and_compare(loff_t ofs, unsigned char *data,
+ unsigned char *rbuf)
{
ssize_t len;
int i;
return 0;
}
-int erase_and_write(loff_t ofs, unsigned char *data, unsigned char *rbuf, int nr_reads)
+static int erase_and_write(loff_t ofs, unsigned char *data, unsigned char *rbuf,
+ int nr_reads)
{
struct erase_info_user er;
ssize_t len;
return (0);
}
-void usage(int rc)
+static void usage(int rc)
{
fprintf(stderr, "Usage: %s [-ib] <mtddevice> [<start offset> [<size>]]\n", PROGRAM_NAME);
exit(rc);
int verbose;
};
-void display_help(int status)
+static void display_help(int status)
{
printf("Usage: %s [OPTIONS] MTD-device filename\n"
"Dumps the contents of a resident flash disk\n"
exit(status);
}
-void display_version(void)
+static void display_version(void)
{
common_print_version();
printf("This is free software; see the source for copying conditions. There is NO\n"
exit(0);
}
-void process_options(int argc, char *argv[], struct rfd *rfd)
+static void process_options(int argc, char *argv[], struct rfd *rfd)
{
int error = 0;
rfd->out_filename = argv[optind + 1];
}
-int build_block_map(struct rfd *rfd, int fd, int block)
+static int build_block_map(struct rfd *rfd, int fd, int block)
{
int i;
int sectors;
#include "common.h"
-void display_help(int status)
+static void display_help(int status)
{
printf("Usage: %s [OPTIONS] MTD-device\n"
"Formats NOR flash for resident flash disk\n"
exit(status);
}
-void display_version(void)
+static void display_version(void)
{
common_print_version();
printf("This is free software; see the source for copying conditions. There is NO\n"
exit(0);
}
-void process_options(int argc, char *argv[], const char **mtd_filename)
+static void process_options(int argc, char *argv[], const char **mtd_filename)
{
int error = 0;
Returns file descriptor to open port. Use this fd to write to port
and close it later, when done.
*/
-int setupSerial (const char *dev) {
+static int setupSerial (const char *dev) {
int i, fd;
struct termios tios;
//CRC to calculate out to 0xf0b8 (the hardcoded value at the end)
//and returns TRUE if it is and FALSE if it doesn't.
//Why don't people document better!!!!
-int check_crc_ccitt(char *filename)
+static int check_crc_ccitt(char *filename)
{
FILE *fp;
FILE *logfp;
initially (and once) created by the separate "makefiles.c"
program.
*/
-void send_pwrdn_ok(void){
+static void send_pwrdn_ok(void){
int fd;
FILE *cyclefp;
Appends 16bit CRC at the end of numBytes long buffer.
Make sure buf, extends at least 2 bytes beyond.
*/
-void appendChecksum(char *buf, int numBytes){
+static void appendChecksum(char *buf, int numBytes){
unsigned short crc = 0xffff;
int index = 0;
number of int's in it (this is needed to know how much
data to read and checksum later).
*/
-void make_new_file(char *filename){
+static void make_new_file(char *filename){
int dfd; /* data file descriptor */
/*
Show's help on stdout
*/
-void printHelp(char **argv)
+static void printHelp(char **argv)
{
printf("Usage:%s <options, defined below>\n", argv[0]);
printf("%s </dev/ttyS0,1,2...>: Set com port to send ok to pwr dn msg on\n",
-void processCmdLine(int argc, char **argv)
+static void processCmdLine(int argc, char **argv)
{
int cnt;
//CRC to calculate out to 0xf0b8 (the hardcoded value at the end)
//and returns TRUE if it is and FALSE if it doesn't.
//Why don't people document better!!!!
-void check_crc_ccitt(char *filename)
+static void check_crc_ccitt(char *filename)
{
FILE *fp;
unsigned short crc = 0xffff;
contents, and then appends the checksum at the end of the file,
closes the file and returns.
*/
-void checksum(char *filename){
+static void checksum(char *filename){
FILE *fp;
unsigned short crc = 0xffff;
return p;
}
-void symlink_check(const struct symlink_info *symlink)
+static void symlink_check(const struct symlink_info *symlink)
{
char *path, buf[8192], *target;
struct stat st1, st2;
CHECK(close(fd) != -1);
}
-void tests_sync_directory(const char *file_name)
+static void tests_sync_directory(const char *file_name)
{
char *path;
char *dir;
}
/* Read mount information from /proc/mounts or /etc/mtab */
-int tests_get_mount_info(struct mntent *info)
+static int tests_get_mount_info(struct mntent *info)
{
FILE *f;
struct mntent *entry;
#define WRITE_BUFFER_SIZE 32768
-void ftrunc(void)
+static void ftrunc(void)
{
int fd, i;
pid_t pid;
/* Title of this test */
-const char *ftrunc_get_title(void)
+static const char *ftrunc_get_title(void)
{
return "Truncate a large test file";
}
/* Description of this test */
-const char *ftrunc_get_description(void)
+static const char *ftrunc_get_description(void)
{
return
"Create a file named ftrunc_test_file. " \
#define MAX_ORPHANS 1000000
-void orph(void)
+static void orph(void)
{
pid_t pid;
unsigned i, j, k, n;
/* Title of this test */
-const char *orph_get_title(void)
+static const char *orph_get_title(void)
{
return "Create many open unlinked files";
}
/* Description of this test */
-const char *orph_get_description(void)
+static const char *orph_get_description(void)
{
return
"Create a directory named orph_test_dir_pid, where " \
return (unsigned) k;
}
-void perf(void)
+static void perf(void)
{
pid_t pid;
int fd, i;
/* Title of this test */
-const char *perf_get_title(void)
+static const char *perf_get_title(void)
{
return "Measure file system read and write speed";
}
/* Description of this test */
-const char *perf_get_description(void)
+static const char *perf_get_description(void)
{
return
"Syncs the file system (a newly created empty file system is " \
#include "tests.h"
-void test_1(void)
+static void test_1(void)
{
int fd;
pid_t pid;
/* Title of this test */
-const char *test_1_get_title(void)
+static const char *test_1_get_title(void)
{
return "Fill file system while holding deleted big file descriptor";
}
/* Description of this test */
-const char *test_1_get_description(void)
+static const char *test_1_get_description(void)
{
return
"Create a directory named test_1_test_dir_pid, where " \
#include "tests.h"
-void test_2(void)
+static void test_2(void)
{
pid_t pid;
int create, full;
/* Title of this test */
-const char *test_2_get_title(void)
+static const char *test_2_get_title(void)
{
return "Repeated write many small files and one big deleted file";
}
/* Description of this test */
-const char *test_2_get_description(void)
+static const char *test_2_get_description(void)
{
return
"Create a directory named test_2_test_dir_pid, where " \
#define HOLE_BLOCK_SIZE 10000000
-void filestress00(void)
+static void filestress00(void)
{
int fd, i, deleted;
pid_t pid;
/* Title of this test */
-const char *filestress00_get_title(void)
+static const char *filestress00_get_title(void)
{
return "File stress test 00";
}
/* Description of this test */
-const char *filestress00_get_description(void)
+static const char *filestress00_get_description(void)
{
return
"Create a file named filestress00_test_file_pid, where " \
struct gcd_pid *gcd_pid_list = NULL;
-int add_gcd_pid(const char *number)
+static int add_gcd_pid(const char *number)
{
int pid;
FILE *f;
return pid;
}
-int get_pid_list(void)
+static int get_pid_list(void)
{
DIR *dir;
struct dirent *entry;
return 0;
}
-int parse_index_number(const char *name)
+static int parse_index_number(const char *name)
{
const char *p, *q;
int all_zero;
return index;
}
-int get_mtd_index(void)
+static int get_mtd_index(void)
{
FILE *f;
struct mntent *entry;
return mtd_index;
}
-int get_gcd_pid()
+static int get_gcd_pid(void)
{
struct gcd_pid *g;
int mtd_index;
return 0;
}
-void gcd_hupper(void)
+static void gcd_hupper(void)
{
int64_t repeat;
int pid;
/* Title of this test */
-const char *gcd_hupper_get_title(void)
+static const char *gcd_hupper_get_title(void)
{
return "Send HUP signals to gcd";
}
/* Description of this test */
-const char *gcd_hupper_get_description(void)
+static const char *gcd_hupper_get_description(void)
{
return
"Determine the PID of the gcd process. " \
#define WRITE_BUFFER_SIZE 32768
-void adjust_size(void)
+static void adjust_size(void)
{
char dummy[1024];
unsigned long total_memory;
tests_size_parameter = total_memory / 2;
}
-void run_pdf(void)
+static void run_pdf(void)
{
int fd, i;
pid_t pid;
/* Title of this test */
-const char *run_pdf_get_title(void)
+static const char *run_pdf_get_title(void)
{
return "Create / overwrite a large file in the current directory";
}
/* Description of this test */
-const char *run_pdf_get_description(void)
+static const char *run_pdf_get_description(void)
{
return
"Create a file named run_pdf_test_file_pid, " \
#include "tests.h"
-void rmdir00(void)
+static void rmdir00(void)
{
int64_t repeat;
int64_t size, this_size;
/* Title of this test */
-const char *rmdir00_get_title(void)
+static const char *rmdir00_get_title(void)
{
return "Create and remove directories and files";
}
/* Description of this test */
-const char *rmdir00_get_description(void)
+static const char *rmdir00_get_description(void)
{
return
"Create a directory named rmdir00_test_dir_pid, where " \
#include "tests.h"
-void rndrm00(void)
+static void rndrm00(void)
{
int64_t repeat;
int64_t size, this_size;
/* Title of this test */
-const char *rndrm00_get_title(void)
+static const char *rndrm00_get_title(void)
{
return "Randomly create and remove directories and files";
}
/* Description of this test */
-const char *rndrm00_get_description(void)
+static const char *rndrm00_get_description(void)
{
return
"Create a directory named rndrm00_test_dir_pid, where " \
uint32_t dirs_removed = 0;
int64_t *size_ptr = 0;
-void display_stats(void)
+static void display_stats(void)
{
printf( "\nrndrm99 stats:\n"
"\tNumber of files created = %u\n"
struct timeval tv_before;
struct timeval tv_after;
-void before(void)
+static void before(void)
{
CHECK(gettimeofday(&tv_before, NULL) != -1);
}
-void after(const char *msg)
+static void after(const char *msg)
{
time_t diff;
CHECK(gettimeofday(&tv_after, NULL) != -1);
/* Write size random bytes into file descriptor fd at the current position,
returning the number of bytes actually written */
-uint64_t fill_file(int fd, uint64_t size)
+static uint64_t fill_file(int fd, uint64_t size)
{
ssize_t written;
size_t sz;
}
/* Create a file of size file_size */
-uint64_t create_file(const char *file_name, uint64_t file_size)
+static uint64_t create_file(const char *file_name, uint64_t file_size)
{
int fd;
int flags;
}
/* Create an empty sub-directory or small file in the current directory */
-int64_t create_entry(char *return_name)
+static int64_t create_entry(char *return_name)
{
int fd;
char name[256];
}
/* Remove a random file of empty sub-directory from the current directory */
-int64_t remove_entry(void)
+static int64_t remove_entry(void)
{
DIR *dir;
struct dirent *entry;
return result;
}
-void rndrm99(void)
+static void rndrm99(void)
{
int64_t repeat, loop_cnt;
int64_t size, this_size;
/* Title of this test */
-const char *rndrm99_get_title(void)
+static const char *rndrm99_get_title(void)
{
return "Randomly create and remove directories and files";
}
/* Description of this test */
-const char *rndrm99_get_description(void)
+static const char *rndrm99_get_description(void)
{
return
"Create a directory named rndrm99_test_dir_pid, where " \
CHECK(n == length);
}
-void rndwrite00(void)
+static void rndwrite00(void)
{
int fd;
pid_t pid;
/* Title of this test */
-const char *rndwrite00_get_title(void)
+static const char *rndwrite00_get_title(void)
{
return "Randomly write a large test file";
}
/* Description of this test */
-const char *rndwrite00_get_description(void)
+static const char *rndwrite00_get_description(void)
{
return
"Create a file named rndwrite00_test_file_pid, where " \
#define WRITE_BUFFER_SIZE 32768
-void stress_1(void)
+static void stress_1(void)
{
int fd, i;
pid_t pid;
/* Title of this test */
-const char *stress_1_get_title(void)
+static const char *stress_1_get_title(void)
{
return "Create / overwrite a large file";
}
/* Description of this test */
-const char *stress_1_get_description(void)
+static const char *stress_1_get_description(void)
{
return
"Create a file named stress_1_test_file_pid, " \
#define WRITE_BUFFER_SIZE 32768
-void stress_2(void)
+static void stress_2(void)
{
int fd, i;
pid_t pid;
/* Title of this test */
-const char *stress_2_get_title(void)
+static const char *stress_2_get_title(void)
{
return "Create / overwrite a large deleted file";
}
/* Description of this test */
-const char *stress_2_get_description(void)
+static const char *stress_2_get_description(void)
{
return
"Create a file named stress_2_test_file. " \
#define WRITE_BUFFER_SIZE 32768
-void stress_3(void)
+static void stress_3(void)
{
int fd, i;
pid_t pid;
/* Title of this test */
-const char *stress_3_get_title(void)
+static const char *stress_3_get_title(void)
{
return "Create a file with a large hole and fill it";
}
/* Description of this test */
-const char *stress_3_get_description(void)
+static const char *stress_3_get_description(void)
{
return
"Create a file named stress_3_test_file_pid, " \
struct child_info *children = 0;
-void kill_children(void)
+static void kill_children(void)
{
struct child_info *child;
}
}
-void add_child(pid_t child_pid)
+static void add_child(pid_t child_pid)
{
struct child_info *child;
size_t sz;
children = child;
}
-void mark_child_gone(pid_t child_pid)
+static void mark_child_gone(pid_t child_pid)
{
struct child_info *child;
}
}
-int have_children(void)
+static int have_children(void)
{
struct child_info *child;
return 0;
}
-int parse_command_line(char *cmdline, int *pargc, char ***pargv)
+static int parse_command_line(char *cmdline, int *pargc, char ***pargv)
{
char **tmp;
char *p, *v, *q;
return 0;
}
-void signal_handler(int signum)
+static void signal_handler(int signum)
{
kill_children();
}
int result = 0;
int alarm_gone_off = 0;
-void alarm_handler(int signum)
+static void alarm_handler(int signum)
{
if (!result)
alarm_gone_off = 1;
stats reset by doing a (any) write to the /proc/profile
file.
*/
-void doGrabKProfile(int jitterusec, char *fileName)
+static void doGrabKProfile(int jitterusec, char *fileName)
{
int fdSnapshot;
int fdProfile;
/*
Call this routine to clear the kernel profiling buffer /proc/profile
*/
-void clearProfileBuf(void){
+static void clearProfileBuf(void){
int fdProfile;
#define MIN_JITTER_THRESHOLD 1 /* ms minimum jitter threshold */
-void PrintHelpInfo(void)
+static void PrintHelpInfo(void)
{
printf("Usage: plotJittervsFill [options] -f [--file] <input log file name> -t [--jitter_threshold] <jitter threshold in ms>\n");
printf("[options]:\n-v [--version] Print version and exit\n");
* This function handles the command line arguments.
* output: stack size
***********************************************************************/
-void HandleCmdLineArgs(
+static void HandleCmdLineArgs(
int argc, /* number of command-line arguments */
char *argv[]) /* ptrs to command-line arguments */
{