flowop.h revision f2fc321be9b4df7748e8c31a5edd154b0177b139
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _FB_FLOWOP_H
#define _FB_FLOWOP_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/resource.h>
#include <pthread.h>
#ifndef HAVE_SYSV_SEM
#include <semaphore.h>
#endif
#include "stats.h"
#include "threadflow.h"
#include "vars.h"
#include "fileset.h"
#include "filebench.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct flowop {
int fo_instance; /* Instance number */
int (*fo_func)(); /* Method */
int (*fo_init)(); /* Init Method */
void (*fo_destruct)(); /* Destructor Method */
int fo_type; /* Type */
int fo_attrs; /* Flow op attribute */
int fo_fd; /* File descriptor */
int fo_fdnumber; /* User specified file descriptor */
int fo_srcfdnumber; /* User specified src file descriptor */
char *fo_buf; /* Per-flowop buffer */
#ifdef HAVE_SYSV_SEM
int fo_semid_lw; /* sem id */
int fo_semid_hw; /* sem id for highwater block */
#else
#endif /* HAVE_SYSV_SEM */
void *fo_idp; /* id, for sems etc */
int fo_initted; /* Set to one if initialized */
} flowop_t;
/* Flow Op Attrs */
#define FLOW_ATTR_SEQUENTIAL 0x1
#define FLOW_ATTR_RANDOM 0x2
#define FLOW_ATTR_STRIDE 0x4
#define FLOW_ATTR_BACKWARDS 0x8
#define FLOW_ATTR_DSYNC 0x10
#define FLOW_ATTR_BLOCKING 0x20
#define FLOW_ATTR_DIRECTIO 0x40
#define FLOW_ATTR_READ 0x80
#define FLOW_ATTR_WRITE 0x100
#define FLOW_DEFINITION 0 /* Prototype definition of flowop from library */
#define FLOW_TYPES 5
#define FLOW_TYPE_GLOBAL 0 /* Rolled up statistics */
extern flowstat_t controlstats;
void flowop_init(void);
void flowoplib_usage(void);
void flowoplib_init(void);
#ifdef __cplusplus
}
#endif
#endif /* _FB_FLOWOP_H */