nfs-ganesha 1.4

fsal_types.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2010 The Linx Box Corporation
00003  * Contributor : Adam C. Emerson
00004  *
00005  * Some Portions Copyright CEA/DAM/DIF  (2008)
00006  * contributeur : Philippe DENIEL   philippe.deniel@cea.fr
00007  *                Thomas LEIBOVICI  thomas.leibovici@cea.fr
00008  *
00009  *
00010  * This program is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 3 of the License, or (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00023  *
00024  * ---------------------------------------
00025  */
00026 
00036 #ifndef _FSAL_TYPES_SPECIFIC_H
00037 #define _FSAL_TYPES_SPECIFIC_H
00038 
00039 # define CONF_LABEL_FS_SPECIFIC   "CEPH"
00040 
00041 #include <sys/types.h>
00042 #include <sys/stat.h>
00043 #include <sys/statvfs.h>
00044 #include <sys/param.h>
00045 #include "config_parsing.h"
00046 #include "err_fsal.h"
00047 #include <cephfs/libcephfs.h>
00048 //#include "ceph/libceph.h"
00049 #include <pthread.h>
00050 #include "fsal_glue_const.h"
00051 
00052 #define fsal_handle_t cephfsal_handle_t
00053 #define fsal_op_context_t cephfsal_op_context_t
00054 #define fsal_file_t cephfsal_file_t
00055 #define fsal_dir_t cephfsal_dir_t
00056 #define fsal_export_context_t cephfsal_export_context_t
00057 #define fsal_lockdesc_t cephfsal_lockdesc_t
00058 #define fsal_cookie_t cephfsal_cookie_t
00059 #define fs_specific_initinfo_t cephfs_specific_initinfo_t
00060 #define fsal_cred_t cephfsal_cred_t
00061 
00062 typedef union {
00063   struct
00064   {
00065     vinodeno_t vi;
00066     uint64_t parent_ino;
00067     uint32_t parent_hash;
00068 #ifdef _PNFS
00069     struct ceph_file_layout layout;
00070     uint64_t snapseq;
00071 #endif /* _PNFS */
00072    } data;
00073   char pad[FSAL_HANDLE_T_SIZE];
00074 } cephfsal_handle_t;
00075 
00076 #define VINODE(fh) ((fh)->data.vi)
00077 
00078 typedef struct fsal_export_context__
00079 {
00080   fsal_staticfsinfo_t * fe_static_fs_info;     /* Must be the first entry in this structure */
00081   char mount[FSAL_MAX_PATH_LEN];
00082   struct ceph_mount_info *cmount;
00083 } cephfsal_export_context_t;
00084 
00085 typedef struct fsal_op_context__
00086 {
00087   cephfsal_export_context_t *export_context;
00088   struct user_credentials credential;
00089 } cephfsal_op_context_t;
00090 
00091 #define FSAL_OP_CONTEXT_TO_UID( pcontext ) ( (pcontext)->credential.user )
00092 #define FSAL_OP_CONTEXT_TO_GID( pcontext ) ( (pcontext)->credential.group )
00093 
00094 typedef struct fs_specific_initinfo__
00095 {
00096   char cephserver[FSAL_MAX_NAME_LEN];
00097 } cephfs_specific_initinfo_t;
00098 
00099 
00100 typedef union {
00101   struct {
00102     loff_t cookie;
00103   } data;
00104   char pad[FSAL_COOKIE_T_SIZE];
00105 } cephfsal_cookie_t;
00106 
00107 #define COOKIE(c) ((c).data.cookie)
00108 
00109 typedef void *cephfsal_lockdesc_t;
00110 
00111 typedef struct {
00112   vinodeno_t vi;
00113   struct ceph_dir_result *dh;
00114   cephfsal_op_context_t ctx;
00115 } cephfsal_dir_t;
00116 
00117 #define DH(dir) (dir->dh)
00118 
00119 typedef struct {
00120   Fh* fh;
00121   vinodeno_t vi;
00122   cephfsal_op_context_t ctx;
00123 } cephfsal_file_t;
00124 
00125 #define FH(file) ((file)->fh)
00126 
00127 #endif                          /* _FSAL_TYPES_SPECIFIC_H */