diff --git a/lib/dns/include/dns/masterdump.h b/lib/dns/include/dns/masterdump.h index 973f31fafd..a030924e73 100644 --- a/lib/dns/include/dns/masterdump.h +++ b/lib/dns/include/dns/masterdump.h @@ -336,17 +336,6 @@ dns_master_questiontotext(const dns_name_t *owner_name, const dns_master_style_t *style, isc_buffer_t *target); -isc_result_t -dns_master_dumpnodetostream(isc_mem_t *mctx, dns_db_t *db, - dns_dbversion_t *version, dns_dbnode_t *node, - const dns_name_t *name, - const dns_master_style_t *style, FILE *f); - -isc_result_t -dns_master_dumpnode(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, - dns_dbnode_t *node, const dns_name_t *name, - const dns_master_style_t *style, const char *filename); - dns_masterstyle_flags_t dns_master_styleflags(const dns_master_style_t *style); diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c index 32b13b630f..6418420dc5 100644 --- a/lib/dns/masterdump.c +++ b/lib/dns/masterdump.c @@ -1908,93 +1908,6 @@ cleanup: return (result); } -/* - * Dump a database node into a master file. - * XXX: this function assumes the text format. - */ -isc_result_t -dns_master_dumpnodetostream(isc_mem_t *mctx, dns_db_t *db, - dns_dbversion_t *version, dns_dbnode_t *node, - const dns_name_t *name, - const dns_master_style_t *style, FILE *f) { - isc_result_t result; - isc_buffer_t buffer; - char *bufmem; - isc_stdtime_t now = isc_stdtime_now(); - dns_totext_ctx_t ctx; - dns_rdatasetiter_t *rdsiter = NULL; - unsigned int options = DNS_DB_STALEOK; - - if ((style->flags & DNS_STYLEFLAG_EXPIRED) != 0) { - options |= DNS_DB_EXPIREDOK; - } - - result = totext_ctx_init(style, NULL, &ctx); - if (result != ISC_R_SUCCESS) { - UNEXPECTED_ERROR("could not set master file style"); - return (ISC_R_UNEXPECTED); - } - - bufmem = isc_mem_get(mctx, initial_buffer_length); - - isc_buffer_init(&buffer, bufmem, initial_buffer_length); - - result = dns_db_allrdatasets(db, node, version, options, now, &rdsiter); - if (result != ISC_R_SUCCESS) { - goto failure; - } - result = dump_rdatasets_text(mctx, name, rdsiter, &ctx, &buffer, f); - if (result != ISC_R_SUCCESS) { - goto failure; - } - dns_rdatasetiter_destroy(&rdsiter); - - result = ISC_R_SUCCESS; - -failure: - isc_mem_put(mctx, buffer.base, buffer.length); - return (result); -} - -isc_result_t -dns_master_dumpnode(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, - dns_dbnode_t *node, const dns_name_t *name, - const dns_master_style_t *style, const char *filename) { - FILE *f = NULL; - isc_result_t result; - - result = isc_stdio_open(filename, "w", &f); - if (result != ISC_R_SUCCESS) { - isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL, - DNS_LOGMODULE_MASTERDUMP, ISC_LOG_ERROR, - "dumping node to file: %s: open: %s", filename, - isc_result_totext(result)); - return (ISC_R_UNEXPECTED); - } - - result = dns_master_dumpnodetostream(mctx, db, version, node, name, - style, f); - if (result != ISC_R_SUCCESS) { - isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL, - DNS_LOGMODULE_MASTERDUMP, ISC_LOG_ERROR, - "dumping master file: %s: dump: %s", filename, - isc_result_totext(result)); - (void)isc_stdio_close(f); - return (ISC_R_UNEXPECTED); - } - - result = isc_stdio_close(f); - if (result != ISC_R_SUCCESS) { - isc_log_write(dns_lctx, ISC_LOGCATEGORY_GENERAL, - DNS_LOGMODULE_MASTERDUMP, ISC_LOG_ERROR, - "dumping master file: %s: close: %s", filename, - isc_result_totext(result)); - return (ISC_R_UNEXPECTED); - } - - return (result); -} - dns_masterstyle_flags_t dns_master_styleflags(const dns_master_style_t *style) { REQUIRE(style != NULL);