19 #include "local_proto.h" 39 int seg_exp, n_total_segs;
46 || SEG->
len <= 0 || SEG->
nseg <= 0) {
47 G_warning(
"Segment setup: illegal segment file parameters");
52 SEG->
offset = (int)lseek(SEG->
fd, 0L, SEEK_CUR);
63 while (SEG->
scols - (1 << seg_exp) > 0)
66 if (SEG->
scols - (1 << seg_exp) == 0) {
69 while (SEG->
srows - (1 << seg_exp) > 0)
71 if (SEG->
srows - (1 << seg_exp) == 0) {
75 G_debug(1,
"Segment setup: fast address activated");
87 while (SEG->
len - (1 << seg_exp) > 0)
89 if (SEG->
len - (1 << seg_exp) == 0) {
93 G_debug(1,
"Segment setup: fast seek activated");
103 if (SEG->
nseg > n_total_segs) {
104 G_debug(1,
"Segment setup: reducing number of open segments from %d to %d",
105 SEG->
nseg, n_total_segs);
106 SEG->
nseg = n_total_segs;
111 sizeof(
struct scb))) ==
NULL)
124 for (i = 0; i < SEG->
nseg; i++) {
160 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)
int seg_seek_fast(const SEGMENT *SEG, int n, int index)
void G_warning(const char *,...) __attribute__((format(printf
int seg_seek_slow(const SEGMENT *SEG, int n, int index)
int seg_setup(SEGMENT *SEG)
Internal use only.
int G_debug(int, const char *,...) __attribute__((format(printf
struct SEGMENT::scb * scb