Lines Matching defs:dctx

1069 dumptostreaminc(dns_dumpctx_t *dctx);
1072 dumpctx_destroy(dns_dumpctx_t *dctx) {
1074 dctx->magic = 0;
1075 DESTROYLOCK(&dctx->lock);
1076 dns_dbiterator_destroy(&dctx->dbiter);
1077 if (dctx->version != NULL)
1078 dns_db_closeversion(dctx->db, &dctx->version, ISC_FALSE);
1079 dns_db_detach(&dctx->db);
1080 if (dctx->task != NULL)
1081 isc_task_detach(&dctx->task);
1082 if (dctx->file != NULL)
1083 isc_mem_free(dctx->mctx, dctx->file);
1084 if (dctx->tmpfile != NULL)
1085 isc_mem_free(dctx->mctx, dctx->tmpfile);
1086 isc_mem_putanddetach(&dctx->mctx, dctx, sizeof(*dctx));
1106 dns_dumpctx_t *dctx;
1110 dctx = *dctxp;
1111 REQUIRE(DNS_DCTX_VALID(dctx));
1115 LOCK(&dctx->lock);
1116 INSIST(dctx->references != 0);
1117 dctx->references--;
1118 if (dctx->references == 0)
1120 UNLOCK(&dctx->lock);
1122 dumpctx_destroy(dctx);
1126 dns_dumpctx_version(dns_dumpctx_t *dctx) {
1127 REQUIRE(DNS_DCTX_VALID(dctx));
1128 return (dctx->version);
1132 dns_dumpctx_db(dns_dumpctx_t *dctx) {
1133 REQUIRE(DNS_DCTX_VALID(dctx));
1134 return (dctx->db);
1138 dns_dumpctx_cancel(dns_dumpctx_t *dctx) {
1139 REQUIRE(DNS_DCTX_VALID(dctx));
1141 LOCK(&dctx->lock);
1142 dctx->canceled = ISC_TRUE;
1143 UNLOCK(&dctx->lock);
1188 dns_dumpctx_t *dctx;
1191 dctx = event->ev_arg;
1192 REQUIRE(DNS_DCTX_VALID(dctx));
1193 if (dctx->canceled)
1196 result = dumptostreaminc(dctx);
1198 event->ev_arg = dctx;
1203 if (dctx->file != NULL) {
1204 tresult = closeandrename(dctx->f, result,
1205 dctx->tmpfile, dctx->file);
1209 (dctx->done)(dctx->done_arg, result);
1211 dns_dumpctx_detach(&dctx);
1215 task_send(dns_dumpctx_t *dctx) {
1218 event = isc_event_allocate(dctx->mctx, NULL, DNS_EVENT_DUMPQUANTUM,
1219 dump_quantum, dctx, sizeof(*event));
1222 isc_task_send(dctx->task, &event);
1231 dns_dumpctx_t *dctx;
1235 dctx = isc_mem_get(mctx, sizeof(*dctx));
1236 if (dctx == NULL)
1239 dctx->mctx = NULL;
1240 dctx->f = f;
1241 dctx->dbiter = NULL;
1242 dctx->db = NULL;
1243 dctx->version = NULL;
1244 dctx->done = NULL;
1245 dctx->done_arg = NULL;
1246 dctx->task = NULL;
1247 dctx->nodes = 0;
1248 dctx->first = ISC_TRUE;
1249 dctx->canceled = ISC_FALSE;
1250 dctx->file = NULL;
1251 dctx->tmpfile = NULL;
1252 dctx->format = format;
1256 dctx->dumpsets = dump_rdatasets_text;
1259 dctx->dumpsets = dump_rdatasets_raw;
1266 result = totext_ctx_init(style, &dctx->tctx);
1273 isc_stdtime_get(&dctx->now);
1274 dns_db_attach(db, &dctx->db);
1276 dctx->do_date = dns_db_iscache(dctx->db);
1278 if (dctx->format == dns_masterformat_text &&
1279 (dctx->tctx.style.flags & DNS_STYLEFLAG_REL_OWNER) != 0) {
1283 result = dns_db_createiterator(dctx->db, options, &dctx->dbiter);
1287 result = isc_mutex_init(&dctx->lock);
1291 dns_db_attachversion(dctx->db, version, &dctx->version);
1293 dns_db_currentversion(dctx->db, &dctx->version);
1294 isc_mem_attach(mctx, &dctx->mctx);
1295 dctx->references = 1;
1296 dctx->magic = DNS_DCTX_MAGIC;
1297 *dctxp = dctx;
1301 if (dctx->dbiter != NULL)
1302 dns_dbiterator_destroy(&dctx->dbiter);
1303 if (dctx->db != NULL)
1304 dns_db_detach(&dctx->db);
1305 if (dctx != NULL)
1306 isc_mem_put(mctx, dctx, sizeof(*dctx));
1311 dumptostreaminc(dns_dumpctx_t *dctx) {
1323 bufmem = isc_mem_get(dctx->mctx, initial_buffer_length);
1332 if (dctx->first) {
1333 switch (dctx->format) {
1343 if (dctx->do_date) {
1344 result = dns_time32_totext(dctx->now, &buffer);
1347 fprintf(dctx->f, "$DATE %.*s\n",
1373 now32 = dctx->now;
1380 dctx->f, NULL);
1389 result = dns_dbiterator_first(dctx->dbiter);
1390 dctx->first = ISC_FALSE;
1394 nodes = dctx->nodes;
1396 while (result == ISC_R_SUCCESS && (dctx->nodes == 0 || nodes--)) {
1400 result = dns_dbiterator_current(dctx->dbiter, &node, name);
1405 dns_fixedname_name(&dctx->tctx.origin_fixname);
1406 result = dns_dbiterator_origin(dctx->dbiter, origin);
1408 if ((dctx->tctx.style.flags & DNS_STYLEFLAG_REL_DATA) != 0)
1409 dctx->tctx.origin = origin;
1410 dctx->tctx.neworigin = origin;
1412 result = dns_db_allrdatasets(dctx->db, node, dctx->version,
1413 dctx->now, &rdsiter);
1415 dns_db_detachnode(dctx->db, &node);
1418 result = (dctx->dumpsets)(dctx->mctx, name, rdsiter,
1419 &dctx->tctx, &buffer, dctx->f);
1422 dns_db_detachnode(dctx->db, &node);
1425 dns_db_detachnode(dctx->db, &node);
1426 result = dns_dbiterator_next(dctx->dbiter);
1435 if (dctx->nodes != 0 && result == ISC_R_SUCCESS) {
1449 dctx->nodes = dctx->nodes * 2;
1450 if (dctx->nodes > 1000)
1451 dctx->nodes = 1000;
1453 nodes = dctx->nodes * interval;
1461 dctx->nodes = (nodes + dctx->nodes * 7) / 8;
1467 dctx, dctx->nodes);
1473 RUNTIME_CHECK(dns_dbiterator_pause(dctx->dbiter) == ISC_R_SUCCESS);
1474 isc_mem_put(dctx->mctx, buffer.base, buffer.length);
1486 dns_dumpctx_t *dctx = NULL;
1493 result = dumpctx_create(mctx, db, version, style, f, &dctx,
1497 isc_task_attach(task, &dctx->task);
1498 dctx->done = done;
1499 dctx->done_arg = done_arg;
1500 dctx->nodes = 100;
1502 result = task_send(dctx);
1504 dns_dumpctx_attach(dctx, dctxp);
1508 dns_dumpctx_detach(&dctx);
1531 dns_dumpctx_t *dctx = NULL;
1534 result = dumpctx_create(mctx, db, version, style, f, &dctx, format);
1538 result = dumptostreaminc(dctx);
1540 dns_dumpctx_detach(&dctx);
1602 dns_dumpctx_t *dctx = NULL;
1612 result = dumpctx_create(mctx, db, version, style, f, &dctx, format);
1619 isc_task_attach(task, &dctx->task);
1620 dctx->done = done;
1621 dctx->done_arg = done_arg;
1622 dctx->nodes = 100;
1623 dctx->file = file;
1625 dctx->tmpfile = tempname;
1628 result = task_send(dctx);
1630 dns_dumpctx_attach(dctx, dctxp);
1635 if (dctx != NULL)
1636 dns_dumpctx_detach(&dctx);
1660 dns_dumpctx_t *dctx = NULL;
1666 result = dumpctx_create(mctx, db, version, style, f, &dctx, format);
1670 result = dumptostreaminc(dctx);
1672 dns_dumpctx_detach(&dctx);