fosfat.h File Reference

#include <inttypes.h>

Go to the source code of this file.

Data Structures

struct  fosfat_time_t
struct  fosfat_att_t
struct  fosfat_file_t

Typedefs

typedef struct fosfat_s fosfat_t

Enumerations

enum  fosfat_disk_t { FOSFAT_FD, FOSFAT_HD, FOSFAT_AD, FOSFAT_ED }

Functions

fosfat_tfosfat_open (const char *dev, fosfat_disk_t disk, unsigned int flag)
 Load a device compatible Smaky FOS.
void fosfat_close (fosfat_t *fosfat)
 Free the memory and close the device properly.
void fosfat_logger (int state)
 Change log level (verbosity).
char * fosfat_diskname (fosfat_t *fosfat)
 Get the disk's name of a specific device.
fosfat_file_tfosfat_list_dir (fosfat_t *fosfat, const char *location)
 Get file/dir list of a directory in a linked list.
void fosfat_free_listdir (fosfat_file_t *var)
 Free the memory for an linked list created by fosfat_list_dir().
int fosfat_isdir (fosfat_t *fosfat, const char *location)
 Get boolean information on a specific file or folder.
int fosfat_islink (fosfat_t *fosfat, const char *location)
 Get boolean information on a specific file or folder.
int fosfat_isvisible (fosfat_t *fosfat, const char *location)
 Get boolean information on a specific file or folder.
int fosfat_isencoded (fosfat_t *fosfat, const char *location)
 Get boolean information on a specific file or folder.
int fosfat_isopenexm (fosfat_t *fosfat, const char *location)
 Get boolean information on a specific file or folder.
fosfat_file_tfosfat_get_stat (fosfat_t *fosfat, const char *location)
 Get some informations on a file or a directory.
char * fosfat_symlink (fosfat_t *fosfat, const char *location)
 Get the target of a soft-link.
int fosfat_get_file (fosfat_t *fosfat, const char *src, const char *dst, int output)
 Get a file from a location and put this on the user hard drive.
uint8_t * fosfat_get_buffer (fosfat_t *fosfat, const char *path, int offset, int size)
 Get a buffer of a file.

Detailed Description

libfosfat public API header.

Definition in file fosfat.h.


Typedef Documentation

typedef struct fosfat_s fosfat_t

Fosfat handle on a disk.

Definition at line 104 of file fosfat.h.


Enumeration Type Documentation

Disk types.

Enumerator:
FOSFAT_FD 

Floppy Disk.

FOSFAT_HD 

Hard Disk.

FOSFAT_AD 

Auto Detection.

FOSFAT_ED 

Auto Detection fails.

Definition at line 65 of file fosfat.h.


Function Documentation

void fosfat_close ( fosfat_t fosfat  ) 

Free the memory and close the device properly.

Parameters:
[in] fosfat disk handle.
char* fosfat_diskname ( fosfat_t fosfat  ) 

Get the disk's name of a specific device.

The pointer must be freed when no longer used.

Parameters:
[in] fosfat disk handle.
Returns:
NULL if error/null-string or return the name.
void fosfat_free_listdir ( fosfat_file_t var  ) 

Free the memory for an linked list created by fosfat_list_dir().

Parameters:
[in] var first file of the linked list.
uint8_t* fosfat_get_buffer ( fosfat_t fosfat,
const char *  path,
int  offset,
int  size 
)

Get a buffer of a file.

Useful to get only a part of a file without save anything on the user hard drive. You can get all the data if you prefer. The pointer must be freed when no longer used.

Parameters:
[in] fosfat disk handle.
[in] path file where get data.
[in] offset from where (in bytes) in the data.
[in] size how many bytes.
Returns:
NULL if error or return the buffer.
int fosfat_get_file ( fosfat_t fosfat,
const char *  src,
const char *  dst,
int  output 
)

Get a file from a location and put this on the user hard drive.

You can't get a directory with this function, you must recursively list the directory with fosfat_list_dir() and use fosfat_get_file() with each file entry.

Parameters:
[in] fosfat disk handle.
[in] src source location on the FOS disk.
[in] dst destination location on the user hard drive.
[in] output boolean to print copy progression in the terminal.
Returns:
a boolean, 0 for error.
fosfat_file_t* fosfat_get_stat ( fosfat_t fosfat,
const char *  location 
)

Get some informations on a file or a directory.

File size, attributes, creation date, writing date and use date. Look fosfat_file_t structure for more informations. The pointer must be freed when no longer used.

Parameters:
[in] fosfat disk handle.
[in] location file or directory where get informations.
Returns:
NULL if error or return the file structure.
int fosfat_isdir ( fosfat_t fosfat,
const char *  location 
)

Get boolean information on a specific file or folder.

Test if the location is a directory.

Parameters:
[in] fosfat disk handle.
[in] location file or directory to test.
Returns:
a boolean, 0 for false.
int fosfat_isencoded ( fosfat_t fosfat,
const char *  location 
)

Get boolean information on a specific file or folder.

Test if the location is encoded.

Parameters:
[in] fosfat disk handle.
[in] location file or directory to test.
Returns:
a boolean, 0 for false.
int fosfat_islink ( fosfat_t fosfat,
const char *  location 
)

Get boolean information on a specific file or folder.

Test if the location is a soft-link.

Parameters:
[in] fosfat disk handle.
[in] location file or directory to test.
Returns:
a boolean, 0 for false.
int fosfat_isopenexm ( fosfat_t fosfat,
const char *  location 
)

Get boolean information on a specific file or folder.

Test if the location is 'open exclusif' and 'multiple'.

Parameters:
[in] fosfat disk handle.
[in] location file or directory to test.
Returns:
a boolean, 0 for false.
int fosfat_isvisible ( fosfat_t fosfat,
const char *  location 
)

Get boolean information on a specific file or folder.

Test if the location is not hidden.

Parameters:
[in] fosfat disk handle.
[in] location file or directory to test.
Returns:
a boolean, 0 for false.
fosfat_file_t* fosfat_list_dir ( fosfat_t fosfat,
const char *  location 
)

Get file/dir list of a directory in a linked list.

When the list is no longer used, fosfat_free_listdir() must always be called to free the memory.

Parameters:
[in] fosfat disk handle.
[in] location directory to list.
Returns:
NULL if error or return the first file in the directory.
void fosfat_logger ( int  state  ) 

Change log level (verbosity).

By default, the internal logger is disabled. Use this function to enable or disable the verbosity. The logger is enabled or disabled for all devices loaded.

Parameters:
[in] state boolean, 0 to disable the logger.
fosfat_t* fosfat_open ( const char *  dev,
fosfat_disk_t  disk,
unsigned int  flag 
)

Load a device compatible Smaky FOS.

The device can be a file or a disk. But with Window$ currently only device are supported. fosfat_close() must always be called to free the memory and close the device.

Linux : specify the location on /dev/... or on a file Window$ : specify the device with 'a' for diskette, 'c' for the first hard disk, etc,...

Parameters:
[in] dev device or location.
[in] disk type of disk, use FOSFAT_AD for auto-detection.
[in] flag use F_UNDELETE to load deleted files or 0 for normal.
Returns:
NULL if error or return the disk handle.
char* fosfat_symlink ( fosfat_t fosfat,
const char *  location 
)

Get the target of a soft-link.

If the location is a soft-link, then this function will return the location of the target. The pointer must be freed when no longer used.

Parameters:
[in] fosfat disk handle.
[in] location soft-link.
Returns:
NULL if error/null-string or return the location.

Generated on Sun Mar 14 16:38:17 2010 for Fosfat by  doxygen 1.6.1