SIONlib  1.7.7
Scalable I/O library for parallel access to task-local files
Data Structures | Macros | Functions
sion_fd.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <assert.h>
#include "sion_lock.h"
#include "sion_fd.h"
Include dependency graph for sion_fd.c:

Go to the source code of this file.

Data Structures

struct  _sion_fddata
 

Macros

#define _XOPEN_SOURCE   700
 
#define sion_assert(expr, args)   (assert(expr))
 
#define SION_FDDATA_INITIALIZER   {0,0,-1,NULL}
 

Functions

int _sion_newvcd (void *data, int type)
 
int _sion_freevcd (int sid)
 
void * _sion_vcdtovcon (int sid)
 
int _sion_vcdtype (int sid)
 
int _sion_reassignvcd (int sid, void *data, int type)
 
int _sion_new_fd (sion_fddata *fdd, void *data, int type)
 
int _sion_set_fd (sion_fddata *fdd, int fd, void *data, int type, char *text)
 
int _sion_free_fd (sion_fddata *fdd, int fd, char *text)
 
void * _sion_fd2ptr (sion_fddata *fdd, int fd)
 
int _sion_fd2type (sion_fddata *fdd, int fd, char *text)
 
int _sion_ptr2fd (sion_fddata *fdd, void *ptr, char *text)
 
int _sion_reassign_fd (sion_fddata *fdd, int fd, void *data, int type, char *text)
 
int _sion_fd_size (sion_fddata *fdd)
 

Detailed Description

Author
Th.Eickermann & W.Frings (December 2000)

Definition in file sion_fd.c.

Function Documentation

◆ _sion_fd2ptr()

void* _sion_fd2ptr ( sion_fddata *  fdd,
int  fd 
)
Returns
The data associated with a descriptor

Definition at line 247 of file sion_fd.c.

Referenced by _sion_vcdtovcon().

◆ _sion_fd2type()

int _sion_fd2type ( sion_fddata *  fdd,
int  fd,
char *  text 
)
Returns
The type (of data) associated with a descriptor

Definition at line 265 of file sion_fd.c.

Referenced by _sion_vcdtype().

◆ _sion_fd_size()

int _sion_fd_size ( sion_fddata *  fdd)
Returns
The size of the descriptor array.

Definition at line 339 of file sion_fd.c.

◆ _sion_free_fd()

int _sion_free_fd ( sion_fddata *  fdd,
int  fd,
char *  text 
)

free a descriptor

Definition at line 213 of file sion_fd.c.

Referenced by _sion_freevcd().

◆ _sion_freevcd()

int _sion_freevcd ( int  sid)

Wrapper for _sion_free_fd()

Definition at line 48 of file sion_fd.c.

References _sion_free_fd().

◆ _sion_new_fd()

int _sion_new_fd ( sion_fddata *  fdd,
void *  data,
int  type 
)

Get a new descriptor and assign data/type to it.

Returns
The new descriptor or -1 in case of an error.

Definition at line 76 of file sion_fd.c.

Referenced by _sion_newvcd().

◆ _sion_newvcd()

int _sion_newvcd ( void *  data,
int  type 
)

Wrapper for _sion_new_fd()

Definition at line 43 of file sion_fd.c.

References _sion_new_fd().

◆ _sion_ptr2fd()

int _sion_ptr2fd ( sion_fddata *  fdd,
void *  ptr,
char *  text 
)
Returns
The smallest valid descriptor, that has 'data' associated to or -1 if there is none

Definition at line 289 of file sion_fd.c.

◆ _sion_reassign_fd()

int _sion_reassign_fd ( sion_fddata *  fdd,
int  fd,
void *  data,
int  type,
char *  text 
)

Assign new data/type to descriptor fd, where fd must be in use

Returns
1 if successful, 0 otherwise

Definition at line 315 of file sion_fd.c.

Referenced by _sion_reassignvcd().

◆ _sion_reassignvcd()

int _sion_reassignvcd ( int  sid,
void *  data,
int  type 
)

Wrapper for _sion_reassign_fd()

Definition at line 63 of file sion_fd.c.

References _sion_reassign_fd().

◆ _sion_set_fd()

int _sion_set_fd ( sion_fddata *  fdd,
int  fd,
void *  data,
int  type,
char *  text 
)

Add data/type to the descriptor fd. fd must be non-negative and not be in use

Returns
1 if successful, 0 otherwise

Definition at line 148 of file sion_fd.c.

◆ _sion_vcdtovcon()

void* _sion_vcdtovcon ( int  sid)

Wrapper for _sion_fd2ptr()

Definition at line 53 of file sion_fd.c.

References _sion_fd2ptr().

Referenced by fsion_get_fileno_c(), sion_fread(), and sion_get_position().

◆ _sion_vcdtype()

int _sion_vcdtype ( int  sid)

Wrapper for _sion_fd2type()

Definition at line 58 of file sion_fd.c.

References _sion_fd2type().

Referenced by fsion_get_fileno_c(), sion_fread(), and sion_get_position().