X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_open.c;h=4acaa8fd13fa4618e7a2b47393941132f1aa596d;hb=ea8c705cc27ef33dee2cc6561ed51e16ddc5d0a9;hp=60151ba0b6ad3f3ed26bd58e1763bebf02b3b15d;hpb=0b02de621f7461381f81b56a417420f3341b9a0b;p=rrdtool.git diff --git a/src/rrd_open.c b/src/rrd_open.c index 60151ba..4acaa8f 100644 --- a/src/rrd_open.c +++ b/src/rrd_open.c @@ -182,7 +182,8 @@ rrd_file_t *rrd_open( } #endif - __rrd_read(rrd->stat_head, stat_head_t, 1); + __rrd_read(rrd->stat_head, stat_head_t, + 1); /* lets do some test if we are on track ... */ if (memcmp(rrd->stat_head->cookie, RRD_COOKIE, sizeof(RRD_COOKIE)) != 0) { @@ -267,6 +268,7 @@ rrd_file_t *rrd_open( } +#if defined DEBUG && DEBUG > 1 /* Print list of in-core pages of a the current rrd_file. */ static void mincore_print( @@ -309,6 +311,7 @@ void mincore_print( fprintf(stderr, "sorry mincore only works with mmap"); #endif } +#endif /* defined DEBUG && DEBUG > 1 */ /* drop cache except for the header and the active pages */ @@ -348,7 +351,7 @@ void rrd_dontneed( } dontneed_start = active_block; /* do not release 'hot' block if update for this RAA will occur - * within 10 minutes */ + * within 10 minutes */ if (rrd->stat_head->pdp_step * rrd->rra_def[i].pdp_cnt - rrd->live_head->last_up % (rrd->stat_head->pdp_step * rrd->rra_def[i].pdp_cnt) < 10 * 60) { @@ -377,7 +380,7 @@ int rrd_close( int ret; #ifdef HAVE_MMAP - ret = msync(rrd_file->file_start, rrd_file->file_len,MS_ASYNC); + ret = msync(rrd_file->file_start, rrd_file->file_len, MS_ASYNC); if (ret != 0) rrd_set_error("msync rrd_file: %s", rrd_strerror(errno)); ret = munmap(rrd_file->file_start, rrd_file->file_len); @@ -416,7 +419,7 @@ off_t rrd_seek( rrd_file->pos = ret; #endif /* mimic fseek, which returns 0 upon success */ - return ret < 0; //XXX: or just ret to mimic lseek + return ret < 0; //XXX: or just ret to mimic lseek } @@ -441,10 +444,10 @@ inline ssize_t rrd_read( size_t _cnt = count; ssize_t _surplus; - if (rrd_file->pos > rrd_file->file_len || _cnt == 0) /* EOF */ - return 0; + if (rrd_file->pos > rrd_file->file_len || _cnt == 0) /* EOF */ + return 0; if (buf == NULL) - return -1; /* EINVAL */ + return -1; /* EINVAL */ _surplus = rrd_file->pos + _cnt - rrd_file->file_len; if (_surplus > 0) { /* short read */ _cnt -= _surplus; @@ -477,9 +480,9 @@ inline ssize_t rrd_write( { #ifdef HAVE_MMAP if (count == 0) - return 0; + return 0; if (buf == NULL) - return -1; /* EINVAL */ + return -1; /* EINVAL */ memcpy(rrd_file->file_start + rrd_file->pos, buf, count); rrd_file->pos += count; return count; /* mimmic write() semantics */