17a286c47SDai Ngo /* 27a286c47SDai Ngo * CDDL HEADER START 37a286c47SDai Ngo * 47a286c47SDai Ngo * The contents of this file are subject to the terms of the 57a286c47SDai Ngo * Common Development and Distribution License (the "License"). 67a286c47SDai Ngo * You may not use this file except in compliance with the License. 77a286c47SDai Ngo * 87a286c47SDai Ngo * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97a286c47SDai Ngo * or http://www.opensolaris.org/os/licensing. 107a286c47SDai Ngo * See the License for the specific language governing permissions 117a286c47SDai Ngo * and limitations under the License. 127a286c47SDai Ngo * 137a286c47SDai Ngo * When distributing Covered Code, include this CDDL HEADER in each 147a286c47SDai Ngo * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157a286c47SDai Ngo * If applicable, add the following below this CDDL HEADER, with the 167a286c47SDai Ngo * fields enclosed by brackets "[]" replaced with your own identifying 177a286c47SDai Ngo * information: Portions Copyright [yyyy] [name of copyright owner] 187a286c47SDai Ngo * 197a286c47SDai Ngo * CDDL HEADER END 207a286c47SDai Ngo */ 217a286c47SDai Ngo /* 227a286c47SDai Ngo * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 237a286c47SDai Ngo * Use is subject to license terms. 24*b819cea2SGordon Ross * 25*b819cea2SGordon Ross * Copyright 2013 Nexenta Systems, Inc. All rights reserved. 267a286c47SDai Ngo */ 277a286c47SDai Ngo 287a286c47SDai Ngo #ifndef _FS_REPARSE_H 297a286c47SDai Ngo #define _FS_REPARSE_H 307a286c47SDai Ngo 317a286c47SDai Ngo #ifdef __cplusplus 327a286c47SDai Ngo extern "C" { 337a286c47SDai Ngo #endif 347a286c47SDai Ngo 357a286c47SDai Ngo #include <sys/types.h> 367a286c47SDai Ngo #include <sys/param.h> 37*b819cea2SGordon Ross #if defined(_KERNEL) || defined(_FAKE_KERNEL) 387a286c47SDai Ngo #include <sys/time.h> 397a286c47SDai Ngo #include <sys/nvpair.h> 407a286c47SDai Ngo #else 417a286c47SDai Ngo #include <libnvpair.h> 427a286c47SDai Ngo #endif 437a286c47SDai Ngo 447a286c47SDai Ngo #define FS_REPARSE_TAG_STR "@{REPARSE" 457a286c47SDai Ngo #define FS_REPARSE_TAG_END_CHAR '}' 467a286c47SDai Ngo #define FS_REPARSE_TAG_END_STR "}" 477a286c47SDai Ngo #define FS_TOKEN_START_STR "@{" 487a286c47SDai Ngo #define FS_TOKEN_END_STR "}" 497a286c47SDai Ngo 507a286c47SDai Ngo #define REPARSED "svc:/system/filesystem/reparse:default" 517a286c47SDai Ngo #define MAXREPARSELEN MAXPATHLEN 527a286c47SDai Ngo #define REPARSED_DOOR "/var/run/reparsed_door" 537a286c47SDai Ngo #define REPARSED_DOORCALL_MAX_RETRY 4 547a286c47SDai Ngo 557a286c47SDai Ngo /* 567a286c47SDai Ngo * This structure is shared between kernel code and user reparsed daemon. 577a286c47SDai Ngo * The 'res_len' must be defined as int, and not size_t, for 32-bit reparsed 587a286c47SDai Ngo * binary and 64-bit kernel code to work together. 597a286c47SDai Ngo */ 607a286c47SDai Ngo typedef struct reparsed_door_res { 617a286c47SDai Ngo int res_status; 627a286c47SDai Ngo int res_len; 637a286c47SDai Ngo char res_data[1]; 647a286c47SDai Ngo } reparsed_door_res_t; 657a286c47SDai Ngo 667a286c47SDai Ngo extern nvlist_t *reparse_init(void); 677a286c47SDai Ngo extern void reparse_free(nvlist_t *nvl); 687a286c47SDai Ngo extern int reparse_parse(const char *reparse_data, nvlist_t *nvl); 697a286c47SDai Ngo extern int reparse_validate(const char *reparse_data); 707a286c47SDai Ngo 717a286c47SDai Ngo #ifdef _KERNEL 727a286c47SDai Ngo extern int reparse_kderef(const char *svc_type, const char *svc_data, 737a286c47SDai Ngo char *buf, size_t *bufsz); 747a286c47SDai Ngo extern int reparse_vnode_parse(vnode_t *vp, nvlist_t *nvl); 757a286c47SDai Ngo #else 767a286c47SDai Ngo extern int reparse_add(nvlist_t *nvl, const char *svc_type, 777a286c47SDai Ngo const char *svc_data); 787a286c47SDai Ngo extern int reparse_remove(nvlist_t *nvl, const char *svc_type); 797a286c47SDai Ngo extern int reparse_unparse(nvlist_t *nvl, char **stringp); 806a1af1a6SRichard Lowe extern int reparse_create(const char *path, const char *data); 817a286c47SDai Ngo extern int reparse_delete(const char *path); 827a286c47SDai Ngo extern int reparse_deref(const char *svc_type, const char *svc_data, 837a286c47SDai Ngo char *buf, size_t *bufsz); 847a286c47SDai Ngo #endif 857a286c47SDai Ngo 867a286c47SDai Ngo #ifdef __cplusplus 877a286c47SDai Ngo } 887a286c47SDai Ngo #endif 897a286c47SDai Ngo 907a286c47SDai Ngo #endif /* _FS_REPARSE_H */ 91