2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#ifndef _LIBSHADOWFS_IMPL_H
2N/A#define _LIBSHADOWFS_IMPL_H
2N/A
2N/A#include <sys/types.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A/* Shadow conspiracy SMF parameters */
2N/A#define CONFIG_PARAMS "config_params"
2N/A#define WORKER_THREADS "shadow_threads"
2N/A#define FAIL_THROTTLE "shadow_throttle"
2N/A#define DEBUG_FILE "shadow_debug"
2N/A
2N/A#define DEFAULT_NWORKERS 8
2N/A#define DEFAULT_THROTTLE 1000000
2N/A
2N/A#ifndef ASSERT
2N/A#define ASSERT(x) assert((x));
2N/A#endif
2N/A
2N/Atypedef struct shadow_handle shadow_handle_t;
2N/A
2N/Atypedef enum {
2N/A ESHADOW_NONE, /* no error */
2N/A ESHADOW_NOMEM, /* out of memory */
2N/A ESHADOW_NOMOUNT, /* no such mountpoint */
2N/A ESHADOW_NOSHADOW, /* not a shadow mountpoint */
2N/A ESHADOW_CORRUPT, /* internal data inconsistency */
2N/A ESHADOW_ZFS_NOENT, /* failed to open ZFS dataset */
2N/A ESHADOW_ZFS_IO, /* I/O error */
2N/A ESHADOW_ZFS_IMPL, /* internal ZFS error */
2N/A ESHADOW_MNT_CLEAR, /* failed to clear mount option */
2N/A ESHADOW_MIGRATE_BUSY, /* migration currently busy */
2N/A ESHADOW_MIGRATE_DONE, /* finished migrating all data */
2N/A ESHADOW_MIGRATE_INTR, /* a file migration was interrupted */
2N/A ESHADOW_STANDBY, /* filesystem is in standby mode */
2N/A ESHADOW_UNKNOWN /* unknown error */
2N/A} shadow_errno_t;
2N/A
2N/Atypedef struct {
2N/A uint64_t ss_processed; /* plain file contents transferred */
2N/A uint64_t ss_estimated; /* estimated remaining contents */
2N/A hrtime_t ss_start; /* start of migration */
2N/A uint32_t ss_errors; /* number of unique errors seen */
2N/A} shadow_status_t;
2N/A
2N/A/* Shadow conspiracy status */
2N/Atypedef struct shadow_conspiracy_status {
2N/A char *scs_ds_name;
2N/A uint64_t scs_xferred;
2N/A uint64_t scs_remaining;
2N/A int scs_errors;
2N/A uint64_t scs_elapsed;
2N/A boolean_t scs_complete;
2N/A} shadow_conspiracy_status_t;
2N/A
2N/Atypedef struct {
2N/A int ser_errno; /* error seen */
2N/A char *ser_path; /* path */
2N/A} shadow_error_report_t;
2N/A
2N/Aextern shadow_handle_t *shadow_open(const char *);
2N/Aextern void shadow_close(shadow_handle_t *);
2N/A
2N/Aextern int shadow_cancel(shadow_handle_t *);
2N/Aextern shadow_errno_t shadow_errno(void);
2N/Aextern const char *shadow_errmsg(void);
2N/A
2N/Aextern shadow_error_report_t *shadow_get_errors(shadow_handle_t *, size_t);
2N/Aextern void shadow_free_errors(shadow_error_report_t *, size_t);
2N/A
2N/A
2N/Aextern int shadow_migrate_one(shadow_handle_t *);
2N/Aextern boolean_t shadow_migrate_only_errors(shadow_handle_t *);
2N/Aextern int shadow_migrate_finalize(shadow_handle_t *);
2N/A
2N/Aextern void shadow_get_status(shadow_handle_t *, shadow_status_t *);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _LIBSHADOWFS_IMPL_H */