# ramdrive.cpp File Reference

`#include <stdlib.h>`
`#include <stdio.h>`
`#include <string.h>`
`#include <assert.h>`
`#include "device.h"`

Go to the source code of this file.

## Defines

#define | RAM_DRIVE_SIZE 1024*1024*100

## Functions

int | dev_ramDestroy (void)
device_t * | dev_ramDrive (void)
static int | ramDrive_read (device_t *dev, void *ptr, off_t offset, size_t length)
static int | ramDrive_write (device_t *dev, void *ptr, off_t offset, size_t length)

## Variables

static char * | ram_data = 0x0

## Define Documentation

#define RAM_DRIVE_SIZE 1024*1024*100

Definition at line 39 of file ramdrive.cpp.

Referenced by dev_ramDestroy(), and dev_ramDrive().

## Function Documentation

int dev_ramDestroy | ( | void |  | ) |

Definition at line 95 of file ramdrive.cpp.

References fclose(), fopen(), fwrite(), ram_data, and RAM_DRIVE_SIZE.

Referenced by main().

device_t* dev_ramDrive | ( | void |  | ) |

Definition at line 66 of file ramdrive.cpp.

References fclose(), fopen(), fread(), device_t::major, ram_data, RAM_DRIVE_SIZE, ramDrive_read(), ramDrive_write(), device_t::read, device_t::sectors, and device_t::write.

Referenced by main().

static int ramDrive_read | ( | device_t * | dev,
|  | void * | ptr,
|  | off_t | offset,
|  | size_t | length |
| ) |  |  | `[static]`

Definition at line 43 of file ramdrive.cpp.

References assert, memcpy(), and ram_data.

Referenced by dev_ramDrive().

static int ramDrive_write | ( | device_t * | dev,
|  | void * | ptr,
|  | off_t | offset,
|  | size_t | length |
| ) |  |  | `[static]`

Definition at line 54 of file ramdrive.cpp.

References assert, memcpy(), and ram_data.

Referenced by dev_ramDrive().

## Variable Documentation

char* ram_data = 0x0`[static]`

Definition at line 37 of file ramdrive.cpp.

Referenced by dev_ramDestroy(), dev_ramDrive(), ramDrive_read(), and ramDrive_write().