7910 l2arc_write_buffers() may write beyond target_sz
[unleashed.git] / usr / src / lib / libnisdb / db_log_entry.cc
blob6b6658c6897611377df96bdbf15395e266896915
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * db_log_entry.cc
25 * Copyright (c) 1988-1992 Sun Microsystems Inc
26 * All Rights Reserved.
29 #pragma ident "%Z%%M% %I% %E% SMI"
31 #include <stdio.h>
33 #include "db_headers.h"
34 #include "db_log_entry.h"
35 #include "db_table.h"
37 extern void print_entry(entryp, entry_object *);
40 * Constructor: Create a log entry using the given parameters. Note that
41 * pointers to db_query and entry_object are simply assigned, not copied.
43 db_log_entry::db_log_entry(db_action a, vers * v, db_query *q,
44 entry_object *obj)
46 action = a;
47 aversion.assign(v);
48 query = q;
49 object = obj;
50 next = NULL;
51 bversion.assign(v);
54 db_log_entry::~db_log_entry()
56 /* we might not have allocated these ourselves, so we cannot delete them */
57 // if (query) delete query;
58 // if (object) free_entry(object);
61 /* prints a line from the journal */
62 void
63 db_log_entry::print()
65 switch (action) {
66 case DB_ADD:
67 printf("add: ");
68 break;
69 case DB_REMOVE:
70 printf("remove: ");
71 break;
72 default:
73 printf("action(%d): ", action);
74 break;
77 aversion.print(stdout);
78 putchar(' ');
79 if (query != NULL)
80 query->print();
81 else
82 printf("no query!\n");
84 if (object != NULL) {
85 print_entry(0, object);
86 } else {
87 printf("no object\n");
89 bversion.print(stdout);
90 putchar('\n');