NOTE: We also assume that the open_file_mutex has been locked */
static void gmx_fio_remove(t_fileio *fio)
{
- t_fileio *prev;
-
/* lock prev, because we're changing it */
gmx_fio_lock(fio->prev);
t_fileio *gmx_fio_open(const char *fn, const char *mode)
{
t_fileio *fio = NULL;
- int i;
char newmode[5];
gmx_bool bRead, bReadWrite;
- int xdrid;
/* sanitize the mode string */
if (strncmp(mode, "r+", 2) == 0)
FILE * gmx_fio_fopen(const char *fn, const char *mode)
{
- FILE *fp, *ret;
+ FILE *ret;
t_fileio *fio;
fio = gmx_fio_open(fn, mode);
int gmx_fio_fclose(FILE *fp)
{
t_fileio *cur;
- t_fileio *found = NULL;
int rc = -1;
cur = gmx_fio_get_first();
/* The fio_mutex should ALWAYS be locked when this function is called */
static int gmx_fio_int_get_file_position(t_fileio *fio, gmx_off_t *offset)
{
- char buf[STRLEN];
-
/* Flush the file, so we are sure it is written */
if (gmx_fio_int_flush(fio))
{
int gmx_fio_get_output_file_positions(gmx_file_position_t **p_outputfiles,
int *p_nfiles)
{
- int i, nfiles, rc, nalloc;
- int pos_hi, pos_lo;
- long pos;
+ int nfiles, nalloc;
gmx_file_position_t * outputfiles;
- char buf[STRLEN];
t_fileio *cur;
nfiles = 0;
we call this routine... */
if (cur->bOpen && !cur->bRead && cur->iFTP != efCPT)
{
- int ret;
/* This is an output file currently open for writing, add it */
if (nfiles == nalloc)
{
static int gmx_fio_int_fsync(t_fileio *fio)
{
int rc = 0;
- int filen = -1;
-
if (fio->fp)
{