xref: /illumos-gate/usr/src/head/exacct.h (revision e86372a01d2d16a5dd4a64e144ed978ba17fe7dd)
1 /*
2  * CDDL HEADER START
3  *
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.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_EXACCT_H
28 #define	_EXACCT_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * exacct item, group, and object definitions as well as structure manipulation
34  * and conversion routines are given in sys/exacct.h.
35  */
36 #include <sys/exacct.h>
37 #include <sys/exacct_catalog.h>
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 /*
44  * ea_open positioning options:  passed in via the aflags argument, these flags
45  * determine whether the newly opened file is positioned for reading prior to
46  * its first record, or after its last.
47  */
48 #define	EO_HEAD		0x0	/* open file positioned at first object */
49 #define	EO_TAIL		0x1	/* open file positioned at last object */
50 #define	EO_POSN_MSK	0x1
51 
52 /*
53  * ea_open validation options:  passed in via the aflags argument, these flags
54  * specify whether the open operation should validate the header on the input
55  * file.  The EO_NO_VALID_HDR is useful in the case that no header is present on
56  * the file, but the version and file type checks are omitted, meaning that
57  * incompatibilities might not be caught immediately.
58  */
59 #define	EO_VALID_HDR	0x0	/* validate header on opening file */
60 #define	EO_NO_VALID_HDR	0x2	/* omit header validation */
61 #define	EO_VALIDATE_MSK	0x2
62 
63 typedef struct _ea_file {
64 	void		*ef_opaque_ptr[8];
65 	offset_t	ef_opaque_off[3];
66 	int		ef_opaque_int[6];
67 } ea_file_t;
68 
69 extern int ea_error(void);
70 extern int ea_open(ea_file_t *, const char *, const char *, int, int, mode_t);
71 extern int ea_fdopen(ea_file_t *, int, const char *, int, int);
72 extern void ea_clear(ea_file_t *);
73 extern int ea_close(ea_file_t *);
74 extern int ea_match_object_catalog(ea_object_t *, ea_catalog_t);
75 extern ea_object_type_t ea_next_object(ea_file_t *, ea_object_t *);
76 extern ea_object_type_t ea_previous_object(ea_file_t *, ea_object_t *);
77 extern ea_object_type_t ea_get_object(ea_file_t *, ea_object_t *);
78 extern ea_object_type_t ea_unpack_object(ea_object_t **, int, void *, size_t);
79 extern int ea_write_object(ea_file_t *, ea_object_t *);
80 extern const char *ea_get_creator(ea_file_t *);
81 extern const char *ea_get_hostname(ea_file_t *);
82 extern ea_object_t *ea_copy_object(const ea_object_t *);
83 extern ea_object_t *ea_copy_object_tree(const ea_object_t *);
84 extern ea_object_t *ea_get_object_tree(ea_file_t *, uint32_t);
85 
86 #ifdef	__cplusplus
87 }
88 #endif
89 
90 #endif	/* _EXACCT_H */
91