Basic Solution File System - BSFS
Loading...
Searching...
No Matches
dd.c File Reference

Implementation of dd command for BSFS. More...

Macros

#define DEFAULT_BLOCK_SIZE   512
#define MAX_BUFFER_SIZE   (64 * 1024)

Functions

int dd (FILE *disk, superblock_t *sb, char **args)
 Generate a file by copying blocks from /dev/zero or /dev/random.

Variables

char current_path []
 Current working directory text (provided by the browser prompt)

Detailed Description

Implementation of dd command for BSFS.

Creates files of specified size to test filesystem capacity and functionality.

Usage: dd if=<input> of=<output> bs=<block_size> count=<blocks>

  • if: input source (e.g., /dev/zero, /dev/random)
  • of: output path (destination file)
  • bs: block size (supports K/M/G suffixes)
  • count: number of blocks to write

Macro Definition Documentation

◆ DEFAULT_BLOCK_SIZE

#define DEFAULT_BLOCK_SIZE   512

Default block size in bytes.

◆ MAX_BUFFER_SIZE

#define MAX_BUFFER_SIZE   (64 * 1024)

Maximum allowed buffer size.

Function Documentation

◆ dd()

int dd ( FILE * disk,
superblock_t * sb,
char ** args )

Generate a file by copying blocks from /dev/zero or /dev/random.

Usage: dd if=/dev/zero of=<file> bs=<size> count=<n>

Parameters
diskOpen filesystem image.
sbLoaded superblock.
argsKey-value args (if/of/bs/count) parsed by the command.
Returns
1 to continue the REPL.