nfs-ganesha 1.4

gpfs_nfs.h

Go to the documentation of this file.
00001 /* IBM_PROLOG_BEGIN_TAG                                                   */
00002 /* This is an automatically generated prolog.                             */
00003 /*                                                                        */
00004 /* avs_rhrz src/avs/fs/mmfs/ts/util/gpfs_nfs.h 1.26.1.5                   */
00005 /*                                                                        */
00006 /* Licensed Materials - Property of IBM                                   */
00007 /*                                                                        */
00008 /* Restricted Materials of IBM                                            */
00009 /*                                                                        */
00010 /* COPYRIGHT International Business Machines Corp. 2011,2012              */
00011 /* All Rights Reserved                                                    */
00012 /*                                                                        */
00013 /* US Government Users Restricted Rights - Use, duplication or            */
00014 /* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.      */
00015 /*                                                                        */
00016 /* IBM_PROLOG_END_TAG                                                     */
00017 /*                                                                              */
00018 /* Copyright (C) 2001 International Business Machines                           */
00019 /* All rights reserved.                                                         */
00020 /*                                                                              */
00021 /* This file is part of the GPFS user library.                                  */
00022 /*                                                                              */
00023 /* Redistribution and use in source and binary forms, with or without           */
00024 /* modification, are permitted provided that the following conditions           */
00025 /* are met:                                                                     */
00026 /*                                                                              */
00027 /*  1. Redistributions of source code must retain the above copyright notice,   */
00028 /*     this list of conditions and the following disclaimer.                    */
00029 /*  2. Redistributions in binary form must reproduce the above copyright        */
00030 /*     notice, this list of conditions and the following disclaimer in the      */
00031 /*     documentation and/or other materials provided with the distribution.     */
00032 /*  3. The name of the author may not be used to endorse or promote products    */
00033 /*     derived from this software without specific prior written                */
00034 /*     permission.                                                              */
00035 /*                                                                              */
00036 /* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR         */
00037 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES    */
00038 /* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.      */
00039 /* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
00040 /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
00041 /* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;  */
00042 /* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,     */
00043 /* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR      */
00044 /* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF       */
00045 /* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                                   */
00046 /*                                                                              */
00047 /* @(#)83       1.26.1.5  src/avs/fs/mmfs/ts/util/gpfs_nfs.h, mmfs, avs_rhrz 5/21/12 17:40:05 */
00048 /*
00049  *  Library calls for GPFS interfaces
00050  */
00051 #ifndef H_GPFS_NFS
00052 #define H_GPFS_NFS
00053 
00054 #ifdef __cplusplus
00055 extern "C" {
00056 #endif
00057 
00058 #ifdef WIN32
00059 struct flock
00060 {};
00061 #endif
00062 
00063 //#define GPFS_PRINTK
00064 
00065 /* GANESHA common information */
00066 
00067 #define OPENHANDLE_NAME_TO_HANDLE 101
00068 #define OPENHANDLE_OPEN_BY_HANDLE 102
00069 #define OPENHANDLE_LINK_BY_FD     103
00070 #define OPENHANDLE_READLINK_BY_FD 104
00071 #define OPENHANDLE_STAT_BY_HANDLE 105
00072 #define OPENHANDLE_LAYOUT_TYPE    106
00073 #define OPENHANDLE_GET_DEVICEINFO 107
00074 #define OPENHANDLE_GET_DEVICELIST 108
00075 #define OPENHANDLE_LAYOUT_GET     109
00076 #define OPENHANDLE_LAYOUT_RETURN  110
00077 #define OPENHANDLE_INODE_UPDATE   111
00078 #define OPENHANDLE_GET_XSTAT      112
00079 #define OPENHANDLE_SET_XSTAT      113
00080 #define OPENHANDLE_CHECK_ACCESS   114
00081 #define OPENHANDLE_OPEN_SHARE_BY_HANDLE 115
00082 #define OPENHANDLE_GET_LOCK       116
00083 #define OPENHANDLE_SET_LOCK       117
00084 #define OPENHANDLE_THREAD_UPDATE  118
00085 #define OPENHANDLE_LAYOUT_COMMIT  119
00086 #define OPENHANDLE_DS_READ        120
00087 #define OPENHANDLE_DS_WRITE       121
00088 #define OPENHANDLE_GET_VERIFIER   122
00089 #define OPENHANDLE_FSYNC          123
00090 #define OPENHANDLE_SHARE_RESERVE  124
00091 #define OPENHANDLE_GET_NODEID     125
00092 #define OPENHANDLE_SET_DELEGATION 126
00093 #define OPENHANDLE_CLOSE_FILE     127
00094 #define OPENHANDLE_LINK_BY_FH     128
00095 #define OPENHANDLE_RENAME_BY_FH   129
00096 #define OPENHANDLE_STAT_BY_NAME   130
00097 #define OPENHANDLE_GET_HANDLE     131
00098 #define OPENHANDLE_READLINK_BY_FH 132
00099 #define OPENHANDLE_UNLINK_BY_NAME 133
00100 #define OPENHANDLE_CREATE_BY_NAME 134
00101 
00102 int gpfs_ganesha(int op, void *oarg);
00103 
00104 #define OPENHANDLE_HANDLE_LEN 40
00105 #define OPENHANDLE_KEY_LEN 28
00106 
00107 struct xstat_cred_t
00108 {
00109   u_int32_t principal;          /* user id */
00110   u_int32_t group;              /* primary group id */
00111   u_int16_t num_groups;         /* number secondary groups for this user */
00112 #define XSTAT_CRED_NGROUPS 32
00113   u_int32_t eGroups[XSTAT_CRED_NGROUPS];/* array of secondary groups */
00114 };
00115 
00116 struct gpfs_time_t
00117 {
00118   u_int32_t t_sec;
00119   u_int32_t t_nsec;
00120 };
00121 
00122 struct gpfs_file_handle
00123 {
00124   u_int32_t handle_size;
00125   u_int32_t handle_type;
00126   u_int16_t handle_version;
00127   u_int16_t handle_key_size;
00128   /* file identifier */
00129   unsigned char f_handle[OPENHANDLE_HANDLE_LEN];
00130 };
00131 
00132 struct name_handle_arg
00133 {
00134   int dfd;
00135   int flag;
00136   char *name;
00137   struct gpfs_file_handle *handle;
00138 };
00139 
00140 struct get_handle_arg
00141 {
00142   int mountdirfd;
00143   int len;
00144   char *name;
00145   struct gpfs_file_handle *dir_fh;
00146   struct gpfs_file_handle *out_fh;
00147 };
00148 
00149 struct open_arg
00150 {
00151   int mountdirfd;
00152   int flags;
00153   int openfd;
00154   struct gpfs_file_handle *handle;
00155 };
00156 
00157 struct link_fh_arg
00158 {
00159   int mountdirfd;
00160   int len;
00161   char *name;
00162   struct gpfs_file_handle *dir_fh;
00163   struct gpfs_file_handle *dst_fh;
00164 };
00165 
00166 struct rename_fh_arg
00167 {
00168   int mountdirfd;
00169   int old_len;
00170   char *old_name;
00171   int new_len;
00172   char *new_name;
00173   struct gpfs_file_handle *old_fh;
00174   struct gpfs_file_handle *new_fh;
00175 };
00176 
00177 struct glock
00178 {
00179   int cmd;
00180   int lfd;
00181   void *lock_owner;
00182   struct flock flock;
00183 };
00184 #define GPFS_F_CANCELLK (1024 + 5)   /* Maps to Linux F_CANCELLK */
00185 
00186 struct set_get_lock_arg
00187 {
00188   int mountdirfd;
00189   struct glock *lock;
00190 };
00191 
00192 struct open_share_arg
00193 {
00194   int mountdirfd;
00195   int flags;
00196   int openfd;
00197   struct gpfs_file_handle *handle;
00198   int share_access;
00199   int share_deny;
00200 };
00201 
00202 struct share_reserve_arg
00203 {
00204   int mountdirfd;
00205   int openfd;
00206   int share_access;
00207   int share_deny;
00208 };
00209 
00210 struct close_file_arg
00211 {
00212   int mountdirfd;
00213   int close_fd;
00214   int close_flags;
00215   void *close_owner;
00216 };
00217 
00218 struct link_arg
00219 {
00220   int file_fd;
00221   int dir_fd;
00222   char *name;
00223 };
00224 
00225 struct readlink_arg
00226 {
00227   int fd;
00228   char *buffer;
00229   int size;
00230 };
00231 
00232 struct readlink_fh_arg
00233 {
00234   int mountdirfd;
00235   struct gpfs_file_handle *handle;
00236   char *buffer;
00237   int size;
00238 };
00239 
00240 struct nfsd4_pnfs_deviceid {
00241         unsigned long   sbid;           /* per-superblock unique ID */
00242         unsigned long   devid;          /* filesystem-wide unique device ID */
00243 };
00244 
00245 struct gpfs_exp_xdr_stream {
00246   int *p;
00247   int *end;
00248 };
00249 
00250 enum x_nfsd_fsid {
00251         x_FSID_DEV = 0,
00252         x_FSID_NUM,
00253         x_FSID_MAJOR_MINOR,
00254         x_FSID_ENCODE_DEV,
00255         x_FSID_UUID4_INUM,
00256         x_FSID_UUID8,
00257         x_FSID_UUID16,
00258         x_FSID_UUID16_INUM,
00259         x_FSID_MAX
00260 };
00261 
00262 //#if !defined(NFS4_DEVICEID4_SIZE)
00263 #ifdef P_NFS4
00264 enum x_pnfs_layouttype {
00265         x_LAYOUT_NFSV4_1_FILES  = 1,
00266         x_LAYOUT_OSD2_OBJECTS = 2,
00267         x_LAYOUT_BLOCK_VOLUME = 3,
00268 
00269         x_NFS4_PNFS_PRIVATE_LAYOUT = 0x80000000
00270 };
00271 
00272 /* used for both layout return and recall */
00273 enum x_pnfs_layoutreturn_type {
00274         x_RETURN_FILE = 1,
00275         x_RETURN_FSID = 2,
00276         x_RETURN_ALL  = 3
00277 };
00278 
00279 enum x_pnfs_iomode {
00280         x_IOMODE_READ = 1,
00281         x_IOMODE_RW = 2,
00282         x_IOMODE_ANY = 3,
00283 };
00284 #endif
00285 
00286 enum stable_nfs
00287 {
00288   x_UNSTABLE4 = 0,
00289   x_DATA_SYNC4 = 1,
00290   x_FILE_SYNC4 = 2
00291 };
00292 
00293 struct pnfstime4 {
00294         u_int64_t       seconds;
00295         u_int32_t       nseconds;
00296 };
00297 
00298 struct nfsd4_pnfs_dev_iter_res {
00299         u_int64_t               gd_cookie;      /* request/repsonse */
00300         u_int64_t               gd_verf;        /* request/repsonse */
00301         u_int64_t               gd_devid;       /* response */
00302         u_int32_t               gd_eof;         /* response */
00303 };
00304 
00305 /* Arguments for set_device_notify */
00306 struct pnfs_devnotify_arg {
00307         struct nfsd4_pnfs_deviceid dn_devid;    /* request */
00308         u_int32_t dn_layout_type;               /* request */
00309         u_int32_t dn_notify_types;              /* request/response */
00310 };
00311 
00312 struct nfsd4_layout_seg {
00313         u_int64_t       clientid;
00314         u_int32_t       layout_type;
00315         u_int32_t       iomode;
00316         u_int64_t       offset;
00317         u_int64_t       length;
00318 };
00319 
00320 struct nfsd4_pnfs_layoutget_arg {
00321         u_int64_t               lg_minlength;
00322         u_int64_t               lg_sbid;
00323         struct gpfs_file_handle *lg_fh;
00324 };
00325 
00326 struct nfsd4_pnfs_layoutget_res {
00327         struct nfsd4_layout_seg lg_seg; /* request/resopnse */
00328         u_int32_t               lg_return_on_close;
00329 };
00330 
00331 struct nfsd4_pnfs_layoutcommit_arg {
00332         struct nfsd4_layout_seg lc_seg;         /* request */
00333         u_int32_t               lc_reclaim;     /* request */
00334         u_int32_t               lc_newoffset;   /* request */
00335         u_int64_t               lc_last_wr;     /* request */
00336         struct pnfstime4                lc_mtime;       /* request */
00337         u_int32_t               lc_up_len;      /* layout length */
00338         void                    *lc_up_layout;  /* decoded by callback */
00339 };
00340 
00341 struct nfsd4_pnfs_layoutcommit_res {
00342         u_int32_t               lc_size_chg;    /* boolean for response */
00343         u_int64_t               lc_newsize;     /* response */
00344 };
00345 
00346 struct nfsd4_pnfs_layoutreturn_arg {
00347         u_int32_t               lr_return_type; /* request */
00348         struct nfsd4_layout_seg lr_seg;         /* request */
00349         u_int32_t               lr_reclaim;     /* request */
00350         u_int32_t               lrf_body_len;   /* request */
00351         void                    *lrf_body;      /* request */
00352         void                    *lr_cookie;     /* fs private */
00353 };
00354 
00355 struct x_xdr_netobj {
00356         unsigned int    len;
00357         unsigned char   *data;
00358 };
00359 struct pnfs_filelayout_devaddr {
00360         struct x_xdr_netobj     r_netid;
00361         struct x_xdr_netobj     r_addr;
00362 };
00363 
00364 /* list of multipath servers */
00365 struct pnfs_filelayout_multipath {
00366         u_int32_t                       fl_multipath_length;
00367         struct pnfs_filelayout_devaddr  *fl_multipath_list;
00368 };
00369 
00370 struct pnfs_filelayout_device {
00371         u_int32_t                       fl_stripeindices_length;
00372         u_int32_t                       *fl_stripeindices_list;
00373         u_int32_t                       fl_device_length;
00374         struct pnfs_filelayout_multipath *fl_device_list;
00375 };
00376 
00377 struct pnfs_filelayout_layout {
00378         u_int32_t                        lg_layout_type; /* response */
00379         u_int32_t                        lg_stripe_type; /* response */
00380         u_int32_t                        lg_commit_through_mds; /* response */
00381         u_int64_t                        lg_stripe_unit; /* response */
00382         u_int64_t                        lg_pattern_offset; /* response */
00383         u_int32_t                        lg_first_stripe_index; /* response */
00384         struct nfsd4_pnfs_deviceid      device_id;              /* response */
00385         u_int32_t                        lg_fh_length;          /* response */
00386         struct gpfs_file_handle          *lg_fh_list;           /* response */
00387 };
00388 
00389 enum stripetype4 {
00390         STRIPE_SPARSE = 1,
00391         STRIPE_DENSE = 2
00392 };
00393 
00394 struct deviceinfo_arg
00395 {
00396   int mountdirfd;
00397   int type;
00398   struct nfsd4_pnfs_deviceid devid;
00399   struct gpfs_exp_xdr_stream xdr;
00400 };
00401 
00402 struct layoutget_arg
00403 {
00404   int mountdirfd;
00405   struct gpfs_file_handle *handle;
00406   struct nfsd4_pnfs_layoutget_arg args;
00407   struct pnfs_filelayout_layout *file_layout;
00408   struct gpfs_exp_xdr_stream *xdr;
00409 };
00410 
00411 struct layoutreturn_arg
00412 {
00413   int mountdirfd;
00414   struct gpfs_file_handle *handle;
00415   struct nfsd4_pnfs_layoutreturn_arg args;
00416 };
00417 
00418 struct dsread_arg
00419 {
00420   int mountdirfd;
00421   struct gpfs_file_handle *handle;
00422   char *bufP;
00423   u_int64_t offset;
00424   u_int64_t length;
00425 };
00426 
00427 struct dswrite_arg
00428 {
00429   int mountdirfd;
00430   struct gpfs_file_handle *handle;
00431   char *bufP;
00432   u_int64_t offset;
00433   u_int64_t length;
00434   u_int32_t stability_wanted;
00435   u_int32_t *stability_got;
00436   u_int32_t *verifier4;
00437 };
00438 
00439 struct layoutcommit_arg
00440 {
00441   int mountdirfd;
00442   struct gpfs_file_handle *handle;
00443   u_int64_t offset;
00444   u_int64_t length;
00445   u_int32_t reclaim;      /* True if this is a reclaim commit */
00446   u_int32_t new_offset;   /* True if the client has suggested a new offset */
00447   u_int64_t last_write;   /* The offset of the last byte written, if
00448                                new_offset if set, otherwise undefined. */
00449   u_int32_t time_changed; /* True if the client provided a new value for mtime */
00450   struct gpfs_time_t new_time;  /* If time_changed is true, the client-supplied
00451                                modification tiem for the file.  otherwise, undefined. */
00452   struct gpfs_exp_xdr_stream *xdr;
00453 };
00454 
00455 struct fsync_arg
00456 {
00457   int mountdirfd;
00458   struct gpfs_file_handle *handle;
00459   u_int64_t offset;
00460   u_int64_t length;
00461   u_int32_t *verifier4;
00462 };
00463 
00464 struct stat_arg
00465 {
00466     int mountdirfd;
00467     struct gpfs_file_handle *handle;
00468     struct stat *buf;
00469 };
00470 
00471 struct create_name_arg
00472 {
00473     int mountdirfd;
00474     struct gpfs_file_handle *dir_fh;
00475     u_int32_t dev;
00476     int mode;
00477     int len;
00478     char *name;
00479     struct gpfs_file_handle *new_fh;
00480     struct stat *buf;
00481 };
00482 
00483 struct stat_name_arg
00484 {
00485     int mountdirfd;
00486     int len;
00487     char *name;
00488     struct gpfs_file_handle *handle;
00489     struct stat *buf;
00490 };
00491 
00492 struct callback_arg
00493 {
00494     int mountdirfd;
00495     int *reason;
00496     struct gpfs_file_handle *handle;
00497     struct glock *fl;
00498     int *flags;
00499     struct stat *buf;
00500 };
00501 
00502 /* Defines for the flags in callback_arg, keep up to date with CXIUP_xxx */
00503 #define UP_NLINK        0x00000001   /* update nlink */
00504 #define UP_MODE         0x00000002   /* update mode and ctime */
00505 #define UP_OWN          0x00000004   /* update mode,uid,gid and ctime */
00506 #define UP_SIZE         0x00000008   /* update fsize */
00507 #define UP_SIZE_BIG     0x00000010   /* update fsize if bigger */
00508 #define UP_TIMES        0x00000020   /* update all times */
00509 #define UP_ATIME        0x00000040   /* update atime only */
00510 #define UP_PERM         0x00000080   /* update fields needed for permission checking*/
00511 #define UP_RENAME       0x00000100   /* this is a rename op */
00512 #define UP_DESTROY_FLAG 0x00000200   /* clear destroyIfDelInode flag */
00513 #define UP_GANESHA      0x00000400   /* this is a ganesha op */
00514 
00515 /* reason list for reason in callback_arg */
00516 #define INODE_INVALIDATE        1
00517 #define INODE_UPDATE            2
00518 #define INODE_LOCK_GRANTED      3
00519 #define INODE_LOCK_AGAIN        4
00520 #define THREAD_STOP             5
00521 #define THREAD_PAUSE            6
00522 #define BREAK_DELEGATION        7
00523 #define LAYOUT_FILE_RECALL      8
00524 #define LAYOUT_RECALL_ANY       9
00525 #define LAYOUT_NOTIFY_DEVICEID 10
00526 
00527 /* define flags for attr_valid */
00528 #define XATTR_STAT      (1 << 0)
00529 #define XATTR_ACL       (1 << 1)
00530 
00531 /* define flags for attr_chaged */
00532 #define XATTR_MODE      (1 << 0) //  01
00533 #define XATTR_UID       (1 << 1) //  02
00534 #define XATTR_GID       (1 << 2) //  04
00535 #define XATTR_SIZE      (1 << 3) //  08
00536 #define XATTR_ATIME     (1 << 4) //  10
00537 #define XATTR_MTIME     (1 << 5) //  20
00538 #define XATTR_CTIME     (1 << 6) //  40
00539 #define XATTR_ATIME_SET (1 << 7) //  80
00540 #define XATTR_MTIME_SET (1 << 8) // 100
00541 
00542 struct xstat_arg
00543 {
00544     int attr_valid;
00545     int mountdirfd;
00546     struct gpfs_file_handle *handle;
00547     struct gpfs_acl *acl;
00548     int attr_changed;
00549     struct stat *buf;
00550 };
00551 
00552 struct xstat_access_arg
00553 {
00554     int mountdirfd;
00555     struct gpfs_file_handle *handle;
00556     struct gpfs_acl *acl;
00557     struct xstat_cred_t *cred;
00558     unsigned int posix_mode;
00559     unsigned int access;       /* v4maske */
00560     unsigned int *supported;    
00561 };
00562 
00563 #ifdef __cplusplus
00564 }
00565 #endif
00566 
00567 #endif /* H_GPFS_NFS */