GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LATC / V9-1-3 > latc_host / rhel4-32


Interface   Data Structures   File List   Data Fields   Globals  

fo_p.h File Reference

Wrapper functions to stdio calls for creating files. More...

#include <fio_p.h>

Functions

unsigned file_create (File *file, const char *name)
 Create a new file and insert version information.
unsigned file_write (File *file, void *ptr, int nword)
 Copies size bytes from ptr into the file buffer, flushing the buffer if it fills.
unsigned file_vwrite (File *file, FileElement *vec, int n)
 Performs a series of n file write operations using size and pointer information held in the array of file elements, vec.
unsigned file_flush (File *file)
 Checks that this is a write file and that there is data in the buffer, then byteswaps to big-endianness and writes the full FIO_BUF_SIZE bytes of the buffer to disk.
unsigned file_finish (File *file)
 Performs a final flush of the buffer (if needed) and closes the file.


Detailed Description

Wrapper functions to stdio calls for creating files.

Author:
James Swain -- jswain@slac.stanford.edu history 06 Jul 2005: Created

Function Documentation

unsigned file_create ( File file,
const char *  name 
)

Create a new file and insert version information.

Parameters:
file Pointer to the structure to use for this file descriptor
name Full pathname of the file to open
Return values:
LATC_SUCCESS if the file opens successfully for writing
LATC_BADFOPEN if the file fails to open

References _File::fd, and _File::mode.

Referenced by LATC_createFile(), and LATC_createMap().

unsigned file_finish ( File file  ) 

Performs a final flush of the buffer (if needed) and closes the file.

Parameters:
file Pointer to a File structure that has been initialised with file_open_w or file_open_r
Return values:
LATC_BADWRITE if the final write of the buffer failed
LATC_BADCLOSE if the file close failed
LATC_SUCCESS if all goes well

References _File::fd, and file_flush().

Referenced by LATC_createFile(), and LATC_createMap().

unsigned file_flush ( File file  ) 

Checks that this is a write file and that there is data in the buffer, then byteswaps to big-endianness and writes the full FIO_BUF_SIZE bytes of the buffer to disk.

Parameters:
file Pointer to a File structure that has been initialised with file_open_w (although just returns LATC_SUCCESS if used on a file opened for reading)
Return values:
LATC_BADWRITE if the buffer fails to write
LATC_SUCCESS if all goes well
Warning:
The file_flush is destructive (clears the buffer and resets the pointer) even if the write fails.

References _File::buffer, _File::fd, _File::mode, and _File::used.

Referenced by file_finish(), and file_write().

unsigned file_vwrite ( File file,
FileElement vec,
int  n 
)

Performs a series of n file write operations using size and pointer information held in the array of file elements, vec.

Parameters:
file Pointer to a file structure that has been initialised with file_open_w
vec Array of FileElement structures listing fragments to write and their sizes
n Number of elements in the array
Return values:
LATC_BADWRITE if file_flush is called and fails
LATC_READONLY if called using a file that was opened for read-only
LATC_SUCCESS if all goes well.

References _FileElement::done, and file_write().

unsigned file_write ( File file,
void *  ptr,
int  nword 
)

Copies size bytes from ptr into the file buffer, flushing the buffer if it fills.

Parameters:
file Pointer to a file structure that has been initialised with file_open_w.
nword Number of 32 bit words in the block to write
ptr Pointer to the block to write to the file
Return values:
LATC_BADWRITE if file_flush is called and fails
LATC_READONLY if called using a file that was opened for read-only
LATC_SUCCESS if all goes well.

References _File::buffer, _File::fd, file_flush(), _File::mode, and _File::used.

Referenced by file_vwrite(), LATC_createFile(), and LATC_createMap().


Generated on Sat Apr 9 19:53:21 2011 by  doxygen 1.5.8