cachefs_log.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_FS_CACHEFS_LOG_H
#define _SYS_FS_CACHEFS_LOG_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/* constants, etc. */
#define CACHEFS_LOG_MAGIC 32321
#define CACHEFS_LOG_FILE_REV 2
#define CACHEFS_LOG_MOUNT 1
#define CACHEFS_LOG_UMOUNT 2
#define CACHEFS_LOG_GETPAGE 3
#define CACHEFS_LOG_READDIR 4
#define CACHEFS_LOG_READLINK 5
#define CACHEFS_LOG_REMOVE 6
#define CACHEFS_LOG_RMDIR 7
#define CACHEFS_LOG_TRUNCATE 8
#define CACHEFS_LOG_PUTPAGE 9
#define CACHEFS_LOG_CREATE 10
#define CACHEFS_LOG_MKDIR 11
#define CACHEFS_LOG_RENAME 12
#define CACHEFS_LOG_SYMLINK 13
#define CACHEFS_LOG_POPULATE 14
#define CACHEFS_LOG_CSYMLINK 15
#define CACHEFS_LOG_FILLDIR 16
#define CACHEFS_LOG_MDCREATE 17
#define CACHEFS_LOG_GPFRONT 18
#define CACHEFS_LOG_RFDIR 19
#define CACHEFS_LOG_UALLOC 20
#define CACHEFS_LOG_CALLOC 21
#define CACHEFS_LOG_NOCACHE 22
#define CACHEFS_LOG_NUMRECS 22
/*
* cachefs_log_* are stored on disk, so they need to be the same
* 32-bit vs. 64-bit.
*/
#pragma pack(4)
#endif
/*
* for communicating from user to kernel, or for storing state.
*/
typedef struct cachefs_log_control {
int lc_magic;
char lc_path[MAXPATHLEN];
/*
* per-cachefscache information
*/
typedef struct cachefs_log_cookie {
void *cl_head; /* head of records to be written */
void *cl_tail; /* tail of records to be written */
int cl_magic; /* cheap sanity check */
/* macros for determining which things we're logging + misc stuff */
(sizeof (struct sname) - \
struct cachefs_log_logfile_header {
int lh_errno;
};
/*
* declarations of the logging records.
*
* note -- the first three fields must be int, int, and time_t (time32_t),
* corresponding to record type, error status, and timestamp.
*
* note -- the size of a trailing string should be large enough to
* hold any necessary null-terminating bytes. i.e. for one string,
* say `char foo[1]'. for two strings, null-separated, say `char
* foo[2]'.
*
* XX64 time32_t (above) is going to be a problem when the underlying
* filesystems support 64-bit time.
*/
/*
* XX64 - for now define all time types as 32-bits.
*/
#if (defined(_SYSCALL32) && defined(_LP64))
#else /* not _SYSCALL32 && _LP64 */
#endif /* _SYSCALL32 && _LP64 */
struct cachefs_log_mount_record {
int type; /* == CACHEFS_LOG_MOUNT */
int error; /* errno */
};
struct cachefs_log_umount_record {
int type; /* == CACHEFS_LOG_UMOUNT */
int error; /* errno */
};
struct cachefs_log_getpage_record {
int type; /* == CACHEFS_LOG_GETPAGE */
int error; /* errno */
};
struct cachefs_log_readdir_record {
int type; /* == CACHEFS_LOG_READDIR */
int error; /* errno */
int eof; /* like `*eofp' in VOP_READDIR */
};
struct cachefs_log_readlink_record {
int type; /* == CACHEFS_LOG_READLINK */
int error; /* errno */
};
struct cachefs_log_remove_record {
int type; /* == CACHEFS_LOG_REMOVE */
int error; /* errno */
/* (not the directory holding the file) */
};
struct cachefs_log_rmdir_record {
int type; /* == CACHEFS_LOG_RMDIR */
int error; /* errno */
};
struct cachefs_log_truncate_record {
int type; /* == CACHEFS_LOG_TRUNCATE */
int error; /* errno */
};
struct cachefs_log_putpage_record {
int type; /* == CACHEFS_LOG_PUTPAGE */
int error; /* errno */
};
struct cachefs_log_create_record {
int type; /* == CACHEFS_LOG_CREATE */
int error; /* errno */
};
struct cachefs_log_mkdir_record {
int type; /* == CACHEFS_LOG_MKDIR */
int error; /* errno */
};
struct cachefs_log_rename_record {
int type; /* == CACHEFS_LOG_RENAME */
int error; /* errno */
int removed; /* nonzero if file was removed */
};
struct cachefs_log_symlink_record {
int type; /* == CACHEFS_LOG_SYMLINK */
int error; /* errno */
};
struct cachefs_log_populate_record {
int type; /* == CACHEFS_LOG_POPULATE */
int error; /* errno */
};
struct cachefs_log_csymlink_record {
int type; /* == CACHEFS_LOG_CSYMLINK */
int error; /* errno */
int size; /* size of symlink being cached */
};
struct cachefs_log_filldir_record {
int type; /* == CACHEFS_LOG_FILLDIR */
int error; /* errno */
int size; /* size of frontfile after filling */
};
struct cachefs_log_mdcreate_record {
int type; /* == CACHEFS_LOG_MDCREATE */
int error; /* errno */
};
struct cachefs_log_gpfront_record {
int type; /* == CACHEFS_LOG_GPFRONT */
int error; /* errno */
};
struct cachefs_log_rfdir_record {
int type; /* == CACHEFS_LOG_GPFRONT */
int error; /* errno */
};
struct cachefs_log_ualloc_record {
int type; /* == CACHEFS_LOG_UALLOC */
int error; /* errno */
};
struct cachefs_log_calloc_record {
int type; /* == CACHEFS_LOG_CALLOC */
int error; /* errno */
};
struct cachefs_log_nocache_record {
int type; /* == CACHEFS_LOG_NOCACHE */
int error; /* errno */
};
#pragma pack()
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SYS_FS_CACHEFS_LOG_H */