OpenMPI  0.1.1
OTF_FileManager.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_FileManager.h
8  *
9  * @brief Manages file handles.
10  *
11  * i.e. Opens, closes and suspends files, if there are not enough
12  * filehandles available.
13  *
14  * \ingroup fm
15  */
16 
17 /**
18  * \defgroup fm File Manager Interface
19  *
20  * The file manager schedules an unlimited number OTF_Files to a limited
21  * number of actual open OS files. Therefore all open are registered with
22  * this manager. When a file is requested while no more OS files are
23  * available any of the other files are suspended, i.i. the OS file is
24  * closed.
25  */
26 
27 
28 #ifndef OTF_FILEMANAGER_H
29 #define OTF_FILEMANAGER_H
30 
31 
32 #include "OTF_inttypes.h"
33 
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif /* __cplusplus */
38 
39 struct struct_OTF_File;
40 typedef struct struct_OTF_File OTF_File;
41 
42 
44 /** file manager object \ingroup fm */
46 
47 
48 /** Generates a new file manager with a maximum number of files that are allowed
49 to be open simultaneously. \ingroup fm */
51 
52 /** Closes the file manager \ingroup fm */
54 
55 /** Returns the number of files currently open. */
57 
58 /** Returns the numbner of files allowed to be open simultaneously. */
60 
61 /** Sets the number of files allowed to be open simultaneously. */
62 uint32_t OTF_FileManager_setNumber( OTF_FileManager* m, uint32_t number );
63 
64 /** Ensure there is a free file handle available after this call.
65 return 1 on success, 0 otherwise (which is not supposed to happen) */
67 
68 /** Registers the 'file' as open. Return 1 on success, 0 otherwise. */
70 
71 /** Marks currently opened 'file' as used which is important for the
72 scheduling strategy, i.e. the internal decision which file to suspend next.
73 return 1 on success or 0 for an suspended file. */
75 
76 /** Suspend an open file explicitly. this may be called externaly or
77 internally. Return 1 on success, 0 otherwise. */
79 
80 #ifdef __cplusplus
81 }
82 #endif /* __cplusplus */
83 
84 #endif /* OTF_FILEMANAGER_H */
85 
int OTF_FileManager_registerFile(OTF_FileManager *m, OTF_File *file)
Registers the 'file' as open.
Definition: OTF_FileManager.c:196
Definition: OTF_File.c:78
void OTF_FileManager_close(OTF_FileManager *m)
Closes the file manager.
Definition: OTF_FileManager.c:126
uint32_t OTF_FileManager_getCount(OTF_FileManager *m)
Returns the number of files currently open.
Definition: OTF_FileManager.c:137
uint32_t OTF_FileManager_getNumber(OTF_FileManager *m)
Returns the numbner of files allowed to be open simultaneously.
Definition: OTF_FileManager.c:144
int OTF_FileManager_guaranteeFile(OTF_FileManager *m)
Ensure there is a free file handle available after this call.
Definition: OTF_FileManager.c:171
int OTF_FileManager_suspendFile(OTF_FileManager *m, OTF_File *file)
Suspend an open file explicitly.
Definition: OTF_FileManager.c:248
uint32_t OTF_FileManager_setNumber(OTF_FileManager *m, uint32_t number)
Sets the number of files allowed to be open simultaneously.
Definition: OTF_FileManager.c:151
uint32_t number
number of files allow to be opened simultaneously
Definition: OTF_FileManager.c:38
int OTF_FileManager_touchFile(OTF_FileManager *m, OTF_File *file)
Marks currently opened 'file' as used which is important for the scheduling strategy, i.e.
Definition: OTF_FileManager.c:229
OTF_FileManager * OTF_FileManager_open(uint32_t number)
Generates a new file manager with a maximum number of files that are allowed to be open simultaneousl...
Definition: OTF_FileManager.c:104
file handles management structure
Definition: OTF_FileManager.c:32
Deals with all data type related issues.