OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

OTF_File.h
Go to the documentation of this file.
1 /*
2 This is part of the OTF library. Copyright by ZIH, TU Dresden 2005-2012.
3 Authors: Andreas Knuepfer, Holger Brunst, Ronny Brendel, Thomas Kriebitzsch
4 */
5
6 /**
7 * @file OTF_File.h
8 *
9 * @brief Provides a low-level API for accessing files.
10 *
11 * \ingroup internal
12 */
13
14
15 #ifndef OTF_FILE_H
16 #define OTF_FILE_H
17
18
19 #include "OTF_FileManager.h"
20 #include "OTF_Filenames.h"
21
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif /* __cplusplus */
26
27 /** mode determining what to do with a file */
28 enum enum_OTF_FileMode {
29
30 OTF_FILEMODE_NOTHING = 0,
31 OTF_FILEMODE_READ= 1,
32 OTF_FILEMODE_WRITE= 2,
33 OTF_FILEMODE_SEEK= 3
34 };
35 typedef enum enum_OTF_FileMode OTF_FileMode;
36
37 /** status of a file */
38 enum enum_OTF_FileStatus {
39
40 OTF_FILESTATUS_UNKNOWN= 0,
41 OTF_FILESTATUS_ACTIVE= 1,
42 OTF_FILESTATUS_SUSPENDED= 2,
43 OTF_FILESTATUS_CLOSED= 3
44 };
45 typedef enum enum_OTF_FileStatus OTF_FileStatus;
46
47 /** initialize a OTF_File object */
48 void OTF_File_init( OTF_File* o );
49
50 /** finalize a OTF_File object */
51 void OTF_File_finalize( OTF_File* o );
52
53 /** open an OTF_File */
54 OTF_File* OTF_File_open( const char* filename, OTF_FileManager* manager,
55 OTF_FileMode mode );
56
57 /** open a pseudo OTF_File that actually reads from the given memory buffer.
58 The buffer is not copied, you need to manage it yourself!
59 Don't touch it during access operations. */
60 OTF_File* OTF_File_open_with_external_buffer( uint32_t len, const char* buffer, uint8_t is_compressed,
61 OTF_FileMode mode );
62
63
64 /** OTF_File to an OTF_File */
65 size_t OTF_File_write( OTF_File* file, const void* ptr, size_t size );
66
67 /** read from an OTF_File */
68 size_t OTF_File_read( OTF_File* file, void* ptr, size_t size );
69
70 /** seek absolute position in an OTF_File */
71 int OTF_File_seek( OTF_File* file, uint64_t pos );
72
73 /** get absolut position from an OTF_File */
74 uint64_t OTF_File_tell( OTF_File* file );
75
76 /** return the file size in bytes*/
77 uint64_t OTF_File_size( OTF_File* file );
78
79 /** close OTF_File */
80 int OTF_File_close( OTF_File* file );
81
82 /** return OTF_File status */
83 OTF_FileStatus OTF_File_status( OTF_File* file );
84
85
86 /** suspend OTF_File - internal use only. */
87 void OTF_File_suspend( OTF_File* file );
88
89 /** re-open the file when closed or suspended - internal use only.
90 return 1 on success, 0 otherwise */
91 int OTF_File_revive( OTF_File* file, OTF_FileMode mode );
92
93 void OTF_File_setZBufferSize( OTF_File* file, uint32_t size );
94
95
96 /** internal use */
97 OTF_File* OTF_File_open_zlevel( const char* filename, OTF_FileManager* manager,
98 OTF_FileMode mode, OTF_FileCompression compression );
99
100
101 /* internal function */
102 /** read 'length' bytes from underlying file or from special memory buffer */
103 size_t OTF_File_read_internal( OTF_File* file, void* dest, size_t length );
104
105
106 #ifdef __cplusplus
107 }
108 #endif /* __cplusplus */
109
110 #endif /* OTF_FILE_H */
OTF_File_status
OTF_FileStatus OTF_File_status(OTF_File *file)
return OTF_File status
Definition: OTF_File.c:693
struct_OTF_File
Definition: OTF_File.c:78
OTF_File_finalize
void OTF_File_finalize(OTF_File *o)
finalize a OTF_File object
Definition: OTF_File.c:140
enum_OTF_FileMode
enum_OTF_FileMode
mode determining what to do with a file
Definition: OTF_File.h:28
OTF_File_read
size_t OTF_File_read(OTF_File *file, void *ptr, size_t size)
read from an OTF_File
Definition: OTF_File.c:362
OTF_File_suspend
void OTF_File_suspend(OTF_File *file)
suspend OTF_File - internal use only.
Definition: OTF_File.c:721
OTF_File_close
int OTF_File_close(OTF_File *file)
close OTF_File
Definition: OTF_File.c:600
OTF_File_open_zlevel
OTF_File * OTF_File_open_zlevel(const char *filename, OTF_FileManager *manager, OTF_FileMode mode, OTF_FileCompression compression)
internal use
Definition: OTF_File.c:1070
OTF_File_read_internal
size_t OTF_File_read_internal(OTF_File *file, void *dest, size_t length)
read 'length' bytes from underlying file or from special memory buffer
Definition: OTF_File.c:1276
OTF_File_write
size_t OTF_File_write(OTF_File *file, const void *ptr, size_t size)
OTF_File to an OTF_File.
Definition: OTF_File.c:258
OTF_File_revive
int OTF_File_revive(OTF_File *file, OTF_FileMode mode)
re-open the file when closed or suspended - internal use only.
Definition: OTF_File.c:741
OTF_FileManager.h
Manages file handles.
OTF_File_open_with_external_buffer
OTF_File * OTF_File_open_with_external_buffer(uint32_t len, const char *buffer, uint8_t is_compressed, OTF_FileMode mode)
open a pseudo OTF_File that actually reads from the given memory buffer.
Definition: OTF_File.c:168
OTF_File_open
OTF_File * OTF_File_open(const char *filename, OTF_FileManager *manager, OTF_FileMode mode)
open an OTF_File
Definition: OTF_File.c:160
enum_OTF_FileStatus
enum_OTF_FileStatus
status of a file
Definition: OTF_File.h:38
OTF_File_seek
int OTF_File_seek(OTF_File *file, uint64_t pos)
seek absolute position in an OTF_File
Definition: OTF_File.c:445
OTF_File_tell
uint64_t OTF_File_tell(OTF_File *file)
get absolut position from an OTF_File
Definition: OTF_File.c:548
OTF_File_size
uint64_t OTF_File_size(OTF_File *file)
return the file size in bytes
Definition: OTF_File.c:569
struct_OTF_FileManager
file handles management structure
Definition: OTF_FileManager.c:32
OTF_Filenames.h
Handles file naming issues.
OTF_File_init
void OTF_File_init(OTF_File *o)
initialize a OTF_File object
Definition: OTF_File.c:120