18 #include "local_proto.h"
36 int seg_exp, n_total_segs;
43 G_warning(
"Segment setup: illegal segment file parameters");
49 SEG->
offset = (int)lseek(SEG->
fd, 0L, SEEK_CUR);
60 while (SEG->
scols - (1 << seg_exp) > 0)
63 if (SEG->
scols - (1 << seg_exp) == 0) {
66 while (SEG->
srows - (1 << seg_exp) > 0)
68 if (SEG->
srows - (1 << seg_exp) == 0) {
72 G_debug(1,
"Segment setup: fast address activated");
84 while (SEG->
len - (1 << seg_exp) > 0)
86 if (SEG->
len - (1 << seg_exp) == 0) {
90 G_debug(1,
"Segment setup: fast seek activated");
100 if (SEG->
nseg > n_total_segs) {
102 "Segment setup: reducing number of open segments from %d to %d",
103 SEG->
nseg, n_total_segs);
104 SEG->
nseg = n_total_segs;
107 if ((SEG->
scb = (
struct scb *)
G_malloc(SEG->
nseg *
sizeof(
struct scb))) ==
115 sizeof(
struct aq))) ==
NULL)
121 for (i = 0; i < SEG->
nseg; i++) {
157 for (i = 0; i < n_total_segs; i++)
int seg_address_slow(const SEGMENT *SEG, off_t row, off_t col, int *n, int *index)
int seg_address_fast(const SEGMENT *SEG, off_t row, off_t col, int *n, int *index)
void G_warning(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
int seg_seek_fast(const SEGMENT *SEG, int n, int index)
int seg_seek_slow(const SEGMENT *SEG, int n, int index)
int seg_setup(SEGMENT *SEG)
Internal use only.
int(* address)(const struct SEGMENT *, off_t, off_t, int *, int *)
struct SEGMENT::scb * scb
int(* seek)(const struct SEGMENT *S, int, int)