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