1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 /* 22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 * 25 */ 26 27 28 #ifndef _FB_FSPLUG_H 29 #define _FB_FSPLUG_H 30 31 #include "filebench.h" 32 33 /* 34 * Type of file system client plug-in desired. 35 */ 36 typedef enum fb_plugin_type { 37 LOCAL_FS_PLUG = 0, 38 NFS3_PLUG, 39 NFS4_PLUG, 40 CIFS_PLUG 41 } fb_plugin_type_t; 42 43 /* universal file descriptor for both local and nfs file systems */ 44 typedef union fb_fdesc { 45 int fd_num; /* OS file descriptor number */ 46 void *fd_ptr; /* Pointer to nfs information block */ 47 } fb_fdesc_t; 48 49 typedef struct aiolist aiol_t; 50 51 /* Functions vector for file system plug-ins */ 52 typedef struct fsplug_func_s { 53 char fs_name[16]; 54 int (*fsp_freemem)(fb_fdesc_t *, off64_t); 55 int (*fsp_open)(fb_fdesc_t *, char *, int, int); 56 int (*fsp_pread)(fb_fdesc_t *, caddr_t, fbint_t, off64_t); 57 int (*fsp_read)(fb_fdesc_t *, caddr_t, fbint_t); 58 int (*fsp_pwrite)(fb_fdesc_t *, caddr_t, fbint_t, off64_t); 59 int (*fsp_write)(fb_fdesc_t *, caddr_t, fbint_t); 60 int (*fsp_lseek)(fb_fdesc_t *, off64_t, int); 61 int (*fsp_ftrunc)(fb_fdesc_t *, off64_t); 62 int (*fsp_rename)(const char *, const char *); 63 int (*fsp_close)(fb_fdesc_t *); 64 int (*fsp_link)(const char *, const char *); 65 int (*fsp_symlink)(const char *, const char *); 66 int (*fsp_unlink)(char *); 67 ssize_t (*fsp_readlink)(const char *, char *, size_t); 68 int (*fsp_mkdir)(char *, int); 69 int (*fsp_rmdir)(char *); 70 DIR *(*fsp_opendir)(char *); 71 struct dirent *(*fsp_readdir)(DIR *); 72 int (*fsp_closedir)(DIR *); 73 int (*fsp_fsync)(fb_fdesc_t *); 74 int (*fsp_stat)(char *, struct stat64 *); 75 int (*fsp_fstat)(fb_fdesc_t *, struct stat64 *); 76 int (*fsp_access)(const char *, int); 77 void (*fsp_recur_rm)(char *); 78 } fsplug_func_t; 79 80 extern fsplug_func_t *fs_functions_vec; 81 82 /* Macros for calling functions */ 83 #define FB_FREEMEM(fd, sz) \ 84 (*fs_functions_vec->fsp_freemem)(fd, sz) 85 86 #define FB_OPEN(fd, path, flags, perms) \ 87 (*fs_functions_vec->fsp_open)(fd, path, flags, perms) 88 89 #define FB_PREAD(fdesc, iobuf, iosize, offset) \ 90 (*fs_functions_vec->fsp_pread)(fdesc, iobuf, iosize, offset) 91 92 #define FB_READ(fdesc, iobuf, iosize) \ 93 (*fs_functions_vec->fsp_read)(fdesc, iobuf, iosize) 94 95 #define FB_PWRITE(fdesc, iobuf, iosize, offset) \ 96 (*fs_functions_vec->fsp_pwrite)(fdesc, iobuf, iosize, offset) 97 98 #define FB_WRITE(fdesc, iobuf, iosize) \ 99 (*fs_functions_vec->fsp_write)(fdesc, iobuf, iosize) 100 101 #define FB_LSEEK(fdesc, amnt, whence) \ 102 (*fs_functions_vec->fsp_lseek)(fdesc, amnt, whence) 103 104 #define FB_CLOSE(fdesc) \ 105 (*fs_functions_vec->fsp_close)(fdesc) 106 107 #define FB_UNLINK(path) \ 108 (*fs_functions_vec->fsp_unlink)(path) 109 110 #define FB_MKDIR(path, perm) \ 111 (*fs_functions_vec->fsp_mkdir)(path, perm) 112 113 #define FB_RMDIR(path) \ 114 (*fs_functions_vec->fsp_rmdir)(path) 115 116 #define FB_OPENDIR(path) \ 117 (*fs_functions_vec->fsp_opendir)(path) 118 119 #define FB_READDIR(dir) \ 120 (*fs_functions_vec->fsp_readdir)(dir) 121 122 #define FB_CLOSEDIR(dir) \ 123 (*fs_functions_vec->fsp_closedir)(dir) 124 125 #define FB_FSYNC(fdesc) \ 126 (*fs_functions_vec->fsp_fsync)(fdesc) 127 128 #define FB_RECUR_RM(path) \ 129 (*fs_functions_vec->fsp_recur_rm)(path) 130 131 #define FB_STAT(path, statp) \ 132 (*fs_functions_vec->fsp_stat)(path, statp) 133 134 #define FB_FSTAT(fdesc, statp) \ 135 (*fs_functions_vec->fsp_fstat)(fdesc, statp) 136 137 #define FB_FTRUNC(fdesc, size) \ 138 (*fs_functions_vec->fsp_ftrunc)(fdesc, size) 139 140 #define FB_LINK(existing, new) \ 141 (*fs_functions_vec->fsp_link)(existing, new) 142 143 #define FB_SYMLINK(name1, name2) \ 144 (*fs_functions_vec->fsp_symlink)(name1, name2) 145 146 #endif /* _FB_FSPLUG_H */ 147