xref: /onnv-gate/usr/src/uts/common/sys/devcache.h (revision 2797:3782a13773c1)
1*2797Sjg /*
2*2797Sjg  * CDDL HEADER START
3*2797Sjg  *
4*2797Sjg  * The contents of this file are subject to the terms of the
5*2797Sjg  * Common Development and Distribution License (the "License").
6*2797Sjg  * You may not use this file except in compliance with the License.
7*2797Sjg  *
8*2797Sjg  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*2797Sjg  * or http://www.opensolaris.org/os/licensing.
10*2797Sjg  * See the License for the specific language governing permissions
11*2797Sjg  * and limitations under the License.
12*2797Sjg  *
13*2797Sjg  * When distributing Covered Code, include this CDDL HEADER in each
14*2797Sjg  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*2797Sjg  * If applicable, add the following below this CDDL HEADER, with the
16*2797Sjg  * fields enclosed by brackets "[]" replaced with your own identifying
17*2797Sjg  * information: Portions Copyright [yyyy] [name of copyright owner]
18*2797Sjg  *
19*2797Sjg  * CDDL HEADER END
20*2797Sjg  */
21*2797Sjg /*
22*2797Sjg  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23*2797Sjg  * Use is subject to license terms.
24*2797Sjg  */
25*2797Sjg 
26*2797Sjg #ifndef	_SYS_DEVCACHE_H
27*2797Sjg #define	_SYS_DEVCACHE_H
28*2797Sjg 
29*2797Sjg #pragma ident	"%Z%%M%	%I%	%E% SMI"
30*2797Sjg 
31*2797Sjg #ifdef	__cplusplus
32*2797Sjg extern "C" {
33*2797Sjg #endif
34*2797Sjg 
35*2797Sjg #include <sys/list.h>
36*2797Sjg 
37*2797Sjg #ifdef	_KERNEL
38*2797Sjg 
39*2797Sjg /*
40*2797Sjg  * Handle reference to a registered file
41*2797Sjg  */
42*2797Sjg typedef struct __nvf_handle *nvf_handle_t;
43*2797Sjg 
44*2797Sjg /*
45*2797Sjg  * Registration descriptor for a cache file within /etc/devices
46*2797Sjg  *
47*2797Sjg  * path			- cache file path path
48*2797Sjg  * unpack_list		- when reading, called to unpack nvlist
49*2797Sjg  * pack_list		- when writing, called to pack nvlist
50*2797Sjg  * list_free		- free data contained within list
51*2797Sjg  * write_complete	- called when write is completed
52*2797Sjg  */
53*2797Sjg typedef struct nvf_ops {
54*2797Sjg 	char		*nvfr_cache_path;
55*2797Sjg 	int		(*nvfr_unpack_nvlist)(nvf_handle_t, nvlist_t *, char *);
56*2797Sjg 	int		(*nvfr_pack_list)(nvf_handle_t, nvlist_t **);
57*2797Sjg 	void		(*nvfr_list_free)(nvf_handle_t);
58*2797Sjg 	void		(*nvfr_write_complete)(nvf_handle_t);
59*2797Sjg } nvf_ops_t;
60*2797Sjg 
61*2797Sjg /*
62*2797Sjg  * Client interfaces
63*2797Sjg  */
64*2797Sjg 
65*2797Sjg nvf_handle_t	nvf_register_file(nvf_ops_t *);
66*2797Sjg int		nvf_read_file(nvf_handle_t);
67*2797Sjg void		nvf_wake_daemon(void);
68*2797Sjg void		nvf_error(const char *, ...);
69*2797Sjg char		*nvf_cache_name(nvf_handle_t);
70*2797Sjg krwlock_t	*nvf_lock(nvf_handle_t);
71*2797Sjg list_t		*nvf_list(nvf_handle_t);
72*2797Sjg void		nvf_mark_dirty(nvf_handle_t);
73*2797Sjg int		nvf_is_dirty(nvf_handle_t);
74*2797Sjg 
75*2797Sjg #endif	/* _KERNEL */
76*2797Sjg 
77*2797Sjg #ifdef	__cplusplus
78*2797Sjg }
79*2797Sjg #endif
80*2797Sjg 
81*2797Sjg #endif	/* _SYS_DEVCACHE_H */
82