SMREmulator 1.0
ShingledMagneticRecordingEmulator

emudiskimg.h File Reference

Defines the Macros, data types and function prototypes pertaining to the Emulated Disk Image file. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  edi_ident_t
 Defines the structure of the header file for a disk image. More...

Defines

#define OFF_HEADER   sizeof(edi_ident_t)
 Defines the file offset at which the EDI Header should start.

Functions

int edi_create (const char *, uint32_t,...)
 Creates a new EDI file based on the parameters specified.
int edi_dump (int)
 Dumps the metadata for the specified EDI file.

Detailed Description

Defines the Macros, data types and function prototypes pertaining to the Emulated Disk Image file.

Author:
Anand Suresh <anandsuresh@cmu.edu>

Definition in file emudiskimg.h.


Function Documentation

int edi_create ( const char *  filename,
uint32_t  version,
  ... 
)

Creates a new EDI file based on the parameters specified.

Parameters:
filenameThe name of the new EDI file
versionThe EDI format version to use for creating the new EDI file
...Version specific parameters
Returns:
On success, the file descriptor of the newly created EDI file; -1 on failure

Error Codes:

  • EVERSION Invalid/Unknown version number
  • EUNSUPPORTED The version is not supported

Other than the above, the function also returns the error codes returned by open(), pwrite() and the create() function for the specific EDI version.

Definition at line 82 of file emudiskimg.c.

References EDI_MAGIC_NUMBER, and ediv_is_valid().

int edi_dump ( int  fd)

Dumps the metadata for the specified EDI file.

Calling this function sends output to stdout. All metadata for the specified EDI file is printed, including the version, block size, band count, and the write pointers for each band.

Parameters:
fdThe file descriptor index returned by edi_open()
Returns:
Depends on the version

Error Codes:

  • EBADFD - The file descriptor index passed is invalid
  • EUNSUPPORTED - The version of the EDI does not support the operation

Definition at line 164 of file emudiskimg.c.