nfs-ganesha 1.4

fsal_pnfs.h

Go to the documentation of this file.
00001 /*
00002  *
00003  * Copyright (C) 2011 Linux Box Corporation
00004  * Author: Adam C. Emerson
00005  *         Boaz Harrosh
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License
00009  * as published by the Free Software Foundation; either version 3 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00020  * 02110-1301 USA
00021  * ---------------------------------------
00022  */
00023 
00031 #ifndef _FSAL_PNFS_H
00032 #define _FSAL_PNFS_H
00033 
00034 /* The next 3 line are mandatory for proper autotools based management */
00035 #ifdef HAVE_CONFIG_H
00036 #include "config.h"
00037 #endif                          /* HAVE_CONFIG_H */
00038 
00039 #include <stdint.h>
00040 #include "pnfs_common.h"
00041 
00042 #include "nfs4.h"
00043 
00044 #ifdef _USE_NFS4_1
00045 
00046 #ifdef _USE_LUSTRE
00047 #include "FSAL/FSAL_LUSTRE/fsal_pnfs_types.h"
00048 #endif 
00049 
00050 #ifdef _USE_CEPH
00051 #include "FSAL/FSAL_CEPH/fsal_pnfs_types.h"
00052 #endif 
00053 
00054 /******************************************************
00055  *         FSAL MDS function argument structs
00056  ******************************************************/
00057 
00062 struct fsal_layoutget_arg {
00064      layouttype4 type;
00067      length4 minlength;
00070      uint64_t export_id;
00073      count4 maxcount;
00074 };
00075 
00080 struct fsal_layoutget_res {
00084      struct pnfs_segment segment;
00089      void *fsal_seg_data;
00093      fsal_boolean_t return_on_close;
00100      void *context;
00106      fsal_boolean_t last_segment;
00113      fsal_boolean_t signal_available;
00114 };
00115 
00120 struct fsal_layoutreturn_arg {
00125      fsal_boolean_t reclaim;
00127      layouttype4 lo_type;
00130      layoutreturn_type4 return_type;
00136      struct pnfs_segment spec_segment;
00139      struct pnfs_segment cur_segment;
00143      void *fsal_seg_data;
00146      fsal_boolean_t synthetic;
00149      fsal_boolean_t dispose;
00153      fsal_boolean_t last_segment;
00154 };
00155 
00160 struct fsal_layoutcommit_arg {
00162      layouttype4 type;
00164      struct pnfs_segment segment;
00166      void *fsal_seg_data;
00168      fsal_boolean_t reclaim;
00170      fsal_boolean_t new_offset;
00173      offset4 last_write;
00175      fsal_boolean_t time_changed;
00178      fsal_time_t new_time;
00179 };
00180 
00185 struct fsal_layoutcommit_res {
00191      void *context;
00193      fsal_boolean_t size_supplied;
00195      length4 new_size;
00199      fsal_boolean_t commit_done;
00200 };
00201 
00206 struct fsal_getdevicelist_arg {
00208      uint64_t export_id;
00211      layouttype4 type;
00212 };
00213 
00219 struct fsal_getdevicelist_res {
00224      nfs_cookie4 cookie;
00229      verifier4 cookieverf;
00231      fsal_boolean_t eof;
00235      unsigned int count;
00239      uint64_t *devids;
00240 };
00241 
00246 typedef struct fsal_mdsfunctions__ {
00265      nfsstat4 (*layoutget)(
00268           fsal_handle_t *handle,
00270           fsal_op_context_t *context,
00274           XDR *loc_body,
00276           const struct fsal_layoutget_arg *arg,
00278           struct fsal_layoutget_res *res);
00279 
00299      nfsstat4 (*layoutreturn)(
00302           fsal_handle_t* handle,
00304           fsal_op_context_t* context,
00309           XDR *lrf_body,
00311           const struct fsal_layoutreturn_arg *arg);
00312 
00313 
00331      nfsstat4 (*layoutcommit)(
00333           fsal_handle_t *handle,
00335           fsal_op_context_t *context,
00338           XDR *lou_body,
00340           const struct fsal_layoutcommit_arg *arg,
00342           struct fsal_layoutcommit_res *res);
00343 
00355      nfsstat4 (*getdeviceinfo)(
00357           fsal_op_context_t *context,
00361           XDR* da_addr_body,
00363           const layouttype4 type,
00365           const struct pnfs_deviceid *deviceid);
00366 
00384      nfsstat4 (*getdevicelist)(
00387           fsal_handle_t *handle,
00389           fsal_op_context_t *context,
00391           const struct fsal_getdevicelist_arg *arg,
00393           struct fsal_getdevicelist_res *res);
00394 } fsal_mdsfunctions_t;
00395 
00396 /*
00397  * XXX This is built on the assumption of a single FSAL.  This
00398  * XXX variable must be removed and references to it must be updated
00399  * XXX after the Lieb Rearchitecture.
00400  */
00401 #ifdef _PNFS_MDS
00402 extern fsal_mdsfunctions_t fsal_mdsfunctions;
00403 #endif /* _PNFS_MDS */
00404 
00409 typedef struct fsal_dsfunctions__ {
00423   nfsstat4 (*DS_read)(
00425        fsal_handle_t *handle,
00427        fsal_op_context_t *context,
00430        const stateid4 *stateid,
00432        offset4 offset,
00434        count4 requested_length,
00436        caddr_t buffer,
00438        count4 *supplied_length,
00440        fsal_boolean_t *end_of_file);
00441 
00455      nfsstat4 (*DS_write)(
00457           fsal_handle_t *handle,
00459           fsal_op_context_t *context,
00462           const stateid4 *stateid,
00464           offset4 offset,
00466           count4 write_length,
00468           const caddr_t buffer,
00470           stable_how4 stability_wanted,
00472           count4 *written_length,
00474           verifier4 *writeverf,
00476           stable_how4 *stability_got);
00477 
00491   nfsstat4 (*DS_commit)(
00493        fsal_handle_t *handle,
00495        fsal_op_context_t *context,
00497        offset4 offset,
00499        count4 count,
00501        verifier4 *writeverf);
00502 } fsal_dsfunctions_t;
00503 
00504 /*
00505  * XXX This is built on the assumption of a single FSAL.  This
00506  * XXX variable must be removed and references to it must be updated
00507  * XXX after the Lieb Rearchitecture.
00508  */
00509 #ifdef _PNFS_DS
00510 extern fsal_dsfunctions_t fsal_dsfunctions;
00511 #endif /* _PNFS_DS */
00512 
00513 fsal_mdsfunctions_t FSAL_GetMDSFunctions(void);
00514 void FSAL_LoadMDSFunctions(void);
00515 
00516 fsal_dsfunctions_t FSAL_GetDSFunctions();
00517 void FSAL_LoadDSFunctions(void);
00518 
00519 #endif /* _USE_NFS4_1 */
00520 
00521 #endif /* _FSAL_PNFS_H */