GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r72990
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
flush.c
Go to the documentation of this file.
1 
2 /**
3  * \file flush.c
4  *
5  * \brief Segment flush routines.
6  *
7  * This program is free software under the GNU General Public License
8  * (>=v2). Read the file COPYING that comes with GRASS for details.
9  *
10  * \author GRASS GIS Development Team
11  *
12  * \date 2005-2009
13  */
14 
15 #include "local_proto.h"
16 
17 
18 /**
19  * \fn int Segment_flush (SEGMENT *SEG)
20  *
21  * \brief Flush pending updates to disk.
22  *
23  * Forces all pending updates generated by <i>Segment_put()</i> to be
24  * written to the segment file <b>seg</b>. Must be called after the
25  * final <i>Segment_put()</i> to force all pending updates to disk. Must
26  * also be called before the first call to <i>Segment_get_row</i>.
27  *
28  * \param[in] SEG segment
29  * \return always returns 0
30  */
31 
33 {
34  int i;
35 
36  for (i = 0; i < SEG->nseg; i++)
37  if (SEG->scb[i].n >= 0 && SEG->scb[i].dirty)
38  seg_pageout(SEG, i);
39 
40  return 0;
41 }
int nseg
Definition: segment.h:58
int Segment_flush(SEGMENT *SEG)
Flush pending updates to disk.
Definition: flush.c:32
char dirty
Definition: segment.h:48
int seg_pageout(SEGMENT *SEG, int i)
Internal use only.
Definition: pageout.c:37
struct SEGMENT::scb * scb