16 #ifndef SION_SION_COMMON_H
17 #define SION_SION_COMMON_H
28 #define SION_SERIAL_MASTER
30 #define SION_MAX_FSBLOCKSIZE 32*1024*1024
31 #define SION_DEFAULT_FSBLOCKSIZE 2*1024*1024
33 #define SION_FILENAME_LENGTH 1024
37 #define WFLARGEMETABLOCK_none
44 int _sion_close_sid(
int sid);
47 size_t sion_fwrite(
const void *data,
size_t size,
size_t nitems,
int sid);
48 size_t sion_fread(
void *data,
size_t size,
size_t nitems,
int sid);
51 size_t sion_fwrite_key(
const void *data, uint64_t key,
size_t size,
size_t nitems,
int sid);
52 size_t sion_fread_key(
void *data, uint64_t key,
size_t size,
size_t nitems,
int sid);
59 int sion_seek_key(
int sid, uint64_t key,
int entrynum, sion_int64 posinentry );
71 sion_int64 num_blocks;
72 sion_int64 total_size;
88 int sion_dup(
int sid,
int mode,
int rank, uint64_t key);
92 int sion_set_fp_closed(
int sid);
93 int sion_set_second_fp(
int sid, FILE *fp);
94 int sion_unset_second_fp(
int sid);
95 FILE * sion_get_fp(
int sid);
96 int sion_get_fd(
int sid);
97 int sion_optimize_fp_buffer(
int sid);
103 sion_int64 sion_get_bytes_written(
int sid);
104 sion_int64 sion_get_bytes_read(
int sid);
111 sion_int32 **mapping,
117 sion_int64 *globalskip,
118 sion_int64 *start_of_varheader,
119 sion_int64 **sion_chunksizes,
120 sion_int64 **sion_globalranks,
121 sion_int64 **sion_blockcount,
122 sion_int64 **sion_blocksizes);
126 sion_int64 *currentpos,
128 sion_int64 **chunksizes );
132 sion_int64 **sion_currentpos,
133 sion_int64 **sion_currentblocknr );
134 int sion_get_number_of_files(
int sid );
135 int sion_get_filenumber(
int sid );
138 int sion_is_serial_opened(
int sid );
141 int sion_using_hints(
int sid);
147 int sion_is_thread_safe(
void);
155 int sion_get_version(
int *main_version,
int *sub_version,
int *patch_level,
int *fileformat_version);
169 sion_io_stat_t* sion_get_io_info_by_spec(
int sid,
int roles,
int flag);
177 sion_int64 posinblk );
192 void sion_swap(
void *target,
void *source,
int size,
int n,
int do_swap);
195 #define _sion_stat_file _sion_file_stat_file
206 #define DPRINTTS(A,B)
207 #define DPRINTFTS2(A,B)
char * sion_keyval_type_to_str(int type)
Returns key value mode as string.
size_t sion_fwrite_key(const void *data, uint64_t key, size_t size, size_t nitems, int sid)
Writes data for key.
int sion_seek_key(int sid, uint64_t key, int entrynum, sion_int64 posinentry)
Seek to position in key.
int sion_get_keyval_mode(int sid)
Return selected mode for key value.
int sion_key_list_iterator_reset(int sid)
Resets key iterator.
int sion_key_full_scan(int sid)
Performs a full scan of all meta data in current file.
size_t sion_fread_key(void *data, uint64_t key, size_t size, size_t nitems, int sid)
Read data for key.
int sion_fread_key_iterator_reset(int sid)
Resets key iterator.
int sion_key_list_iterator_next(int sid, uint64_t *keyptr)
Forward to next key.
int sion_key_get_stat(int sid, uint64_t key, sion_key_stat_t *stat)
get statistics about key
int sion_fread_key_iterator_next(int sid, uint64_t *key, size_t *size)
Forward to next key.
int sion_get_current_location(int sid, int *currentblock, sion_int64 *currentpos, int *maxchunks, sion_int64 **chunksizes)
Returns current position in file and pointer fiels containing chunk sizes.
int sion_get_current_locations(int sid, int *ntasks, sion_int64 **sion_currentpos, sion_int64 **sion_currentblocknr)
Returns current position in file and pointer fiels containing chunk sizes.
size_t sion_fread(void *data, size_t size, size_t nitems, int sid)
Read data from sion file.
int sion_get_file_endianness(int sid)
Returns edianness of data in file sid.
int sion_endianness_swap_needed(int sid)
Returns whether or not byte swapping is needed for sid.
int sion_get_locations(int sid, int *ntasks, int *maxblocks, sion_int64 *globalskip, sion_int64 *start_of_varheader, sion_int64 **sion_chunksizes, sion_int64 **sion_globalranks, sion_int64 **sion_blockcount, sion_int64 **sion_blocksizes)
Returns pointers to internal fields.
int sion_get_mapping(int sid, int *mapping_size, sion_int32 **mapping, int *numfiles)
Returns pointers to the internal field mapping.
size_t sion_fwrite(const void *data, size_t size, size_t nitems, int sid)
Write data to sion file.
sion_int64 sion_get_position(int sid)
Function that returns the current file position.
int sion_seek_fp(int sid, int rank, int currentblocknr, sion_int64 posinblk, FILE **fileptr)
Deprecated. Use sion_seek() instead.
sion_int64 sion_bytes_avail_in_chunk(int sid)
Function that returns the number of bytes available in the current chunk.
int sion_flush(int sid)
Flushed sion file.
int sion_ensure_free_space(int sid, sion_int64 bytes)
Funtion to ensure that enough space is available for writing.
int sion_feof(int sid)
Function that indicates whether the end of file is reached for this task.
int sion_get_version(int *main_version, int *sub_version, int *patch_level, int *fileformat_version)
Return version numbers.
int sion_get_endianness(void)
Return endianness.
sion_int64 sion_bytes_avail_in_block(int sid)
Return the number of bytes available in the current chunk.
int _sion_file_stat_file(const char *fname)
Check if file exists (LARGE_FILE support on BlueGene)
void sion_swap(void *target, void *source, int size, int n, int do_swap)
int sion_seek(int sid, int rank, int currentblocknr, sion_int64 posinblk)
Function to set the file pointer to a new position.
int sion_dup(int sid, int mode, int rank, uint64_t key)
Function which duplicates a sion file descriptor.
int sion_lock_user_callbacks_defined(void)
Function which return flag, if user callback for locking are registered.
int sion_get_sizeof(int sid, int *numbytes, int *numfds)
Function returns size of internal data structure for sid.
int sion_lock_register_lock_callbacks(int lock(void *), int unlock(void *), void *lock_data)
Function which registers callback funtions for lock and unlock internal access to shared data structu...
int sion_dedup(int sid)
Function which destroy a duplicated sion file descriptor.