]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove do-nothing header <isc/offset.h>
authorTony Finch <fanf@isc.org>
Fri, 16 Dec 2022 11:47:40 +0000 (11:47 +0000)
committerTony Finch <fanf@isc.org>
Wed, 15 Feb 2023 16:44:47 +0000 (16:44 +0000)
And replace all uses of isc_offset_t with standard off_t

bin/named/logconf.c
lib/dns/dnstap.c
lib/dns/journal.c
lib/isc/Makefile.am
lib/isc/file.c
lib/isc/include/isc/file.h
lib/isc/include/isc/log.h
lib/isc/include/isc/offset.h [deleted file]
lib/isc/include/isc/time.h
lib/isc/include/isc/types.h

index 5fd0904f43fc1649a650228745861b34137385e0..59dfb2fb8fe499f5154e1d82563d0b65db724312 100644 (file)
@@ -17,7 +17,6 @@
 #include <stdbool.h>
 
 #include <isc/file.h>
-#include <isc/offset.h>
 #include <isc/print.h>
 #include <isc/result.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");
                int32_t versions = ISC_LOG_ROLLNEVER;
                isc_log_rollsuffix_t suffix = isc_log_rollsuffix_increment;
-               isc_offset_t size = 0;
+               off_t size = 0;
                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.
                 */
-               switch (sizeof(isc_offset_t)) {
+               switch (sizeof(off_t)) {
                case 4:
                        maxoffset = 0x7fffffffULL;
                        break;
@@ -178,7 +177,7 @@ channel_fromconf(const cfg_obj_t *channel, isc_logconfig_t *logconfig) {
                if (sizeobj != NULL && cfg_obj_isuint64(sizeobj) &&
                    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) &&
                    strcasecmp(cfg_obj_asstring(suffixobj), "timestamp") == 0)
index 784acd92f1b99758e4af714e4cce0106fd2323ee..2137e74db7389c951ed81fbd5954cb96e7beec88 100644 (file)
@@ -118,7 +118,7 @@ struct dns_dtenv {
        isc_region_t version;
        char *path;
        dns_dtmode_t mode;
-       isc_offset_t max_size;
+       off_t max_size;
        int rolls;
        isc_log_rollsuffix_t suffix;
        isc_stats_t *stats;
index 62038a01b249668619a168b37f7feffc2f68427b..66a6e743240d55057316e823fbbbc6a2148394cc 100644 (file)
@@ -184,7 +184,7 @@ typedef struct {
        unsigned char serial[4]; /*%< SOA serial before update. */
        /*
         * 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
         *            platforms as long as we are using fseek() rather
         *            than lseek().
@@ -259,7 +259,7 @@ typedef struct {
  */
 typedef struct {
        uint32_t serial;
-       isc_offset_t offset;
+       off_t offset;
 } journal_pos_t;
 
 #define POS_VALID(pos)     ((pos).offset != 0)
@@ -330,7 +330,7 @@ struct dns_journal {
                                      *   while reading the journal */
        char *filename;              /*%< Journal file name */
        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_header_t header;     /*%< In-core journal header */
        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));
                return (ISC_R_UNEXPECTED);
        }
-       j->offset += (isc_offset_t)nbytes;
+       j->offset += (off_t)nbytes;
        return (ISC_R_SUCCESS);
 }
 
@@ -456,7 +456,7 @@ journal_write(dns_journal_t *j, void *mem, size_t nbytes) {
                              isc_result_totext(result));
                return (ISC_R_UNEXPECTED);
        }
-       j->offset += (isc_offset_t)nbytes;
+       j->offset += (off_t)nbytes;
        return (ISC_R_SUCCESS);
 }
 
@@ -857,7 +857,7 @@ ixfr_order(const void *av, const void *bv) {
 
 static isc_result_t
 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;
 
        /*
@@ -990,7 +990,7 @@ journal_next(dns_journal_t *j, journal_pos_t *pos) {
                          ? sizeof(journal_rawxhdr_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,
                              "%s: offset too large", j->filename);
                return (ISC_R_UNEXPECTED);
@@ -1367,7 +1367,7 @@ dns_journal_commit(dns_journal_t *j) {
        CHECK(journal_fsync(j));
 
        if (j->state == JOURNAL_STATE_TRANSACTION) {
-               isc_offset_t offset;
+               off_t offset;
                offset = (j->x.pos[1].offset - j->x.pos[0].offset) -
                         (j->header_ver1 ? sizeof(journal_rawxhdr_ver1_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) {
                        journal_xhdr_t xhdr;
-                       isc_offset_t offset = j1->offset;
+                       off_t offset = j1->offset;
                        uint32_t count;
 
                        result = journal_read_xhdr(j1, &xhdr);
index 314a70df91f2eb3408eda2d69ef4f4e23cddd9e4..4322f2e68619bcbb21749c1be56785807806ccee 100644 (file)
@@ -61,7 +61,6 @@ libisc_la_HEADERS =                   \
        include/isc/netmgr.h            \
        include/isc/netscope.h          \
        include/isc/nonce.h             \
-       include/isc/offset.h            \
        include/isc/once.h              \
        include/isc/os.h                \
        include/isc/parseint.h          \
index a1aed8e164b7eec655d65f6ade10dd5ae7516280..128f985cd9434e39f7695410b4d1c8a87b78da6c 100644 (file)
@@ -584,7 +584,7 @@ isc_file_absolutepath(const char *filename, char *path, size_t pathlen) {
 }
 
 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;
 
        if (truncate(filename, size) < 0) {
index 46d0f9246a20e3109fccb6bee29e4436e8bd5777..2e5d4d2da5103100efec42de3f75ff81b382ab77 100644 (file)
@@ -287,7 +287,7 @@ isc_file_absolutepath(const char *filename, char *path, size_t pathlen);
  */
 
 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.
  */
index 54b40222017d539d2073141e79273f45441b8d64..5a9a7a1bb331970c85d9660b0d6cdd86aa4c42ae 100644 (file)
@@ -138,8 +138,8 @@ typedef struct isc_logfile {
         * 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.
         */
-       isc_offset_t maximum_size;
-       bool         maximum_reached; /*%< Private. */
+       off_t maximum_size;
+       bool  maximum_reached; /*%< Private. */
 } isc_logfile_t;
 
 /*%
diff --git a/lib/isc/include/isc/offset.h b/lib/isc/include/isc/offset.h
deleted file mode 100644 (file)
index 2b62e2a..0000000
+++ /dev/null
@@ -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;
index e2f232a79308f6e0f5752698f0272ab86afb267e..ea9fb9d9c4a7b6de9c49fd506be569472878e0ae 100644 (file)
@@ -15,8 +15,7 @@
 
 /*! \file */
 
-#include <inttypes.h>
-#include <stdbool.h>
+#include <time.h>
 
 #include <isc/lang.h>
 #include <isc/types.h>
index 94aa5f760b00603ecf1e246f8fe4b4cd98229bb7..8e3e9b5b19c62a3d27e4257987113545df3dd4b8 100644 (file)
  * \brief
  * OS-specific types, from the OS-specific include directories.
  */
-#include <inttypes.h>
+#include <limits.h>
 #include <stdbool.h>
-
-#include <isc/offset.h>
+#include <stddef.h>
+#include <stdint.h>
 
 /*
  * XXXDCL This is just for ISC_LIST and ISC_LINK, but gets all of the other