18615SAndrew.W.Wilson@sun.com /* 28615SAndrew.W.Wilson@sun.com * CDDL HEADER START 38615SAndrew.W.Wilson@sun.com * 48615SAndrew.W.Wilson@sun.com * The contents of this file are subject to the terms of the 58615SAndrew.W.Wilson@sun.com * Common Development and Distribution License (the "License"). 68615SAndrew.W.Wilson@sun.com * You may not use this file except in compliance with the License. 78615SAndrew.W.Wilson@sun.com * 88615SAndrew.W.Wilson@sun.com * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 98615SAndrew.W.Wilson@sun.com * or http://www.opensolaris.org/os/licensing. 108615SAndrew.W.Wilson@sun.com * See the License for the specific language governing permissions 118615SAndrew.W.Wilson@sun.com * and limitations under the License. 128615SAndrew.W.Wilson@sun.com * 138615SAndrew.W.Wilson@sun.com * When distributing Covered Code, include this CDDL HEADER in each 148615SAndrew.W.Wilson@sun.com * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 158615SAndrew.W.Wilson@sun.com * If applicable, add the following below this CDDL HEADER, with the 168615SAndrew.W.Wilson@sun.com * fields enclosed by brackets "[]" replaced with your own identifying 178615SAndrew.W.Wilson@sun.com * information: Portions Copyright [yyyy] [name of copyright owner] 188615SAndrew.W.Wilson@sun.com * 198615SAndrew.W.Wilson@sun.com * CDDL HEADER END 208615SAndrew.W.Wilson@sun.com */ 218615SAndrew.W.Wilson@sun.com /* 228615SAndrew.W.Wilson@sun.com * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 238615SAndrew.W.Wilson@sun.com * Use is subject to license terms. 248615SAndrew.W.Wilson@sun.com * 258615SAndrew.W.Wilson@sun.com */ 268615SAndrew.W.Wilson@sun.com 278615SAndrew.W.Wilson@sun.com 288615SAndrew.W.Wilson@sun.com #ifndef _FSPLUG_H 298615SAndrew.W.Wilson@sun.com #define _FSPLUG_H 308615SAndrew.W.Wilson@sun.com 318615SAndrew.W.Wilson@sun.com #include <dirent.h> 328615SAndrew.W.Wilson@sun.com #include "config.h" 338615SAndrew.W.Wilson@sun.com #include <sys/stat.h> 348615SAndrew.W.Wilson@sun.com 358615SAndrew.W.Wilson@sun.com /* 368615SAndrew.W.Wilson@sun.com * Type of file system client plug-in desired. 378615SAndrew.W.Wilson@sun.com */ 388615SAndrew.W.Wilson@sun.com typedef enum fb_plugin_type { 398615SAndrew.W.Wilson@sun.com LOCAL_FS_PLUG = 0, 408615SAndrew.W.Wilson@sun.com NFS3_PLUG, 418615SAndrew.W.Wilson@sun.com NFS4_PLUG, 428615SAndrew.W.Wilson@sun.com CIFS_PLUG 438615SAndrew.W.Wilson@sun.com } fb_plugin_type_t; 448615SAndrew.W.Wilson@sun.com 458615SAndrew.W.Wilson@sun.com /* universal file descriptor for both local and nfs file systems */ 468615SAndrew.W.Wilson@sun.com typedef union fb_fdesc { 478615SAndrew.W.Wilson@sun.com int fd_num; /* OS file descriptor number */ 488615SAndrew.W.Wilson@sun.com void *fd_ptr; /* Pointer to nfs information block */ 498615SAndrew.W.Wilson@sun.com } fb_fdesc_t; 508615SAndrew.W.Wilson@sun.com 518615SAndrew.W.Wilson@sun.com typedef struct aiolist aiol_t; 528615SAndrew.W.Wilson@sun.com 538615SAndrew.W.Wilson@sun.com /* Functions vector for file system plug-ins */ 548615SAndrew.W.Wilson@sun.com typedef struct fsplug_func_s { 558615SAndrew.W.Wilson@sun.com char fs_name[16]; 568615SAndrew.W.Wilson@sun.com int (*fsp_freemem)(fb_fdesc_t *, off64_t); 578615SAndrew.W.Wilson@sun.com int (*fsp_open)(fb_fdesc_t *, char *, int, int); 588615SAndrew.W.Wilson@sun.com int (*fsp_pread)(fb_fdesc_t *, caddr_t, fbint_t, off64_t); 598615SAndrew.W.Wilson@sun.com int (*fsp_read)(fb_fdesc_t *, caddr_t, fbint_t); 608615SAndrew.W.Wilson@sun.com int (*fsp_pwrite)(fb_fdesc_t *, caddr_t, fbint_t, off64_t); 618615SAndrew.W.Wilson@sun.com int (*fsp_write)(fb_fdesc_t *, caddr_t, fbint_t); 628615SAndrew.W.Wilson@sun.com int (*fsp_lseek)(fb_fdesc_t *, off64_t, int); 638615SAndrew.W.Wilson@sun.com int (*fsp_ftrunc)(fb_fdesc_t *, off64_t); 648615SAndrew.W.Wilson@sun.com int (*fsp_rename)(const char *, const char *); 658615SAndrew.W.Wilson@sun.com int (*fsp_close)(fb_fdesc_t *); 668615SAndrew.W.Wilson@sun.com int (*fsp_link)(const char *, const char *); 678615SAndrew.W.Wilson@sun.com int (*fsp_symlink)(const char *, const char *); 688615SAndrew.W.Wilson@sun.com int (*fsp_unlink)(char *); 698615SAndrew.W.Wilson@sun.com ssize_t (*fsp_readlink)(const char *, char *, size_t); 708615SAndrew.W.Wilson@sun.com int (*fsp_mkdir)(char *, int); 718615SAndrew.W.Wilson@sun.com int (*fsp_rmdir)(char *); 728615SAndrew.W.Wilson@sun.com DIR *(*fsp_opendir)(char *); 738615SAndrew.W.Wilson@sun.com struct dirent *(*fsp_readdir)(DIR *); 748615SAndrew.W.Wilson@sun.com int (*fsp_closedir)(DIR *); 758615SAndrew.W.Wilson@sun.com int (*fsp_fsync)(fb_fdesc_t *); 768615SAndrew.W.Wilson@sun.com int (*fsp_stat)(char *, struct stat64 *); 778615SAndrew.W.Wilson@sun.com int (*fsp_fstat)(fb_fdesc_t *, struct stat64 *); 788615SAndrew.W.Wilson@sun.com int (*fsp_access)(const char *, int); 79*9356SAndrew.W.Wilson@sun.com void (*fsp_recur_rm)(char *); 808615SAndrew.W.Wilson@sun.com } fsplug_func_t; 818615SAndrew.W.Wilson@sun.com 828615SAndrew.W.Wilson@sun.com extern fsplug_func_t *fs_functions_vec; 838615SAndrew.W.Wilson@sun.com 848615SAndrew.W.Wilson@sun.com /* Macros for calling functions */ 858615SAndrew.W.Wilson@sun.com #define FB_FREEMEM(fd, sz) \ 868615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_freemem)(fd, sz) 878615SAndrew.W.Wilson@sun.com 888615SAndrew.W.Wilson@sun.com #define FB_OPEN(fd, path, flags, perms) \ 898615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_open)(fd, path, flags, perms) 908615SAndrew.W.Wilson@sun.com 918615SAndrew.W.Wilson@sun.com #define FB_PREAD(fdesc, iobuf, iosize, offset) \ 928615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_pread)(fdesc, iobuf, iosize, offset) 938615SAndrew.W.Wilson@sun.com 948615SAndrew.W.Wilson@sun.com #define FB_READ(fdesc, iobuf, iosize) \ 958615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_read)(fdesc, iobuf, iosize) 968615SAndrew.W.Wilson@sun.com 978615SAndrew.W.Wilson@sun.com #define FB_PWRITE(fdesc, iobuf, iosize, offset) \ 988615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_pwrite)(fdesc, iobuf, iosize, offset) 998615SAndrew.W.Wilson@sun.com 1008615SAndrew.W.Wilson@sun.com #define FB_WRITE(fdesc, iobuf, iosize) \ 1018615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_write)(fdesc, iobuf, iosize) 1028615SAndrew.W.Wilson@sun.com 1038615SAndrew.W.Wilson@sun.com #define FB_LSEEK(fdesc, amnt, whence) \ 1048615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_lseek)(fdesc, amnt, whence) 1058615SAndrew.W.Wilson@sun.com 1068615SAndrew.W.Wilson@sun.com #define FB_CLOSE(fdesc) \ 1078615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_close)(fdesc) 1088615SAndrew.W.Wilson@sun.com 1098615SAndrew.W.Wilson@sun.com #define FB_UNLINK(path) \ 1108615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_unlink)(path) 1118615SAndrew.W.Wilson@sun.com 1128615SAndrew.W.Wilson@sun.com #define FB_MKDIR(path, perm) \ 1138615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_mkdir)(path, perm) 1148615SAndrew.W.Wilson@sun.com 1158615SAndrew.W.Wilson@sun.com #define FB_RMDIR(path) \ 1168615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_rmdir)(path) 1178615SAndrew.W.Wilson@sun.com 1188615SAndrew.W.Wilson@sun.com #define FB_OPENDIR(path) \ 1198615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_opendir)(path) 1208615SAndrew.W.Wilson@sun.com 1218615SAndrew.W.Wilson@sun.com #define FB_READDIR(dir) \ 1228615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_readdir)(dir) 1238615SAndrew.W.Wilson@sun.com 1248615SAndrew.W.Wilson@sun.com #define FB_CLOSEDIR(dir) \ 1258615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_closedir)(dir) 1268615SAndrew.W.Wilson@sun.com 1278615SAndrew.W.Wilson@sun.com #define FB_FSYNC(fdesc) \ 1288615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_fsync)(fdesc) 1298615SAndrew.W.Wilson@sun.com 130*9356SAndrew.W.Wilson@sun.com #define FB_RECUR_RM(path) \ 131*9356SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_recur_rm)(path) 132*9356SAndrew.W.Wilson@sun.com 1338615SAndrew.W.Wilson@sun.com #define FB_STAT(path, statp) \ 1348615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_stat)(path, statp) 1358615SAndrew.W.Wilson@sun.com 1368615SAndrew.W.Wilson@sun.com #define FB_FSTAT(fdesc, statp) \ 1378615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_fstat)(fdesc, statp) 1388615SAndrew.W.Wilson@sun.com 1398615SAndrew.W.Wilson@sun.com #define FB_FTRUNC(fdesc, size) \ 1408615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_ftrunc)(fdesc, size) 1418615SAndrew.W.Wilson@sun.com 1428615SAndrew.W.Wilson@sun.com #define FB_LINK(existing, new) \ 1438615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_link)(existing, new) 1448615SAndrew.W.Wilson@sun.com 1458615SAndrew.W.Wilson@sun.com #define FB_SYMLINK(name1, name2) \ 1468615SAndrew.W.Wilson@sun.com (*fs_functions_vec->fsp_symlink)(name1, name2) 1478615SAndrew.W.Wilson@sun.com 1488615SAndrew.W.Wilson@sun.com #endif /* _FSPLUG_H */ 149