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