mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 23:25:38 +00:00
Remove do-nothing header <isc/offset.h>
And replace all uses of isc_offset_t with standard off_t
This commit is contained in:
@@ -17,7 +17,6 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include <isc/file.h>
|
#include <isc/file.h>
|
||||||
#include <isc/offset.h>
|
|
||||||
#include <isc/print.h>
|
#include <isc/print.h>
|
||||||
#include <isc/result.h>
|
#include <isc/result.h>
|
||||||
#include <isc/stdio.h>
|
#include <isc/stdio.h>
|
||||||
@@ -146,14 +145,14 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
|
|||||||
const cfg_obj_t *suffixobj = cfg_tuple_get(fileobj, "suffix");
|
const cfg_obj_t *suffixobj = cfg_tuple_get(fileobj, "suffix");
|
||||||
int32_t versions = ISC_LOG_ROLLNEVER;
|
int32_t versions = ISC_LOG_ROLLNEVER;
|
||||||
isc_log_rollsuffix_t suffix = isc_log_rollsuffix_increment;
|
isc_log_rollsuffix_t suffix = isc_log_rollsuffix_increment;
|
||||||
isc_offset_t size = 0;
|
off_t size = 0;
|
||||||
uint64_t maxoffset;
|
uint64_t maxoffset;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* isc_offset_t is a signed integer type, so the maximum
|
* off_t is a signed integer type, so the maximum
|
||||||
* value is all 1s except for the MSB.
|
* value is all 1s except for the MSB.
|
||||||
*/
|
*/
|
||||||
switch (sizeof(isc_offset_t)) {
|
switch (sizeof(off_t)) {
|
||||||
case 4:
|
case 4:
|
||||||
maxoffset = 0x7fffffffULL;
|
maxoffset = 0x7fffffffULL;
|
||||||
break;
|
break;
|
||||||
@@ -178,7 +177,7 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
|
|||||||
if (sizeobj != NULL && cfg_obj_isuint64(sizeobj) &&
|
if (sizeobj != NULL && cfg_obj_isuint64(sizeobj) &&
|
||||||
cfg_obj_asuint64(sizeobj) < maxoffset)
|
cfg_obj_asuint64(sizeobj) < maxoffset)
|
||||||
{
|
{
|
||||||
size = (isc_offset_t)cfg_obj_asuint64(sizeobj);
|
size = (off_t)cfg_obj_asuint64(sizeobj);
|
||||||
}
|
}
|
||||||
if (suffixobj != NULL && cfg_obj_isstring(suffixobj) &&
|
if (suffixobj != NULL && cfg_obj_isstring(suffixobj) &&
|
||||||
strcasecmp(cfg_obj_asstring(suffixobj), "timestamp") == 0)
|
strcasecmp(cfg_obj_asstring(suffixobj), "timestamp") == 0)
|
||||||
|
@@ -118,7 +118,7 @@ struct dns_dtenv {
|
|||||||
isc_region_t version;
|
isc_region_t version;
|
||||||
char *path;
|
char *path;
|
||||||
dns_dtmode_t mode;
|
dns_dtmode_t mode;
|
||||||
isc_offset_t max_size;
|
off_t max_size;
|
||||||
int rolls;
|
int rolls;
|
||||||
isc_log_rollsuffix_t suffix;
|
isc_log_rollsuffix_t suffix;
|
||||||
isc_stats_t *stats;
|
isc_stats_t *stats;
|
||||||
|
@@ -184,7 +184,7 @@ typedef struct {
|
|||||||
unsigned char serial[4]; /*%< SOA serial before update. */
|
unsigned char serial[4]; /*%< SOA serial before update. */
|
||||||
/*
|
/*
|
||||||
* XXXRTH Should offset be 8 bytes?
|
* XXXRTH Should offset be 8 bytes?
|
||||||
* XXXDCL ... probably, since isc_offset_t is 8 bytes on many OSs.
|
* XXXDCL ... probably, since off_t is 8 bytes on many OSs.
|
||||||
* XXXAG ... but we will not be able to seek >2G anyway on many
|
* XXXAG ... but we will not be able to seek >2G anyway on many
|
||||||
* platforms as long as we are using fseek() rather
|
* platforms as long as we are using fseek() rather
|
||||||
* than lseek().
|
* than lseek().
|
||||||
@@ -259,7 +259,7 @@ typedef struct {
|
|||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
isc_offset_t offset;
|
off_t offset;
|
||||||
} journal_pos_t;
|
} journal_pos_t;
|
||||||
|
|
||||||
#define POS_VALID(pos) ((pos).offset != 0)
|
#define POS_VALID(pos) ((pos).offset != 0)
|
||||||
@@ -330,7 +330,7 @@ struct dns_journal {
|
|||||||
* while reading the journal */
|
* while reading the journal */
|
||||||
char *filename; /*%< Journal file name */
|
char *filename; /*%< Journal file name */
|
||||||
FILE *fp; /*%< File handle */
|
FILE *fp; /*%< File handle */
|
||||||
isc_offset_t offset; /*%< Current file offset */
|
off_t offset; /*%< Current file offset */
|
||||||
journal_xhdr_t curxhdr; /*%< Current transaction header */
|
journal_xhdr_t curxhdr; /*%< Current transaction header */
|
||||||
journal_header_t header; /*%< In-core journal header */
|
journal_header_t header; /*%< In-core journal header */
|
||||||
unsigned char *rawindex; /*%< In-core buffer for journal index
|
unsigned char *rawindex; /*%< In-core buffer for journal index
|
||||||
@@ -441,7 +441,7 @@ journal_read(dns_journal_t *j, void *mem, size_t nbytes) {
|
|||||||
isc_result_totext(result));
|
isc_result_totext(result));
|
||||||
return (ISC_R_UNEXPECTED);
|
return (ISC_R_UNEXPECTED);
|
||||||
}
|
}
|
||||||
j->offset += (isc_offset_t)nbytes;
|
j->offset += (off_t)nbytes;
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,7 +456,7 @@ journal_write(dns_journal_t *j, void *mem, size_t nbytes) {
|
|||||||
isc_result_totext(result));
|
isc_result_totext(result));
|
||||||
return (ISC_R_UNEXPECTED);
|
return (ISC_R_UNEXPECTED);
|
||||||
}
|
}
|
||||||
j->offset += (isc_offset_t)nbytes;
|
j->offset += (off_t)nbytes;
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -857,7 +857,7 @@ ixfr_order(const void *av, const void *bv) {
|
|||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
maybe_fixup_xhdr(dns_journal_t *j, journal_xhdr_t *xhdr, uint32_t serial,
|
maybe_fixup_xhdr(dns_journal_t *j, journal_xhdr_t *xhdr, uint32_t serial,
|
||||||
isc_offset_t offset) {
|
off_t offset) {
|
||||||
isc_result_t result = ISC_R_SUCCESS;
|
isc_result_t result = ISC_R_SUCCESS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -990,7 +990,7 @@ journal_next(dns_journal_t *j, journal_pos_t *pos) {
|
|||||||
? sizeof(journal_rawxhdr_t)
|
? sizeof(journal_rawxhdr_t)
|
||||||
: sizeof(journal_rawxhdr_ver1_t);
|
: sizeof(journal_rawxhdr_ver1_t);
|
||||||
|
|
||||||
if ((isc_offset_t)(pos->offset + hdrsize + xhdr.size) < pos->offset) {
|
if ((off_t)(pos->offset + hdrsize + xhdr.size) < pos->offset) {
|
||||||
isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
|
isc_log_write(JOURNAL_COMMON_LOGARGS, ISC_LOG_ERROR,
|
||||||
"%s: offset too large", j->filename);
|
"%s: offset too large", j->filename);
|
||||||
return (ISC_R_UNEXPECTED);
|
return (ISC_R_UNEXPECTED);
|
||||||
@@ -1367,7 +1367,7 @@ dns_journal_commit(dns_journal_t *j) {
|
|||||||
CHECK(journal_fsync(j));
|
CHECK(journal_fsync(j));
|
||||||
|
|
||||||
if (j->state == JOURNAL_STATE_TRANSACTION) {
|
if (j->state == JOURNAL_STATE_TRANSACTION) {
|
||||||
isc_offset_t offset;
|
off_t offset;
|
||||||
offset = (j->x.pos[1].offset - j->x.pos[0].offset) -
|
offset = (j->x.pos[1].offset - j->x.pos[0].offset) -
|
||||||
(j->header_ver1 ? sizeof(journal_rawxhdr_ver1_t)
|
(j->header_ver1 ? sizeof(journal_rawxhdr_ver1_t)
|
||||||
: sizeof(journal_rawxhdr_t));
|
: sizeof(journal_rawxhdr_t));
|
||||||
@@ -2621,7 +2621,7 @@ dns_journal_compact(isc_mem_t *mctx, char *filename, uint32_t serial,
|
|||||||
*/
|
*/
|
||||||
while (rewrite && len > 0) {
|
while (rewrite && len > 0) {
|
||||||
journal_xhdr_t xhdr;
|
journal_xhdr_t xhdr;
|
||||||
isc_offset_t offset = j1->offset;
|
off_t offset = j1->offset;
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
|
|
||||||
result = journal_read_xhdr(j1, &xhdr);
|
result = journal_read_xhdr(j1, &xhdr);
|
||||||
|
@@ -61,7 +61,6 @@ libisc_la_HEADERS = \
|
|||||||
include/isc/netmgr.h \
|
include/isc/netmgr.h \
|
||||||
include/isc/netscope.h \
|
include/isc/netscope.h \
|
||||||
include/isc/nonce.h \
|
include/isc/nonce.h \
|
||||||
include/isc/offset.h \
|
|
||||||
include/isc/once.h \
|
include/isc/once.h \
|
||||||
include/isc/os.h \
|
include/isc/os.h \
|
||||||
include/isc/parseint.h \
|
include/isc/parseint.h \
|
||||||
|
@@ -584,7 +584,7 @@ isc_file_absolutepath(const char *filename, char *path, size_t pathlen) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
isc_file_truncate(const char *filename, isc_offset_t size) {
|
isc_file_truncate(const char *filename, off_t size) {
|
||||||
isc_result_t result = ISC_R_SUCCESS;
|
isc_result_t result = ISC_R_SUCCESS;
|
||||||
|
|
||||||
if (truncate(filename, size) < 0) {
|
if (truncate(filename, size) < 0) {
|
||||||
|
@@ -287,7 +287,7 @@ isc_file_absolutepath(const char *filename, char *path, size_t pathlen);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
isc_file_truncate(const char *filename, isc_offset_t size);
|
isc_file_truncate(const char *filename, off_t size);
|
||||||
/*%<
|
/*%<
|
||||||
* Truncate/extend the file specified to 'size' bytes.
|
* Truncate/extend the file specified to 'size' bytes.
|
||||||
*/
|
*/
|
||||||
|
@@ -138,8 +138,8 @@ typedef struct isc_logfile {
|
|||||||
* anyone would want). st_size returned by fstat should be typedef'd
|
* anyone would want). st_size returned by fstat should be typedef'd
|
||||||
* to a size large enough for the largest possible file on a system.
|
* to a size large enough for the largest possible file on a system.
|
||||||
*/
|
*/
|
||||||
isc_offset_t maximum_size;
|
off_t maximum_size;
|
||||||
bool maximum_reached; /*%< Private. */
|
bool maximum_reached; /*%< Private. */
|
||||||
} isc_logfile_t;
|
} isc_logfile_t;
|
||||||
|
|
||||||
/*%
|
/*%
|
||||||
|
@@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MPL-2.0
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
||||||
*
|
|
||||||
* See the COPYRIGHT file distributed with this work for additional
|
|
||||||
* information regarding copyright ownership.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
/*! \file
|
|
||||||
* \brief
|
|
||||||
* File offsets are operating-system dependent.
|
|
||||||
*/
|
|
||||||
#include <limits.h> /* Required for CHAR_BIT. */
|
|
||||||
#include <stddef.h> /* For Linux Standard Base. */
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
typedef off_t isc_offset_t;
|
|
@@ -15,8 +15,7 @@
|
|||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <time.h>
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include <isc/lang.h>
|
#include <isc/lang.h>
|
||||||
#include <isc/types.h>
|
#include <isc/types.h>
|
||||||
|
@@ -19,10 +19,10 @@
|
|||||||
* \brief
|
* \brief
|
||||||
* OS-specific types, from the OS-specific include directories.
|
* OS-specific types, from the OS-specific include directories.
|
||||||
*/
|
*/
|
||||||
#include <inttypes.h>
|
#include <limits.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stddef.h>
|
||||||
#include <isc/offset.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXXDCL This is just for ISC_LIST and ISC_LINK, but gets all of the other
|
* XXXDCL This is just for ISC_LIST and ISC_LINK, but gets all of the other
|
||||||
|
Reference in New Issue
Block a user