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