GRASS GIS 8 Programmer's Manual 8.2.0(2022)-exported
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
32int Segment_flush(SEGMENT * SEG)
33{
34 int i;
35
36 if (SEG->scb) {
37 for (i = 0; i < SEG->nseg; i++)
38 if (SEG->scb[i].n >= 0 && SEG->scb[i].dirty)
39 seg_pageout(SEG, i);
40 }
41
42 return 0;
43}
int Segment_flush(SEGMENT *SEG)
Flush pending updates to disk.
Definition: flush.c:32
int seg_pageout(SEGMENT *SEG, int i)
Internal use only.
Definition: pageout.c:37