7a286c471efbab8562f7655a82931904703fffe0Dai Ngo/*
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * CDDL HEADER START
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo *
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * The contents of this file are subject to the terms of the
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * Common Development and Distribution License (the "License").
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * You may not use this file except in compliance with the License.
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo *
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * or http://www.opensolaris.org/os/licensing.
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * See the License for the specific language governing permissions
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * and limitations under the License.
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo *
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * When distributing Covered Code, include this CDDL HEADER in each
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * If applicable, add the following below this CDDL HEADER, with the
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * fields enclosed by brackets "[]" replaced with your own identifying
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * information: Portions Copyright [yyyy] [name of copyright owner]
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo *
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * CDDL HEADER END
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo */
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo/*
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * Use is subject to license terms.
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross *
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo */
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#ifndef _FS_REPARSE_H
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#define _FS_REPARSE_H
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#ifdef __cplusplus
7a286c471efbab8562f7655a82931904703fffe0Dai Ngoextern "C" {
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#endif
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#include <sys/types.h>
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#include <sys/param.h>
b819cea2f73f98c5662230cc9affc8cc84f77fcfGordon Ross#if defined(_KERNEL) || defined(_FAKE_KERNEL)
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#include <sys/time.h>
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#include <sys/nvpair.h>
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#else
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#include <libnvpair.h>
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#endif
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#define FS_REPARSE_TAG_STR "@{REPARSE"
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#define FS_REPARSE_TAG_END_CHAR '}'
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#define FS_REPARSE_TAG_END_STR "}"
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#define FS_TOKEN_START_STR "@{"
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#define FS_TOKEN_END_STR "}"
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#define REPARSED "svc:/system/filesystem/reparse:default"
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#define MAXREPARSELEN MAXPATHLEN
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#define REPARSED_DOOR "/var/run/reparsed_door"
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#define REPARSED_DOORCALL_MAX_RETRY 4
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo/*
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * This structure is shared between kernel code and user reparsed daemon.
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * The 'res_len' must be defined as int, and not size_t, for 32-bit reparsed
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo * binary and 64-bit kernel code to work together.
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo */
7a286c471efbab8562f7655a82931904703fffe0Dai Ngotypedef struct reparsed_door_res {
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo int res_status;
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo int res_len;
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo char res_data[1];
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo} reparsed_door_res_t;
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo
7a286c471efbab8562f7655a82931904703fffe0Dai Ngoextern nvlist_t *reparse_init(void);
7a286c471efbab8562f7655a82931904703fffe0Dai Ngoextern void reparse_free(nvlist_t *nvl);
7a286c471efbab8562f7655a82931904703fffe0Dai Ngoextern int reparse_parse(const char *reparse_data, nvlist_t *nvl);
7a286c471efbab8562f7655a82931904703fffe0Dai Ngoextern int reparse_validate(const char *reparse_data);
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#ifdef _KERNEL
7a286c471efbab8562f7655a82931904703fffe0Dai Ngoextern int reparse_kderef(const char *svc_type, const char *svc_data,
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo char *buf, size_t *bufsz);
7a286c471efbab8562f7655a82931904703fffe0Dai Ngoextern int reparse_vnode_parse(vnode_t *vp, nvlist_t *nvl);
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#else
7a286c471efbab8562f7655a82931904703fffe0Dai Ngoextern int reparse_add(nvlist_t *nvl, const char *svc_type,
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo const char *svc_data);
7a286c471efbab8562f7655a82931904703fffe0Dai Ngoextern int reparse_remove(nvlist_t *nvl, const char *svc_type);
7a286c471efbab8562f7655a82931904703fffe0Dai Ngoextern int reparse_unparse(nvlist_t *nvl, char **stringp);
6a1af1a67532df169a657cce07140be64bdea084Richard Loweextern int reparse_create(const char *path, const char *data);
7a286c471efbab8562f7655a82931904703fffe0Dai Ngoextern int reparse_delete(const char *path);
7a286c471efbab8562f7655a82931904703fffe0Dai Ngoextern int reparse_deref(const char *svc_type, const char *svc_data,
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo char *buf, size_t *bufsz);
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#endif
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#ifdef __cplusplus
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo}
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#endif
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo
7a286c471efbab8562f7655a82931904703fffe0Dai Ngo#endif /* _FS_REPARSE_H */