PKUOS - Pintos
Pintos source browser for PKU Operating System course
Macros | Functions | Variables
grow-two-files.c File Reference
#include <random.h>
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
Include dependency graph for grow-two-files.c:

Go to the source code of this file.

Macros

#define FILE_SIZE   8143
 Grows two files in parallel and checks that their contents are correct. More...
 

Functions

static void write_some_bytes (const char *file_name, int fd, const char *buf, size_t *ofs)
 
void test_main (void)
 tests/main.h More...
 

Variables

static char buf_a [FILE_SIZE]
 
static char buf_b [FILE_SIZE]
 

Macro Definition Documentation

◆ FILE_SIZE

#define FILE_SIZE   8143

Grows two files in parallel and checks that their contents are correct.

Definition at line 9 of file grow-two-files.c.

Function Documentation

◆ test_main()

void test_main ( void  )

tests/main.h

tests/main.h

tests/main.h

This must fail, because that directory is non-empty.

tests/main.h

This must fail.

tests/main.h

Then delete most of them, for two reasons. First, "tar" limits file names to 100 characters (which could be extended to 256 without much trouble). Second, a full disk has no room for the tar archive.

Definition at line 32 of file grow-two-files.c.

References buf_a, buf_b, CHECK, check_file(), close(), create(), FILE_SIZE, msg(), open(), random_bytes(), random_init(), and write_some_bytes().

Here is the call graph for this function:

◆ write_some_bytes()

static void write_some_bytes ( const char *  file_name,
int  fd,
const char *  buf,
size_t ofs 
)
static

Definition at line 14 of file grow-two-files.c.

References block_size(), buf, fail(), file_name, FILE_SIZE, random_ulong(), and write().

Referenced by test_main().

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

Variable Documentation

◆ buf_a

char buf_a[FILE_SIZE]
static

Definition at line 10 of file grow-two-files.c.

Referenced by test_main().

◆ buf_b

char buf_b[FILE_SIZE]
static

Definition at line 11 of file grow-two-files.c.

Referenced by test_main().