fssnap_if.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_FSSNAP_IF_H
#define _SYS_FSSNAP_IF_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* ioctl's for communicating between the user and the fssnapctl device.
* Also used to communicate between fssnapctl and the file system.
* Pack fiosnapcreate for amd64 to make struct size same as x86.
*/
#pragma pack(4)
#endif
struct fiosnapcreate {
int rootfiledesc; /* IN fd for root of fs to be snapshotted */
int backfiledesc; /* IN backing store file for snapshot data */
int error; /* OUT error code */
};
struct fiosnapcreate_multi {
int rootfiledesc; /* IN fd for root of fs to be snapshotted */
int error; /* OUT error code */
int backfilecount; /* IN number of backing store files */
};
#pragma pack()
#endif
struct fiosnapdelete {
int rootfiledesc; /* IN fd for root of fs to be unsnapshotted */
int error; /* OUT error code */
};
/* ioctl error returns */
/*
* make the control device minor number high so minor numbers match
* snapshot numbers.
*/
#define SNAP_CTL_MINOR (L_MAXMIN32)
#define SNAP_NAME "fssnap"
#define SNAP_CTL_NODE "ctl"
#define SNAP_BLOCK_NAME SNAP_NAME
/* kstat names */
#define FSSNAP_KSTAT_HIGHWATER "highwater"
#define FSSNAP_KSTAT_MNTPT "mountpoint"
#define FSSNAP_KSTAT_BFNAME "bfname"
#define FSSNAP_KSTAT_NUM "numericstats"
/* numericstats kstat names */
#define FSSNAP_KSTAT_NUM_STATE "state"
#define FSSNAP_KSTAT_NUM_BFSIZE "bfsize"
#define FSSNAP_KSTAT_NUM_MAXSIZE "maxsize"
#define FSSNAP_KSTAT_NUM_CHUNKSIZE "chunksize"
#define FSSNAP_KSTAT_NUM_CREATETIME "createtime"
#if defined(_KERNEL)
/*
* snapshot operations implemented by the loadable snapshot subsystem
*/
struct fssnap_operations {
void (*fssnap_set_candidate)(void *, chunknumber_t);
int (*fssnap_is_candidate)(void *, u_offset_t);
int (*fssnap_create_done)(void *);
int (*fssnap_delete)(void *);
void (*fssnap_strategy)(void *, struct buf *);
};
/* global variables to manage interface operations */
extern struct fssnap_operations snapops;
/* External functions called by file systems that use snapshots */
extern int fssnap_init(void);
extern int fssnap_fini(void);
int, struct vnode **, char *, u_offset_t);
extern void fssnap_set_candidate(void *, chunknumber_t);
extern int fssnap_is_candidate(void *, u_offset_t);
extern int fssnap_create_done(void *);
extern int fssnap_delete(void *);
extern void fssnap_strategy(void *, struct buf *);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FSSNAP_IF_H */