nfs-ganesha 1.4
|
00001 /* */ 00002 /* Copyright (C) 2001 International Business Machines */ 00003 /* All rights reserved. */ 00004 /* */ 00005 /* This file is part of the GPFS user library. */ 00006 /* */ 00007 /* Redistribution and use in source and binary forms, with or without */ 00008 /* modification, are permitted provided that the following conditions */ 00009 /* are met: */ 00010 /* */ 00011 /* 1. Redistributions of source code must retain the above copyright notice, */ 00012 /* this list of conditions and the following disclaimer. */ 00013 /* 2. Redistributions in binary form must reproduce the above copyright */ 00014 /* notice, this list of conditions and the following disclaimer in the */ 00015 /* documentation and/or other materials provided with the distribution. */ 00016 /* 3. The name of the author may not be used to endorse or promote products */ 00017 /* derived from this software without specific prior written */ 00018 /* permission. */ 00019 /* */ 00020 /* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR */ 00021 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES */ 00022 /* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. */ 00023 /* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ 00024 /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */ 00025 /* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; */ 00026 /* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, */ 00027 /* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */ 00028 /* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF */ 00029 /* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 00030 /* */ 00031 /* @(#)42 1.1.9.1 src/avs/fs/mmfs/ts/util/gpfs.h, mmfs, avs_rhrz 4/26/12 10:33:43 */ 00032 /* 00033 * Library calls for GPFS interfaces 00034 */ 00035 #ifndef H_GPFS 00036 #define H_GPFS 00037 00038 #include <stddef.h> 00039 00040 /* Define GPFS_64BIT_INODES to map the default interface definitions 00041 to 64-bit interfaces. Without this define, the 32-bit interface 00042 is the default. Both interfaces are always present, but the 00043 define sets the default. The actual mapping can be found near the 00044 end of this header. */ 00045 /* #define GPFS_64BIT_INODES 1 */ 00046 00047 00048 #ifdef __cplusplus 00049 extern "C" { 00050 #endif 00051 00052 #if defined(WIN32) && (defined(GPFSDLL) || defined(GWIN)) 00053 00054 /* The following errno values either are missing from Windows errno.h or 00055 have a conflicting value. Other errno values (e.g. EPERM) are okay. */ 00056 #define GPFS_EALREADY 37 /* Operation already in progress */ 00057 #define GPFS_EOPNOTSUPP 45 /* Operation not supported */ 00058 #define GPFS_EDQUOT 69 /* Disk quota exceeded */ 00059 #define GPFS_ESTALE 9 /* No filesystem (mapped to EBADF) */ 00060 #define GPFS_EFORMAT 19 /* Unformatted media (mapped to ENODEV) */ 00061 00062 /* specify the library calling convention */ 00063 #define GPFS_API __stdcall 00064 00065 /* On Windows, this is a HANDLE as returned by CreateFile() */ 00066 typedef void* gpfs_file_t; 00067 00068 #else /* not WIN32 */ 00069 00070 #define GPFS_API 00071 /* On UNIX (and Windows SUA) systems, this is a file descriptor as 00072 returned by open() */ 00073 typedef int gpfs_file_t; 00074 00075 #endif 00076 00077 00078 typedef unsigned int gpfs_uid_t; 00079 typedef long long gpfs_off64_t; 00080 typedef unsigned long long gpfs_uid64_t; 00081 00082 typedef struct gpfs_timestruc 00083 { 00084 unsigned int tv_sec; 00085 unsigned int tv_nsec; 00086 } gpfs_timestruc_t; 00087 00088 typedef struct gpfs_timestruc64 00089 { 00090 long long tv_sec; 00091 unsigned int tv_nsec; 00092 } gpfs_timestruc64_t; 00093 00094 #define GPFS_SLITE_SIZE_BIT 0x00000001 00095 #define GPFS_SLITE_BLKSIZE_BIT 0x00000002 00096 #define GPFS_SLITE_BLOCKS_BIT 0x00000004 00097 #define GPFS_SLITE_ATIME_BIT 0x00000010 00098 #define GPFS_SLITE_MTIME_BIT 0x00000020 00099 #define GPFS_SLITE_CTIME_BIT 0x00000040 00100 #define GPFS_SLITE_EXACT_BITS 0x00000077 00101 00102 /* Returns "1" if the attribute is requested to be accurate. 00103 (On output, indicates the value returned in statbufP is accurate). */ 00104 #define GPFS_SLITE(m) (0 == (m)) 00105 #define GPFS_SLITE_SIZET(m) (0 != ((m) & GPFS_SLITE_SIZE_BIT)) 00106 #define GPFS_SLITE_BLKSIZE(m) (0 != ((m) & GPFS_SLITE_BLKSIZE_BIT)) 00107 #define GPFS_SLITE_BLOCKS(m) (0 != ((m) & GPFS_SLITE_BLOCKS_BIT)) 00108 #define GPFS_SLITE_ATIME(m) (0 != ((m) & GPFS_SLITE_ATIME_BIT)) 00109 #define GPFS_SLITE_MTIME(m) (0 != ((m) & GPFS_SLITE_MTIME_BIT)) 00110 #define GPFS_SLITE_CTIME(m) (0 != ((m) & GPFS_SLITE_CTIME_BIT)) 00111 #define GPFS_SLITE_EXACT(m) (GPFS_SLITE_EXACT_BITS == (m)) 00112 00113 /* Sets the litemask bit indicating that the attribute should be accurate */ 00114 #define GPFS_S_SLITE(m) (m) = 0 00115 #define GPFS_S_SLITE_SIZET(m) (m) |= GPFS_SLITE_SIZE_BIT 00116 #define GPFS_S_SLITE_BLKSIZE(m) (m) |= GPFS_SLITE_BLKSIZE_BIT 00117 #define GPFS_S_SLITE_BLOCKS(m) (m) |= GPFS_SLITE_BLOCKS_BIT 00118 #define GPFS_S_SLITE_ATIME(m) (m) |= GPFS_SLITE_ATIME_BIT 00119 #define GPFS_S_SLITE_MTIME(m) (m) |= GPFS_SLITE_MTIME_BIT 00120 #define GPFS_S_SLITE_CTIME(m) (m) |= GPFS_SLITE_CTIME_BIT 00121 #define GPFS_S_SLITE_EXACT(m) (m) |= GPFS_SLITE_EXACT_BITS 00122 00123 #define GPFS_STATLITE 0 00124 #define GPFS_NOFOLLOW 1 00125 00126 /* Mapping of buffer for gpfs_getacl, gpfs_putacl. */ 00127 typedef struct gpfs_opaque_acl 00128 { 00129 int acl_buffer_len; /* INPUT: Total size of buffer (including this field). 00130 OUTPUT: Actual size of the ACL information. */ 00131 unsigned short acl_version; /* INPUT: Set to zero. 00132 OUTPUT: Current version of the returned ACL. */ 00133 unsigned char acl_type; /* INPUT: Type of ACL: access (1) or default (2). */ 00134 char acl_var_data[1]; /* OUTPUT: Remainder of the ACL information. */ 00135 } gpfs_opaque_acl_t; 00136 00137 /* ACL types (acl_type field in gpfs_opaque_acl_t or gpfs_acl_t) */ 00138 #define GPFS_ACL_TYPE_ACCESS 1 00139 #define GPFS_ACL_TYPE_DEFAULT 2 00140 #define GPFS_ACL_TYPE_NFS4 3 00141 00142 /* gpfs_getacl, gpfs_putacl flag indicating structures instead of the 00143 opaque style data normally used. */ 00144 #define GPFS_GETACL_STRUCT 0x00000020 00145 #define GPFS_PUTACL_STRUCT 0x00000020 00146 00147 /* gpfs_getacl, gpfs_putacl flag indicating smbd is the caller */ 00148 #define GPFS_ACL_SAMBA 0x00000040 00149 00150 /* Defined values for gpfs_aclVersion_t */ 00151 #define GPFS_ACL_VERSION_POSIX 1 00152 #define GPFS_ACL_VERSION_NFS4 4 00153 00154 /* Values for gpfs_aclLevel_t */ 00155 #define GPFS_ACL_LEVEL_BASE 0 /* compatible with all acl_version values */ 00156 #define GPFS_ACL_LEVEL_V4FLAGS 1 /* requires GPFS_ACL_VERSION_NFS4 */ 00157 00158 /* Values for gpfs_aceType_t (ACL_VERSION_POSIX) */ 00159 #define GPFS_ACL_USER_OBJ 1 00160 #define GPFS_ACL_GROUP_OBJ 2 00161 #define GPFS_ACL_OTHER 3 00162 #define GPFS_ACL_MASK 4 00163 #define GPFS_ACL_USER 5 00164 #define GPFS_ACL_GROUP 6 00165 00166 /* Values for gpfs_acePerm_t (ACL_VERSION_POSIX) */ 00167 #define ACL_PERM_EXECUTE 001 00168 #define ACL_PERM_WRITE 002 00169 #define ACL_PERM_READ 004 00170 #define ACL_PERM_CONTROL 010 00171 00172 /* Values for gpfs_aceType_t (ACL_VERSION_NFS4) */ 00173 #define ACE4_TYPE_ALLOW 0 00174 #define ACE4_TYPE_DENY 1 00175 #define ACE4_TYPE_AUDIT 2 00176 #define ACE4_TYPE_ALARM 3 00177 00178 /* Values for gpfs_aceFlags_t (ACL_VERSION_NFS4) */ 00179 #define ACE4_FLAG_FILE_INHERIT 0x00000001 00180 #define ACE4_FLAG_DIR_INHERIT 0x00000002 00181 #define ACE4_FLAG_NO_PROPAGATE 0x00000004 00182 #define ACE4_FLAG_INHERIT_ONLY 0x00000008 00183 #define ACE4_FLAG_SUCCESSFUL 0x00000010 00184 #define ACE4_FLAG_FAILED 0x00000020 00185 #define ACE4_FLAG_GROUP_ID 0x00000040 00186 #define ACE4_FLAG_INHERITED 0x00000080 00187 00188 /* GPFS-defined flags. Placed in a seperate ACL field to avoid 00189 ever running into newly defined NFSv4 flags. */ 00190 #define ACE4_IFLAG_SPECIAL_ID 0x80000000 00191 00192 /* Values for gpfs_aceMask_t (ACL_VERSION_NFS4) */ 00193 #define ACE4_MASK_READ 0x00000001 00194 #define ACE4_MASK_LIST_DIR 0x00000001 00195 #define ACE4_MASK_WRITE 0x00000002 00196 #define ACE4_MASK_ADD_FILE 0x00000002 00197 #define ACE4_MASK_APPEND 0x00000004 00198 #define ACE4_MASK_ADD_SUBDIR 0x00000004 00199 #define ACE4_MASK_READ_NAMED 0x00000008 00200 #define ACE4_MASK_WRITE_NAMED 0x00000010 00201 #define ACE4_MASK_EXECUTE 0x00000020 00202 00203 /* The rfc doesn't provide a mask equivalent to "search" ("x" on a 00204 * directory in posix), but it also doesn't say that its EXECUTE 00205 * is to have this dual use (even though it does so for other dual 00206 * use permissions such as read/list. Going to make the assumption 00207 * here that the EXECUTE bit has this dual meaning... otherwise 00208 * we're left with no control over search. 00209 */ 00210 #define ACE4_MASK_SEARCH 0x00000020 00211 00212 #define ACE4_MASK_DELETE_CHILD 0x00000040 00213 #define ACE4_MASK_READ_ATTR 0x00000080 00214 #define ACE4_MASK_WRITE_ATTR 0x00000100 00215 #define ACE4_MASK_DELETE 0x00010000 00216 #define ACE4_MASK_READ_ACL 0x00020000 00217 #define ACE4_MASK_WRITE_ACL 0x00040000 00218 #define ACE4_MASK_WRITE_OWNER 0x00080000 00219 #define ACE4_MASK_SYNCHRONIZE 0x00100000 00220 #define ACE4_MASK_ALL 0x001f01ff 00221 00222 /* Values for gpfs_uid_t (ACL_VERSION_NFS4) */ 00223 #define ACE4_SPECIAL_OWNER 1 00224 #define ACE4_SPECIAL_GROUP 2 00225 #define ACE4_SPECIAL_EVERYONE 3 00226 00227 /* per-ACL flags imported from a Windows security descriptor object */ 00228 #define ACL4_FLAG_OWNER_DEFAULTED 0x00000100 00229 #define ACL4_FLAG_GROUP_DEFAULTED 0x00000200 00230 #define ACL4_FLAG_DACL_PRESENT 0x00000400 00231 #define ACL4_FLAG_DACL_DEFAULTED 0x00000800 00232 #define ACL4_FLAG_SACL_PRESENT 0x00001000 00233 #define ACL4_FLAG_SACL_DEFAULTED 0x00002000 00234 #define ACL4_FLAG_DACL_UNTRUSTED 0x00004000 00235 #define ACL4_FLAG_SERVER_SECURITY 0x00008000 00236 #define ACL4_FLAG_DACL_AUTO_INHERIT_REQ 0x00010000 00237 #define ACL4_FLAG_SACL_AUTO_INHERIT_REQ 0x00020000 00238 #define ACL4_FLAG_DACL_AUTO_INHERITED 0x00040000 00239 #define ACL4_FLAG_SACL_AUTO_INHERITED 0x00080000 00240 #define ACL4_FLAG_DACL_PROTECTED 0x00100000 00241 #define ACL4_FLAG_SACL_PROTECTED 0x00200000 00242 #define ACL4_FLAG_RM_CONTROL_VALID 0x00400000 00243 #define ACL4_FLAG_NULL_DACL 0x00800000 00244 #define ACL4_FLAG_NULL_SACL 0x01000000 00245 #define ACL4_FLAG_VALID_FLAGS 0x01ffff00 00246 00247 00248 /* Externalized ACL defintions */ 00249 typedef unsigned int gpfs_aclType_t; 00250 typedef unsigned int gpfs_aclLen_t; 00251 typedef unsigned int gpfs_aclLevel_t; 00252 typedef unsigned int gpfs_aclVersion_t; 00253 typedef unsigned int gpfs_aclCount_t; 00254 typedef unsigned int gpfs_aclFlag_t; 00255 00256 typedef unsigned int gpfs_aceType_t; 00257 typedef unsigned int gpfs_aceFlags_t; 00258 typedef unsigned int gpfs_acePerm_t; 00259 typedef unsigned int gpfs_aceMask_t; 00260 00261 /* A POSIX ACL Entry */ 00262 typedef struct gpfs_ace_v1 00263 { 00264 gpfs_aceType_t ace_type; /* POSIX ACE type */ 00265 gpfs_uid_t ace_who; /* uid/gid */ 00266 gpfs_acePerm_t ace_perm; /* POSIX permissions */ 00267 } gpfs_ace_v1_t; 00268 00269 /* A NFSv4 ACL Entry */ 00270 typedef struct gpfs_ace_v4 00271 { 00272 gpfs_aceType_t aceType; /* Allow or Deny */ 00273 gpfs_aceFlags_t aceFlags; /* Inherit specifications, etc. */ 00274 gpfs_aceFlags_t aceIFlags; /* GPFS Internal flags */ 00275 gpfs_aceMask_t aceMask; /* NFSv4 mask specification */ 00276 gpfs_uid_t aceWho; /* User/Group identification */ 00277 } gpfs_ace_v4_t; 00278 00279 /* when GPFS_ACL_VERSION_NFS4, and GPFS_ACL_LEVEL_V4FLAGS */ 00280 typedef struct v4Level1_ext /* ACL extension */ 00281 { 00282 gpfs_aclFlag_t acl_flags; /* per-ACL flags */ 00283 gpfs_ace_v4_t ace_v4[1]; 00284 } v4Level1_t; 00285 00286 /* The GPFS ACL */ 00287 typedef struct gpfs_acl 00288 { 00289 gpfs_aclLen_t acl_len; /* Total length of this ACL in bytes */ 00290 gpfs_aclLevel_t acl_level; /* Reserved (must be zero) */ 00291 gpfs_aclVersion_t acl_version; /* POSIX or NFS4 ACL */ 00292 gpfs_aclType_t acl_type; /* Access, Default, or NFS4 */ 00293 gpfs_aclCount_t acl_nace; /* Number of Entries that follow */ 00294 union 00295 { 00296 gpfs_ace_v1_t ace_v1[1]; /* when GPFS_ACL_VERSION_POSIX */ 00297 gpfs_ace_v4_t ace_v4[1]; /* when GPFS_ACL_VERSION_NFS4 */ 00298 v4Level1_t v4Level1; /* when GPFS_ACL_LEVEL_V4FLAGS */ 00299 }; 00300 } gpfs_acl_t; 00301 00302 00303 /* NAME: gpfs_getacl() 00304 * 00305 * FUNCTION: Retrieves the ACL information for a file. 00306 * 00307 * The aclP parameter must point to a buffer mapped by either: 00308 * - gpfs_opaque_acl_t (when flags are zero). In this case, 00309 * the opaque data that is intended to be used by a backup 00310 * program (restoreed by passing this data back on a subsequent 00311 * call to gpfs_putacl). 00312 * - gpfs_acl_t (when GPFS_GETACL_STRUCT is specified). In this 00313 * case, the data can be interpreted by the calling application 00314 * (and may be modified and applied to the file by passing it 00315 * to gpfs_putacl...along with the GPFS_PUTACL_STRUCT flag). 00316 * 00317 * On input, the first four bytes of the buffer must contain its 00318 * total size. 00319 * 00320 * Returns: 0 Successful 00321 * -1 Failure 00322 * 00323 * Errno: ENOSYS function not available 00324 * ENOSPC buffer too small to return the entire ACL. 00325 * Needed size is returned in the first four 00326 * bytes of the buffer pointed to by aclP. 00327 * EINVAL Invalid arguments 00328 * ENOTDIR Not on directory 00329 * ENOMEM Out of memory 00330 */ 00331 int GPFS_API 00332 gpfs_getacl(const char *pathname, 00333 int flags, 00334 void *acl); 00335 00336 00337 /* NAME: gpfs_putacl() 00338 * 00339 * FUNCTION: Sets the ACL information for a file. 00340 * The buffer passed in should contain the ACL data 00341 * that was obtained by a previous call to gpfs_getacl. 00342 * 00343 * Returns: 0 Successful 00344 * -1 Failure 00345 * 00346 * Errno: ENOSYS function not available 00347 * EINVAL Invalid arguments 00348 * ENOTDIR Not on directory 00349 * ENOMEM Out of memory 00350 */ 00351 int GPFS_API 00352 gpfs_putacl(const char *pathname, 00353 int flags, 00354 void *acl); 00355 00356 00357 /* NAME: gpfs_prealloc() 00358 * FUNCTION: Preallocate disk storage for the file handle that has 00359 * already been opened for writing, starting at the specified 00360 * starting offset and covering at least the number of bytes 00361 * requested. Allocations are rounded to block boundaries 00362 * (block size can be found using fstat() in st_blksize.) 00363 * Any existing data already in the file will not be modified. 00364 * Any read of the preallocated blocks will return zeros. 00365 * 00366 * Returns: 0 Successful 00367 * -1 Failure 00368 * 00369 * Errno: ENOSYS No prealloc service available 00370 * EBADF Bad file desc 00371 * EINVAL Not a GPFS file 00372 * EINVAL Not a regular file 00373 * EINVAL StartOffset or BytesToPrealloc < 0 00374 * EACCES File not opened for writing 00375 * EDQUOT Quota exceeded 00376 * ENOSPC Not enough space on disk 00377 */ 00378 int GPFS_API 00379 gpfs_prealloc(gpfs_file_t fileDesc, 00380 gpfs_off64_t startOffset, 00381 gpfs_off64_t bytesToPrealloc); 00382 00383 00384 typedef struct gpfs_winattr 00385 { 00386 gpfs_timestruc_t creationTime; 00387 unsigned int winAttrs; /* values as defined below */ 00388 } gpfs_winattr_t; 00389 00390 /* winAttrs values */ 00391 #define GPFS_WINATTR_ARCHIVE 0x0001 00392 #define GPFS_WINATTR_COMPRESSED 0x0002 00393 #define GPFS_WINATTR_DEVICE 0x0004 00394 #define GPFS_WINATTR_DIRECTORY 0x0008 00395 #define GPFS_WINATTR_ENCRYPTED 0x0010 00396 #define GPFS_WINATTR_HIDDEN 0x0020 00397 #define GPFS_WINATTR_NORMAL 0x0040 00398 #define GPFS_WINATTR_NOT_CONTENT_INDEXED 0x0080 00399 #define GPFS_WINATTR_OFFLINE 0x0100 00400 #define GPFS_WINATTR_READONLY 0x0200 00401 #define GPFS_WINATTR_REPARSE_POINT 0x0400 00402 #define GPFS_WINATTR_SPARSE_FILE 0x0800 00403 #define GPFS_WINATTR_SYSTEM 0x1000 00404 #define GPFS_WINATTR_TEMPORARY 0x2000 00405 #define GPFS_WINATTR_HAS_STREAMS 0x4000 00406 00407 00408 /* NAME: gpfs_get_winattrs() 00409 * gpfs_get_winattrs_path() 00410 * 00411 * FUNCTION: Returns gpfs_winattr_t attributes 00412 * 00413 * Returns: 0 Success 00414 * -1 Failure 00415 * 00416 * Errno: ENOENT file not found 00417 * EBADF Bad file handle, not a GPFS file 00418 * ENOMEM Memory allocation failed 00419 * EACCESS Permission denied 00420 * EFAULT Bad address provided 00421 * EINVAL Not a regular file 00422 * ENOSYS function not available 00423 */ 00424 int GPFS_API 00425 gpfs_get_winattrs(gpfs_file_t fileDesc, gpfs_winattr_t *attrP); 00426 00427 int GPFS_API 00428 gpfs_get_winattrs_path(const char *pathname, gpfs_winattr_t *attrP); 00429 00430 00431 /* NAME: gpfs_set_winattrs() 00432 * gpfs_set_winattrs_path() 00433 * 00434 * FUNCTION: Sets gpfs_winattr_t attributes (as specified by 00435 * the flags). 00436 * 00437 * Returns: 0 Success 00438 * -1 Failure 00439 * 00440 * Errno: ENOENT file not found 00441 * EBADF Bad file handle, not a GPFS file 00442 * ENOMEM Memory allocation failed 00443 * EACCESS Permission denied 00444 * EFAULT Bad address provided 00445 * EINVAL Not a regular file 00446 * ENOSYS function not available 00447 */ 00448 int GPFS_API 00449 gpfs_set_winattrs(gpfs_file_t fileDesc, int flags, gpfs_winattr_t *attrP); 00450 00451 int GPFS_API 00452 gpfs_set_winattrs_path(const char *pathname, int flags, gpfs_winattr_t *attrP); 00453 00454 /* gpfs_set_winattr flag values */ 00455 #define GPFS_WINATTR_SET_CREATION_TIME 0x08 00456 #define GPFS_WINATTR_SET_ATTRS 0x10 00457 00458 /* 00459 * NAME: gpfs_set_times(), gpfs_set_times_path() 00460 * 00461 * FUNCTION: Sets sets file access time, modefied time, change time, 00462 * and/or creation time (as specified by the flags). 00463 * 00464 * Input: flagsfileDesc : file descriptor of the object to set 00465 * pathname : path to a file or directory 00466 * flag : define time value to set 00467 * GPFS_SET_ATIME - set access time 00468 * GPFS_SET_MTIME - set mod. time 00469 * GPFS_SET_CTIME - set change time 00470 * GPFS_SET_CREATION_TIME - set creation time 00471 * times : array to times 00472 * 00473 * Returns: 0 Successful 00474 * -1 Failure 00475 * 00476 * Errno: ENOSYS function not available 00477 * EBADF Not a GPFS File 00478 * EINVAL invalid argument 00479 * EACCES Permission denied 00480 * EROFS Filesystem is read only 00481 * ENOENT No such file or directory 00482 */ 00483 typedef gpfs_timestruc_t gpfs_times_vector_t[4]; 00484 00485 int GPFS_API 00486 gpfs_set_times(gpfs_file_t fileDesc, int flags, gpfs_times_vector_t times); 00487 00488 int GPFS_API 00489 gpfs_set_times_path(char *pathname, int flags, gpfs_times_vector_t times); 00490 00491 /* gpfs_set_times flag values */ 00492 #define GPFS_SET_ATIME 0x01 00493 #define GPFS_SET_MTIME 0x02 00494 #define GPFS_SET_CTIME 0x04 00495 #define GPFS_SET_CREATION_TIME 0x08 00496 00497 00498 /* NAME: gpfs_set_share() 00499 * 00500 * FUNCTION: Acquire shares 00501 * 00502 * Input: fileDesc : file descriptor 00503 * allow : share type being requested 00504 * GPFS_SHARE_NONE, GPFS_SHARE_READ, 00505 * GPFS_SHARE_WRITE, GPFS_SHARE_BOTH 00506 * deny : share type to deny to others 00507 * GPFS_DENY_NONE, GPFS_DENY_READ, 00508 * GPFS_DENY_WRITE, GPFS_DENY_BOTH 00509 * 00510 * Returns: 0 Success 00511 * -1 Failure 00512 * 00513 * Errno: EBADF Bad file handle 00514 * EINVAL Bad argument given 00515 * EFAULT Bad address provided 00516 * ENOMEM Memory allocation failed 00517 * EACCES share mode not available 00518 * ENOSYS function not available 00519 */ 00520 00521 /* allow/deny specifications */ 00522 #define GPFS_SHARE_NONE 0 00523 #define GPFS_SHARE_READ 1 00524 #define GPFS_SHARE_WRITE 2 00525 #define GPFS_SHARE_BOTH 3 00526 #define GPFS_SHARE_ALL 3 00527 #define GPFS_DENY_NONE 0 00528 #define GPFS_DENY_READ 1 00529 #define GPFS_DENY_WRITE 2 00530 #define GPFS_DENY_BOTH 3 00531 #define GPFS_DENY_DELETE 4 00532 #define GPFS_DENY_ALL 7 00533 00534 int GPFS_API 00535 gpfs_set_share(gpfs_file_t fileDesc, 00536 unsigned int share, 00537 unsigned int deny); 00538 00539 00540 /* NAME: gpfs_set_lease() 00541 * 00542 * FUNCTION: Acquire leases for Samba 00543 * 00544 * Input: fileDesc : file descriptor 00545 * leaseType : lease type being requested 00546 * GPFS_LEASE_NONE GPFS_LEASE_READ, 00547 * GPFS_LEASE_WRITE 00548 * 00549 * Returns: 0 Success 00550 * -1 Failure 00551 * 00552 * Errno: EBADF Bad file handle 00553 * EINVAL Bad argument given 00554 * EFAULT Bad address provided 00555 * ENOMEM Memory allocation failed 00556 * EAGAIN lease not available 00557 * EACCES permission denied 00558 * EOPNOTSUPP unsupported leaseType 00559 * ESTALE unmounted filesystem 00560 * ENOSYS function not available 00561 */ 00562 00563 /* leaseType specifications */ 00564 #define GPFS_LEASE_NONE 0 00565 #define GPFS_LEASE_READ 1 00566 #define GPFS_LEASE_WRITE 2 00567 00568 int GPFS_API 00569 gpfs_set_lease(gpfs_file_t fileDesc, 00570 unsigned int leaseType); 00571 00572 00573 /* NAME: gpfs_get_lease() 00574 * 00575 * FUNCTION: Returns the type of lease currently held 00576 * 00577 * Returns: GPFS_LEASE_READ 00578 * GPFS_LEASE_WRITE 00579 * GPFS_LEASE_NONE 00580 * 00581 * Returns: 0 Success 00582 * -1 Failure 00583 * 00584 * Errno: EINVAL 00585 */ 00586 int GPFS_API 00587 gpfs_get_lease(gpfs_file_t fileDesc); 00588 00589 00590 /* NAME: gpfs_get_realfilename(), gpfs_get_realfilename_path() 00591 * 00592 * FUNCTION: Interface to get real name of a file. 00593 * 00594 * INPUT: File descriptor, pathname, buffer, bufferlength 00595 * OUTPUT: Real file name stored in filesystem 00596 * 00597 * Returns: 0 Success 00598 * -1 Failure 00599 * 00600 * Errno: EBADF Bad file handle 00601 * EINVAL Not a regular file 00602 * EFAULT Bad address provided 00603 * ENOSPC buffer too small to return the real file name. 00604 * Needed size is returned in buflen parameter. 00605 * ENOENT File does not exist 00606 * ENOMEM Memory allocation failed 00607 * EACCESS Permission denied 00608 * ENOSYS function not available 00609 */ 00610 int GPFS_API 00611 gpfs_get_realfilename(gpfs_file_t fileDesc, 00612 char *fileNameP, 00613 int *buflen); 00614 00615 int GPFS_API 00616 gpfs_get_realfilename_path(const char *pathname, 00617 char *fileNameP, 00618 int *buflen); 00619 00620 /* NAME: gpfs_ftruncate() 00621 * 00622 * FUNCTION: Interface to truncate a file. 00623 * 00624 * INPUT: File descriptor 00625 * length 00626 * Returns: 0 Successful 00627 * -1 Failure 00628 * 00629 * Errno: ENOSYS function not available 00630 * EBADF Bad file handle 00631 * EBADF Not a GPFS file 00632 * EINVAL Not a regular file 00633 * ENOENT File does not exist 00634 * ENOMEM Memory allocation failed 00635 * EINVAL length < 0 00636 * EACCESS Permission denied 00637 */ 00638 int GPFS_API 00639 gpfs_ftruncate(gpfs_file_t fileDesc, gpfs_off64_t length); 00640 00641 #define GPFS_WIN_CIFS_REGISTERED 0x02000000 00642 typedef struct cifsThreadData_t 00643 { 00644 unsigned int dataLength; /* Total buffer length */ 00645 unsigned int share; /* gpfs_set_share declaration */ 00646 unsigned int deny; /* gpfs_set_share specification */ 00647 unsigned int lease; /* gpfs_set_lease lease type */ 00648 unsigned int secInfoFlags; /* Future use. Must be zero */ 00649 gpfs_uid_t sdUID; /* Owning user */ 00650 gpfs_uid_t sdGID; /* Owning group */ 00651 int shareLocked_fd; /* file descriptor with share locks */ 00652 unsigned int aclLength ; /* Length of the following ACL */ 00653 gpfs_acl_t acl; /* The initial ACL for create/mkdir */ 00654 } cifsThreadData_t; 00655 00656 /* NAME: gpfs_register_cifs_export() 00657 * 00658 * FUNCTION: Register a CIFS export process. 00659 * 00660 * INPUT: implicit use of the process ids 00661 * 00662 * Returns: 0 Successful 00663 * ENOSYS function not available 00664 * EACCES cannot establish credentials 00665 * ENOMEM temporary shortage of memory 00666 * EINVAL prior process/thread registrations exist 00667 * EBADF unable to allocate a file descriptor 00668 */ 00669 int GPFS_API 00670 gpfs_register_cifs_export(); 00671 00672 /* NAME: gpfs_unregister_cifs_export() 00673 * 00674 * FUNCTION: remove a registration for a CIFS export 00675 * 00676 * INPUT: implicit use of the process ids 00677 * 00678 * Returns: 0 Successful 00679 * ENOSYS function not available 00680 * EACCES cannot establish credentials 00681 * ENOMEM temporary shortage of memory 00682 */ 00683 int GPFS_API 00684 gpfs_unregister_cifs_export(); 00685 00686 /* NAME: gpfs_register_cifs_buffer() 00687 * 00688 * FUNCTION: Register a CIFS thread/buffer combination 00689 * 00690 * INPUT: implicit use of the process and thread ids 00691 * Address of a cifsThreadData_t structure that will include 00692 * a GPFS ACL (GPFS_ACL_VERSION_NFS4/GPFS_ACL_LEVEL_V4FLAGS) 00693 * that can be applied at file/dir creation. 00694 * 00695 * Returns: 0 Successful 00696 * ENOSYS function not available 00697 * EACCES cannot establish credentials 00698 * ENOMEM unable to allocate required memory 00699 * EINVAL no associated process registrion exists 00700 * bad dataLength in buffer. 00701 */ 00702 int GPFS_API 00703 gpfs_register_cifs_buffer(cifsThreadData_t *bufP); 00704 00705 /* NAME: gpfs_unregister_cifs_buffer() 00706 * 00707 * FUNCTION: remove a CIFS thread/buffer registration 00708 * 00709 * INPUT: implicit use of the process and thread ids 00710 * 00711 * Returns: 0 Successful 00712 * ENOSYS function not available 00713 * EACCES cannot establish credentials 00714 * ENOMEM unable to allocate required memory 00715 * EINVAL no associated process registrion exists 00716 */ 00717 int GPFS_API 00718 gpfs_unregister_cifs_buffer(); 00719 00720 /* NAME: gpfs_lib_init() 00721 * 00722 * FUNCTION: Open GPFS main module device file 00723 * 00724 * INPUT: Flags 00725 * Returns: 0 Successful 00726 * -1 Failure 00727 * 00728 * Errno: ENOSYS Function not available 00729 */ 00730 int GPFS_API 00731 gpfs_lib_init(int flags); 00732 00733 /* NAME: gpfs_lib_term() 00734 * 00735 * FUNCTION: Close GPFS main module device file 00736 * 00737 * INPUT: Flags 00738 * Returns: 0 Successful 00739 * -1 Failure 00740 * 00741 * Errno: ENOSYS Function not available 00742 */ 00743 int GPFS_API 00744 gpfs_lib_term(int flags); 00745 00746 /* Define maximum length of the name for a GPFS named object, such 00747 as a snapshot, storage pool or fileset. The name is a null-terminated 00748 character string, which is not include in the max length */ 00749 #define GPFS_MAXNAMLEN 255 00750 00751 /* Define maximum length of the path to a GPFS named object 00752 such as a snapshot or fileset. If the absolute path name exceeds 00753 this limit, then use a relative path name. The path is a null-terminated 00754 character string, which is not included in the max length */ 00755 #define GPFS_MAXPATHLEN 1023 00756 00757 /* ASCII code for "GPFS" in the struct statfs f_type field */ 00758 #define GPFS_SUPER_MAGIC 0x47504653 00759 00760 /* GPFS inode attributes 00761 gpfs_uid_t - defined above 00762 gpfs_uid64_t - defined above 00763 gpfs_off64_t - defined above */ 00764 typedef unsigned int gpfs_mode_t; 00765 typedef unsigned int gpfs_gid_t; 00766 typedef unsigned long long gpfs_gid64_t; 00767 typedef unsigned int gpfs_ino_t; 00768 typedef unsigned long long gpfs_ino64_t; 00769 typedef unsigned int gpfs_gen_t; 00770 typedef unsigned long long gpfs_gen64_t; 00771 typedef unsigned int gpfs_dev_t; 00772 typedef unsigned int gpfs_mask_t; 00773 typedef unsigned int gpfs_pool_t; 00774 typedef unsigned int gpfs_snapid_t; 00775 typedef unsigned long long gpfs_snapid64_t; 00776 typedef unsigned long long gpfs_fsid64_t[2]; 00777 typedef short gpfs_nlink_t; 00778 typedef long long gpfs_nlink64_t; 00779 00780 00781 #if defined(WIN32) || defined(_MS_SUA_) 00782 typedef struct gpfs_stat64 00783 { 00784 gpfs_dev_t st_dev; /* id of device containing file */ 00785 gpfs_ino64_t st_ino; /* file inode number */ 00786 gpfs_mode_t st_mode; /* access mode */ 00787 gpfs_nlink64_t st_nlink; /* number of links */ 00788 unsigned int st_flags; /* flag word */ 00789 gpfs_uid64_t st_uid; /* owner uid */ 00790 gpfs_gid64_t st_gid; /* owner gid */ 00791 gpfs_dev_t st_rdev; /* device id (if special file) */ 00792 gpfs_off64_t st_size; /* file size in bytes */ 00793 gpfs_timestruc64_t st_atime; /* time of last access */ 00794 gpfs_timestruc64_t st_mtime; /* time of last data modification */ 00795 gpfs_timestruc64_t st_ctime; /* time of last status change */ 00796 int st_blksize; /* preferred block size for io */ 00797 gpfs_off64_t st_blocks; /* 512 byte blocks of disk held by file */ 00798 long long st_fsid; /* file system id */ 00799 unsigned int st_type; /* file type */ 00800 gpfs_gen64_t st_gen; /* inode generation number */ 00801 gpfs_timestruc64_t st_createtime; /* time of creation */ 00802 unsigned int st_attrs; /* Window's flags */ 00803 } gpfs_stat64_t; 00804 #else 00805 typedef struct stat64 gpfs_stat64_t; 00806 #endif 00807 00808 #if defined(WIN32) || defined(_MS_SUA_) 00809 typedef struct gpfs_statfs64 00810 { 00811 gpfs_off64_t f_blocks; /* total data blocks in file system */ 00812 gpfs_off64_t f_bfree; /* free block in fs */ 00813 gpfs_off64_t f_bavail; /* free blocks avail to non-superuser */ 00814 int f_bsize; /* optimal file system block size */ 00815 gpfs_ino64_t f_files; /* total file nodes in file system */ 00816 gpfs_ino64_t f_ffree; /* free file nodes in fs */ 00817 gpfs_fsid64_t f_fsid; /* file system id */ 00818 int f_fsize; /* fundamental file system block size */ 00819 int f_sector_size; /* logical disk sector size */ 00820 char f_fname[32]; /* file system name (usually mount pt.) */ 00821 char f_fpack[32]; /* file system pack name */ 00822 int f_name_max; /* maximum component name length for posix */ 00823 } gpfs_statfs64_t; 00824 #else 00825 typedef struct statfs64 gpfs_statfs64_t; 00826 #endif 00827 00828 /* Declarations for backwards compatibility. */ 00829 typedef gpfs_stat64_t stat64_t; 00830 typedef gpfs_statfs64_t statfs64_t; 00831 00832 00833 /* Define a version number for the directory entry data to allow 00834 future changes in this structure. Careful callers should also use 00835 the d_reclen field for the size of the structure rather than sizeof, 00836 to allow some degree of forward compatibility */ 00837 #define GPFS_D_VERSION 1 00838 00839 typedef struct gpfs_direntx 00840 { 00841 int d_version; /* this struct's version */ 00842 unsigned short d_reclen; /* actual size of this struct including 00843 null terminated variable length d_name */ 00844 unsigned short d_type; /* Types are defined below */ 00845 gpfs_ino_t d_ino; /* File inode number */ 00846 gpfs_gen_t d_gen; /* Generation number for the inode */ 00847 char d_name[256]; /* null terminated variable length name */ 00848 } gpfs_direntx_t; 00849 00850 00851 #define GPFS_D64_VERSION 2 00852 00853 typedef struct gpfs_direntx64 00854 { 00855 int d_version; /* this struct's version */ 00856 unsigned short d_reclen; /* actual size of this struct including 00857 null terminated variable length d_name */ 00858 unsigned short d_type; /* Types are defined below */ 00859 gpfs_ino64_t d_ino; /* File inode number */ 00860 gpfs_gen64_t d_gen; /* Generation number for the inode */ 00861 unsigned int d_flags; /* Flags are defined below */ 00862 char d_name[1028]; /* null terminated variable length name */ 00863 /* (1020+null+7 byte pad to double word) */ 00864 /* to handle up to 255 UTF-8 chars */ 00865 } gpfs_direntx64_t; 00866 00867 /* File types for d_type field in gpfs_direntx_t */ 00868 #define GPFS_DE_OTHER 0 00869 #define GPFS_DE_DIR 4 00870 #define GPFS_DE_REG 8 00871 #define GPFS_DE_LNK 10 00872 #define GPFS_DE_DEL 16 00873 00874 /* Define flags for gpfs_direntx64_t */ 00875 #define GPFS_DEFLAG_NONE 0x0000 /* Default value, no flags set */ 00876 #define GPFS_DEFLAG_JUNCTION 0x0001 /* DirEnt is a fileset junction */ 00877 #define GPFS_DEFLAG_IJUNCTION 0x0002 /* DirEnt is a inode space junction */ 00878 #define GPFS_DEFLAG_ORPHAN 0x0004 /* DirEnt is an orphan (pcache) */ 00879 00880 00881 /* Define a version number for the iattr data to allow future changes 00882 in this structure. Careful callers should also use the ia_reclen field 00883 for the size of the structure rather than sizeof, to allow some degree 00884 of forward compatibility */ 00885 #define GPFS_IA_VERSION 1 00886 #define GPFS_IA64_VERSION 2 00887 #define GPFS_IA64_RESERVED 4 00888 #define GPFS_IA64_UNUSED 10 00889 00890 typedef struct gpfs_iattr 00891 { 00892 int ia_version; /* this struct version */ 00893 int ia_reclen; /* sizeof this structure */ 00894 int ia_checksum; /* validity check on iattr struct */ 00895 gpfs_mode_t ia_mode; /* access mode */ 00896 gpfs_uid_t ia_uid; /* owner uid */ 00897 gpfs_gid_t ia_gid; /* owner gid */ 00898 gpfs_ino_t ia_inode; /* file inode number */ 00899 gpfs_gen_t ia_gen; /* inode generation number */ 00900 gpfs_nlink_t ia_nlink; /* number of links */ 00901 short ia_flags; /* Flags (defined below) */ 00902 int ia_blocksize; /* preferred block size for io */ 00903 gpfs_mask_t ia_mask; /* Initial attribute mask (not used) */ 00904 unsigned int ia_pad1; /* reserved space */ 00905 gpfs_off64_t ia_size; /* file size in bytes */ 00906 gpfs_off64_t ia_blocks; /* 512 byte blocks of disk held by file */ 00907 gpfs_timestruc_t ia_atime; /* time of last access */ 00908 gpfs_timestruc_t ia_mtime; /* time of last data modification */ 00909 gpfs_timestruc_t ia_ctime; /* time of last status change */ 00910 gpfs_dev_t ia_rdev; /* id of device */ 00911 unsigned int ia_xperm; /* extended attributes (defined below) */ 00912 unsigned int ia_modsnapid; /* snapshot id of last modification */ 00913 unsigned int ia_filesetid; /* fileset ID */ 00914 unsigned int ia_datapoolid; /* storage pool ID for data */ 00915 unsigned int ia_pad2; /* reserved space */ 00916 00917 } gpfs_iattr_t; 00918 00919 00920 typedef struct gpfs_iattr64 00921 { 00922 int ia_version; /* this struct version */ 00923 int ia_reclen; /* sizeof this structure */ 00924 int ia_checksum; /* validity check on iattr struct */ 00925 gpfs_mode_t ia_mode; /* access mode */ 00926 gpfs_uid64_t ia_uid; /* owner uid */ 00927 gpfs_gid64_t ia_gid; /* owner gid */ 00928 gpfs_ino64_t ia_inode; /* file inode number */ 00929 gpfs_gen64_t ia_gen; /* inode generation number */ 00930 gpfs_nlink64_t ia_nlink; /* number of links */ 00931 gpfs_off64_t ia_size; /* file size in bytes */ 00932 gpfs_off64_t ia_blocks; /* 512 byte blocks of disk held by file */ 00933 gpfs_timestruc64_t ia_atime; /* time of last access */ 00934 unsigned int ia_winflags; /* window's flags (defined below) */ 00935 unsigned int ia_pad1; /* reserved space */ 00936 gpfs_timestruc64_t ia_mtime; /* time of last data modification */ 00937 unsigned int ia_flags; /* flags (defined below) */ 00938 int ia_pad2; /* reserved space */ 00939 gpfs_timestruc64_t ia_ctime; /* time of last status change */ 00940 int ia_blocksize; /* preferred block size for io */ 00941 unsigned int ia_pad3; /* reserved space */ 00942 gpfs_timestruc64_t ia_createtime; /* creation time */ 00943 gpfs_mask_t ia_mask; /* initial attribute mask (not used) */ 00944 int ia_pad4; /* reserved space */ 00945 unsigned int ia_reserved[GPFS_IA64_RESERVED]; /* reserved space */ 00946 unsigned int ia_xperm; /* extended attributes (defined below) */ 00947 gpfs_dev_t ia_dev; /* id of device containing file */ 00948 gpfs_dev_t ia_rdev; /* device id (if special file) */ 00949 unsigned int ia_pcacheflags; /* pcache inode bits */ 00950 gpfs_snapid64_t ia_modsnapid; /* snapshot id of last modification */ 00951 unsigned int ia_filesetid; /* fileset ID */ 00952 unsigned int ia_datapoolid; /* storage pool ID for data */ 00953 gpfs_ino64_t ia_inode_space_mask; /* inode space mask of this file system */ 00954 /* This value is saved in the iattr structure 00955 during backup and used during restore */ 00956 unsigned int ia_unused[GPFS_IA64_UNUSED]; /* reserved space */ 00957 } gpfs_iattr64_t; 00958 00959 /* Define flags for inode attributes */ 00960 #define GPFS_IAFLAG_SNAPDIR 0x0001 /* (obsolete) */ 00961 #define GPFS_IAFLAG_USRQUOTA 0x0002 /* inode is a user quota file */ 00962 #define GPFS_IAFLAG_GRPQUOTA 0x0004 /* inode is a group quota file */ 00963 #define GPFS_IAFLAG_ERROR 0x0008 /* error reading inode */ 00964 /* Define flags for inode replication attributes */ 00965 #define GPFS_IAFLAG_FILESET_ROOT 0x0010 /* root dir of a fileset */ 00966 #define GPFS_IAFLAG_NO_SNAP_RESTORE 0x0020 /* don't restore from snapshots */ 00967 #define GPFS_IAFLAG_FILESETQUOTA 0x0040 /* inode is a fileset quota file */ 00968 #define GPFS_IAFLAG_COMANAGED 0x0080 /* file data is co-managed */ 00969 #define GPFS_IAFLAG_ILLPLACED 0x0100 /* may not be properly placed */ 00970 #define GPFS_IAFLAG_REPLMETA 0x0200 /* metadata replication set */ 00971 #define GPFS_IAFLAG_REPLDATA 0x0400 /* data replication set */ 00972 #define GPFS_IAFLAG_EXPOSED 0x0800 /* may have data on suspended disks */ 00973 #define GPFS_IAFLAG_ILLREPLICATED 0x1000 /* may not be properly replicated */ 00974 #define GPFS_IAFLAG_UNBALANCED 0x2000 /* may not be properly balanced */ 00975 #define GPFS_IAFLAG_DATAUPDATEMISS 0x4000 /* has stale data blocks on 00976 unavailable disk */ 00977 #define GPFS_IAFLAG_METAUPDATEMISS 0x8000 /* has stale metadata on 00978 unavailable disk */ 00979 00980 #define GPFS_IAFLAG_IMMUTABLE 0x00010000 /* Immutability */ 00981 #define GPFS_IAFLAG_INDEFRETENT 0x00020000 /* Indefinite retention */ 00982 #define GPFS_IAFLAG_SECUREDELETE 0x00040000 /* Secure deletion */ 00983 00984 #define GPFS_IAFLAG_TRUNCMANAGED 0x00080000 /* dmapi truncate event enabled */ 00985 #define GPFS_IAFLAG_READMANAGED 0x00100000 /* dmapi read event enabled */ 00986 #define GPFS_IAFLAG_WRITEMANAGED 0x00200000 /* dmapi write event enabled */ 00987 00988 #define GPFS_IAFLAG_APPENDONLY 0x00400000 /* AppendOnly only */ 00989 00990 /* Define flags for window's attributes */ 00991 #define GPFS_IWINFLAG_ARCHIVE 0x0001 /* Archive */ 00992 #define GPFS_IWINFLAG_HIDDEN 0x0002 /* Hidden */ 00993 #define GPFS_IWINFLAG_NOTINDEXED 0x0004 /* Not content indexed */ 00994 #define GPFS_IWINFLAG_OFFLINE 0x0008 /* Off-line */ 00995 #define GPFS_IWINFLAG_READONLY 0x0010 /* Read-only */ 00996 #define GPFS_IWINFLAG_REPARSE 0x0020 /* Reparse point */ 00997 #define GPFS_IWINFLAG_SYSTEM 0x0040 /* System */ 00998 #define GPFS_IWINFLAG_TEMPORARY 0x0080 /* Temporary */ 00999 #define GPFS_IWINFLAG_COMPRESSED 0x0100 /* Compressed */ 01000 #define GPFS_IWINFLAG_ENCRYPTED 0x0200 /* Encrypted */ 01001 #define GPFS_IWINFLAG_SPARSE 0x0400 /* Sparse file */ 01002 #define GPFS_IWINFLAG_HASSTREAMS 0x0800 /* Has streams */ 01003 01004 /* Define flags for extended attributes */ 01005 #define GPFS_IAXPERM_ACL 0x0001 /* file has acls */ 01006 #define GPFS_IAXPERM_XATTR 0x0002 /* file has extended attributes */ 01007 #define GPFS_IAXPERM_DMATTR 0x0004 /* file has dm attributes */ 01008 #define GPFS_IAXPERM_DOSATTR 0x0008 /* file has non-default dos attrs */ 01009 #define GPFS_IAXPERM_RPATTR 0x0010 /* file has restore policy attrs */ 01010 01011 /* Define flags for pcache bits defined in the inode */ 01012 #define GPFS_ICAFLAG_CACHED 0x0001 // "cached complete" 01013 #define GPFS_ICAFLAG_CREATE 0x0002 // "created" 01014 #define GPFS_ICAFLAG_DIRTY 0x0004 // "data dirty" 01015 #define GPFS_ICAFLAG_LINK 0x0008 // "hard linked" 01016 #define GPFS_ICAFLAG_SETATTR 0x0010 // "attr changed" 01017 #define GPFS_ICAFLAG_LOCAL 0x0020 // "local" 01018 #define GPFS_ICAFLAG_APPEND 0x0040 // "append" 01019 #define GPFS_ICAFLAG_STATE 0x0080 // "has remote state" 01020 01021 /* Define pointers to interface types */ 01022 typedef struct gpfs_fssnap_handle gpfs_fssnap_handle_t; 01023 typedef struct gpfs_iscan gpfs_iscan_t; 01024 typedef struct gpfs_ifile gpfs_ifile_t; 01025 typedef struct gpfs_restore gpfs_restore_t; 01026 01027 typedef struct gpfs_fssnap_id 01028 { 01029 char opaque[48]; 01030 } gpfs_fssnap_id_t; 01031 01032 01033 /* Define extended return codes for gpfs backup & restore 01034 calls without an explicit return code will return the value in errno */ 01035 #define GPFS_ERRNO_BASE 190 01036 #define GPFS_E_INVAL_FSSNAPID (GPFS_ERRNO_BASE+0) /* invalid fssnap id */ 01037 #define GPFS_E_INVAL_ISCAN (GPFS_ERRNO_BASE+1) /* invalid iscan pointer */ 01038 #define GPFS_E_INVAL_IFILE (GPFS_ERRNO_BASE+2) /* invalid ifile pointer */ 01039 #define GPFS_E_INVAL_IATTR (GPFS_ERRNO_BASE+3) /* invalid iattr structure */ 01040 #define GPFS_E_INVAL_RESTORE (GPFS_ERRNO_BASE+4) /* invalid restore pointer */ 01041 #define GPFS_E_INVAL_FSSNAPHANDLE (GPFS_ERRNO_BASE+5) /* invalid fssnap handle */ 01042 #define GPFS_E_INVAL_SNAPNAME (GPFS_ERRNO_BASE+6) /* invalid snapshot name */ 01043 #define GPFS_E_FS_NOT_RESTORABLE (GPFS_ERRNO_BASE+7) /* FS is not clean */ 01044 #define GPFS_E_RESTORE_NOT_ENABLED (GPFS_ERRNO_BASE+8) /* Restore was not enabled */ 01045 #define GPFS_E_RESTORE_STARTED (GPFS_ERRNO_BASE+9) /* Restore is running */ 01046 #define GPFS_E_INVAL_XATTR (GPFS_ERRNO_BASE+10) /* invalid extended 01047 attribute pointer */ 01048 01049 /* Define flags parameter for get/put file attributes. 01050 Used by gpfs_fgetattr, gpfs_fputattr, gpfs_fputattrwithpath 01051 and gpfs_igetattrsx, gpfs_iputattrsx 01052 */ 01053 #define GPFS_ATTRFLAG_DEFAULT 0x0000 /* default behavior */ 01054 #define GPFS_ATTRFLAG_NO_PLACEMENT 0x0001 /* exclude file placement attributes */ 01055 #define GPFS_ATTRFLAG_IGNORE_POOL 0x0002 /* saved poolid is not valid */ 01056 #define GPFS_ATTRFLAG_USE_POLICY 0x0004 /* use restore policy rules to 01057 determine poolid */ 01058 #define GPFS_ATTRFLAG_INCL_DMAPI 0x0008 /* Include dmapi attributes */ 01059 #define GPFS_ATTRFLAG_FINALIZE_ATTRS 0x0010 /* Finalize immutability attributes */ 01060 #define GPFS_ATTRFLAG_SKIP_IMMUTABLE 0x0020 /* Skip immutable attributes */ 01061 01062 /* Define structure used by gpfs_statfspool */ 01063 typedef struct gpfs_statfspool_s 01064 { 01065 gpfs_off64_t f_blocks; /* total data blocks in pool */ 01066 gpfs_off64_t f_bfree; /* free blocks in pool */ 01067 gpfs_off64_t f_bavail; /* free blocks avail to non-superuser */ 01068 gpfs_off64_t f_mblocks; /* total metadata blocks in pool */ 01069 gpfs_off64_t f_mfree; /* free blocks avail for system metadata */ 01070 int f_bsize; /* optimal storage pool block size */ 01071 int f_files; /* total file nodes assigned to pool */ 01072 gpfs_pool_t f_poolid; /* storage pool id */ 01073 int f_fsize; /* fundamental file system block size */ 01074 unsigned int f_usage; /* data and/or metadata stored in pool */ 01075 int f_reserved[7];/* Current unused and set to zero */ 01076 } gpfs_statfspool_t; 01077 01078 #define STATFSPOOL_USAGE_DATA 0x0001 /* Pool stores user data */ 01079 #define STATFSPOOL_USAGE_METADATA 0x0002 /* Pool stores system metadata */ 01080 01081 01082 /* NAME: gpfs_fstat(), gpfs_stat() 01083 * 01084 * FUNCTION: Get exact stat information for a file descriptor (or filename). 01085 * Forces all other nodes to flush dirty data and metadata to disk. 01086 * Returns: 0 Successful 01087 * -1 Failure 01088 * 01089 * Errno: ENOSYS function not available 01090 * EBADF Bad file desc 01091 * EINVAL Not a GPFS file 01092 * ESTALE cached fs information was invalid 01093 */ 01094 int GPFS_API 01095 gpfs_fstat(gpfs_file_t fileDesc, 01096 gpfs_stat64_t *buffer); 01097 01098 int GPFS_API 01099 gpfs_stat(const char *pathname, /* File pathname */ 01100 gpfs_stat64_t *buffer); 01101 01102 /* NAME: gpfs_statfs64() 01103 * 01104 * FUNCTION: Get information about the file system. 01105 * 01106 * Returns: 0 Successful 01107 * -1 Failure 01108 * 01109 * Errno: ENOSYS function not available 01110 * EBADF Bad file desc 01111 * EINVAL Not a GPFS file 01112 * ESTALE cached fs information was invalid 01113 */ 01114 int GPFS_API 01115 gpfs_statfs64(const char *pathname, /* File pathname */ 01116 gpfs_statfs64_t *buffer); 01117 01118 /* NAME: gpfs_statlite() 01119 * gpfs_lstatlite() - do not follow a symlink at the end of the path 01120 * 01121 * FUNCTION: Returns stat() information with specified accuracy 01122 * 01123 * Input: pathname : path to a file or directory 01124 * 01125 * In/Out: st_litemaskP: bitmask specification of required accuracy 01126 * statbufP : buffer for returned stat information 01127 * 01128 * Returns: 0 Successful 01129 * -1 Failure 01130 * 01131 * Errno: Specific error indication 01132 * EINVAL 01133 * 01134 */ 01135 int GPFS_API 01136 gpfs_statlite(const char *pathname, 01137 unsigned int *st_litemaskP, 01138 gpfs_stat64_t *statbufP); 01139 01140 int GPFS_API 01141 gpfs_lstatlite(const char *pathname, 01142 unsigned int *st_litemaskP, 01143 gpfs_stat64_t *statbufP); 01144 01145 01146 /* NAME: gpfs_fgetattrs() 01147 * 01148 * FUNCTION: Retrieves all extended file attributes in opaque format. 01149 * This function together with gpfs_fputattrs is intended for 01150 * use by a backup program to save (gpfs_fgetattrs) and 01151 * restore (gpfs_fputattrs) all extended file attributes 01152 * (ACLs, user attributes, ...) in one call. 01153 * 01154 * NOTE: This call does not return extended attributes used for 01155 * the Data Storage Management (XDSM) API (aka DMAPI). 01156 * 01157 * Input: flags Define behavior of get attributes 01158 * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes for placement 01159 * are not saved, neither is the current storage pool. 01160 * GPFS_ATTRFLAG_IGNORE_POOL - file attributes for placement 01161 * are saved, but the current storage pool is not. 01162 * 01163 * Returns: 0 Successful 01164 * -1 Failure 01165 * 01166 * Errno: ENOSYS function not available 01167 * EINVAL Not a GPFS file 01168 * EINVAL invalid flags provided 01169 * ENOSPC buffer too small to return all attributes 01170 * *attrSizeP will be set to the size necessary 01171 */ 01172 int GPFS_API 01173 gpfs_fgetattrs(gpfs_file_t fileDesc, 01174 int flags, 01175 void *bufferP, 01176 int bufferSize, 01177 int *attrSizeP); 01178 01179 01180 /* NAME: gpfs_fputattrs() 01181 * 01182 * FUNCTION: Sets all extended file attributes of a file 01183 * and sets the file's storage pool and data replication 01184 * to the values saved in the extended attributes. 01185 * 01186 * If the saved storage pool is not valid or if the IGNORE_POOL 01187 * flag is set, then it will select the storage pool by matching 01188 * a PLACEMENT rule using the saved file attributes. 01189 * If it fails to match a placement rule or if there are 01190 * no placement rules installed it will assign the file 01191 * to the "system" storage pool. 01192 * 01193 * The buffer passed in should contain extended attribute data 01194 * that was obtained by a previous call to gpfs_fgetattrs. 01195 * 01196 * Input: flags Define behavior of put attributes 01197 * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes are restored 01198 * but the storage pool and data replication are unchanged 01199 * GPFS_ATTRFLAG_IGNORE_POOL - file attributes are restored 01200 * but the storage pool and data replication are selected 01201 * by matching the saved attributes to a placement rule 01202 * instead of restoring the saved storage pool. 01203 * 01204 * Returns: 0 Successful 01205 * -1 Failure 01206 * 01207 * Errno: ENOSYS function not available 01208 * EINVAL Not a GPFS file 01209 * EINVAL the buffer does not contain valid attribute data 01210 * EINVAL invalid flags provided 01211 */ 01212 int GPFS_API 01213 gpfs_fputattrs(gpfs_file_t fileDesc, 01214 int flags, 01215 void *bufferP); 01216 01217 01218 /* NAME: gpfs_fputattrswithpathname() 01219 * 01220 * FUNCTION: Sets all extended file attributes of a file and invokes 01221 * the policy engine to match a RESTORE rule using the file's 01222 * attributes saved in the extended attributes to set the 01223 * file's storage pool and data replication. The caller should 01224 * include the full path to the file, including the file name, 01225 * to allow rule selection based on file name or path. 01226 * 01227 * If the file fails to match a RESTORE rule, or if there are 01228 * no RESTORE rules installed, then the storage pool and data 01229 * replication are selected as when calling gpfs_fputattrs(). 01230 * 01231 * The buffer passed in should contain extended attribute data 01232 * that was obtained by a previous call to gpfs_fgetattrs. 01233 * 01234 * pathName is a UTF-8 encoded string. On Windows, applications 01235 * can convert UTF-16 ("Unicode") to UTF-8 using the platforms 01236 * WideCharToMultiByte function. 01237 * 01238 * 01239 * Input: flags Define behavior of put attributes 01240 * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes are restored 01241 * but the storage pool and data replication are unchanged 01242 * GPFS_ATTRFLAG_IGNORE_POOL - file attributes are restored 01243 * but if the file fails to match a RESTORE rule, it 01244 * ignore the saved storage pool and select a pool 01245 * by matching the saved attributes to a PLACEMENT rule. 01246 * GPFS_ATTRFLAG_SKIP_IMMUTABLE - Skip immutable/appendOnly flags 01247 * before restoring file data. Then use GPFS_ATTRFLAG_FINALIZE_ATTRS 01248 * to restore immutable/appendOnly flags after data is restored. 01249 * GPFS_ATTRFLAG_FINALIZE_ATTRS - file attributes that are restored 01250 * after data is retored. If file is immutable/appendOnly 01251 * call without this flag before restoring data 01252 * then call with this flag after restoring data 01253 * 01254 * Returns: 0 Successful 01255 * -1 Failure 01256 * 01257 * Errno: ENOSYS function not available 01258 * EINVAL Not a GPFS file 01259 * EINVAL the buffer does not contain valid attribute data 01260 * ENOENT invalid pathname 01261 * EINVAL invalid flags provided 01262 */ 01263 int GPFS_API 01264 gpfs_fputattrswithpathname(gpfs_file_t fileDesc, 01265 int flags, 01266 void *bufferP, 01267 const char *pathName); 01268 01269 01270 /* NAME: gpfs_get_fssnaphandle_by_path() 01271 * 01272 * FUNCTION: Get a volatile handle to uniquely identify a filesystem 01273 * and snapshot by the path to the file system and snapshot 01274 * 01275 * Input: pathName: path to a file or directory in a gpfs file system 01276 * or to one of its snapshots 01277 * 01278 * Returns: pointer to gpfs_fssnap_handle_t (Successful) 01279 * NULL and errno is set (Failure) 01280 * 01281 * Errno: ENOSYS function not available 01282 * EINVAL Not a GPFS file 01283 * ENOENT invalid pathname 01284 * see system calls open(), fstatfs(), and malloc() ERRORS 01285 */ 01286 gpfs_fssnap_handle_t * GPFS_API 01287 gpfs_get_fssnaphandle_by_path(const char *pathName); 01288 01289 01290 /* NAME: gpfs_get_fssnaphandle_by_name() 01291 * 01292 * FUNCTION: Get a volatile handle to uniquely identify a filesystem 01293 * and snapshot by the file system name and snapshot name. 01294 * 01295 * Input: fsName: unique name for gpfs file system (may be specified 01296 * as fsName or /dev/fsName) 01297 * snapName: name for snapshot within that file system 01298 * or NULL to access the active file system rather 01299 * than a snapshot within the file system. 01300 * 01301 * Returns: pointer to gpfs_fssnap_handle_t (Successful) 01302 * NULL and errno is set (Failure) 01303 * 01304 * Errno: ENOSYS function not available 01305 * ENOENT invalid file system name 01306 * GPFS_E_INVAL_SNAPNAME invalid snapshot name 01307 * see system calls open(), fstatfs(), and malloc() ERRORS 01308 */ 01309 gpfs_fssnap_handle_t * GPFS_API 01310 gpfs_get_fssnaphandle_by_name(const char *fsName, 01311 const char *snapName); 01312 01313 01314 /* NAME: gpfs_get_fssnaphandle_by_fssnapid() 01315 * 01316 * FUNCTION: Get a volatile handle to uniquely identify a filesystem 01317 * and snapshot by a fssnapId created from a previous handle. 01318 * 01319 * Input: fssnapId: unique id for a file system and snapshot 01320 * 01321 * Returns: pointer to gpfs_fssnap_handle_t (Successful) 01322 * NULL and errno is set (Failure) 01323 * 01324 * Errno: ENOSYS function not available 01325 * GPFS_E_INVAL_FSSNAPID invalid snapshot id 01326 * see system calls open(), fstatfs(), and malloc() ERRORS 01327 */ 01328 gpfs_fssnap_handle_t * GPFS_API 01329 gpfs_get_fssnaphandle_by_fssnapid(const gpfs_fssnap_id_t *fssnapId); 01330 01331 /* NAME: gpfs_get_fset_snaphandle_by_path() 01332 * 01333 * FUNCTION: Get a volatile handle to uniquely identify an inode space within a 01334 * filesyetsm and snapshot by the path to the file system and snapshot. 01335 * 01336 * Input: pathName: path to a file or directory in a gpfs file system 01337 * or to one of its snapshots 01338 * 01339 * Returns: pointer to gpfs_fssnap_handle_t (Successful) 01340 * NULL and errno is set (Failure) 01341 * 01342 * Errno: ENOSYS function not available 01343 * EINVAL Not a GPFS file 01344 * ENOENT invalid pathname 01345 * see system calls open(), fstatfs(), and malloc() ERRORS 01346 */ 01347 gpfs_fssnap_handle_t * GPFS_API 01348 gpfs_get_fset_snaphandle_by_path(const char *pathName); 01349 01350 /* NAME: gpfs_get_fset_snaphandle_by_name() 01351 * 01352 * FUNCTION: Get a volatile handle to uniquely identify an inode space within a 01353 * filesystem and snapshot by the independent fileset name, file system 01354 * name and snapshot name. 01355 * 01356 * Input: fsName: unique name for gpfs file system (may be specified 01357 * as fsName or /dev/fsName) 01358 * fsetName name of the independent fileset that owns the inode space 01359 * snapName: name for snapshot within that file system 01360 * or NULL to access the active file system rather 01361 * than a snapshot within the file system. 01362 * 01363 * Returns: pointer to gpfs_fssnap_handle_t (Successful) 01364 * NULL and errno is set (Failure) 01365 * 01366 * Errno: ENOSYS function not available 01367 * ENOENT invalid file system name 01368 * GPFS_E_INVAL_FSETNAME invalid fset nsmae 01369 * GPFS_E_INVAL_SNAPNAME invalid snapshot name 01370 * see system calls open(), fstatfs(), and malloc() ERRORS 01371 */ 01372 gpfs_fssnap_handle_t * GPFS_API 01373 gpfs_get_fset_snaphandle_by_name(const char *fsName, 01374 const char *fsetName, 01375 const char *snapName); 01376 01377 /* NAME: gpfs_get_fset_snaphandle_by_fset_snapid() 01378 * 01379 * FUNCTION: Get a volatile handle to uniquely identify a filesystem 01380 * and snapshot by a fssnapId created from a previous handle. 01381 * 01382 * Input: fssnapId: unique id for a file system and snapshot 01383 * 01384 * Returns: pointer to gpfs_fssnap_handle_t (Successful) 01385 * NULL and errno is set (Failure) 01386 * 01387 * Errno: ENOSYS function not available 01388 * GPFS_E_INVAL_FSSNAPID invalid snapshot id 01389 * see system calls open(), fstatfs(), and malloc() ERRORS 01390 */ 01391 gpfs_fssnap_handle_t * GPFS_API 01392 gpfs_get_fset_snaphandle_by_fset_snapid(const gpfs_fssnap_id_t *fsetsnapId); 01393 01394 /* NAME: gpfs_get_pathname_from_fssnaphandle() 01395 * 01396 * FUNCTION: Get the mountpoint and path to a file system 01397 * and snapshot identified by a fssnapHandle 01398 * 01399 * Input: fssnapHandle: ptr to file system & snapshot handle 01400 * 01401 * Returns: ptr to path name to the file system (Successful) 01402 * NULL and errno is set (Failure) 01403 * 01404 * Errno: ENOSYS function not available 01405 * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle 01406 */ 01407 const char * GPFS_API 01408 gpfs_get_pathname_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle); 01409 01410 01411 /* NAME: gpfs_get_fsname_from_fssnaphandle() 01412 * 01413 * FUNCTION: Get the unique name for the file system 01414 * identified by a fssnapHandle 01415 * 01416 * Input: fssnapHandle: ptr to file system & snapshot handle 01417 * 01418 * Returns: ptr to name of the file system (Successful) 01419 * NULL and errno is set (Failure) 01420 * 01421 * Errno: ENOSYS function not available 01422 * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle 01423 */ 01424 const char * GPFS_API 01425 gpfs_get_fsname_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle); 01426 01427 01428 /* NAME: gpfs_get_snapname_from_fssnaphandle() 01429 * 01430 * FUNCTION: Get the name for the snapshot 01431 * uniquely identified by a fssnapHandle 01432 * 01433 * Input: fssnapHandle: ptr to file system & snapshot handle 01434 * 01435 * Returns: ptr to name assigned to the snapshot (Successful) 01436 * NULL and errno is set (Failure) 01437 * 01438 * Errno: ENOSYS function not available 01439 * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle 01440 * GPFS_E_INVAL_SNAPNAME snapshot has been deleted 01441 * 01442 * Notes: If the snapshot has been deleted from the file system 01443 * the snapId may still be valid, but the call will fail 01444 * with errno set to GPFS_E_INVAL_SNAPNAME. 01445 */ 01446 const char * GPFS_API 01447 gpfs_get_snapname_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle); 01448 01449 01450 /* NAME: gpfs_get_snapid_from_fssnaphandle() 01451 * 01452 * FUNCTION: Get the numeric id for the snapshot identified 01453 * by a fssnapHandle. The snapshots define an ordered 01454 * sequence of changes to each file. The file's iattr 01455 * structure defines the snapshot id in which the file 01456 * was last modified (ia_modsnapid). This numeric value 01457 * can be compared to the numeric snapid from a fssnaphandle 01458 * to determine if the file changed before or after the 01459 * snapshot identified by the fssnaphandle. 01460 * 01461 * Input: fssnapHandle: ptr to file system & snapshot handle 01462 * 01463 * Returns: Numeric id for the snapshot referred to by the fssnaphandle 01464 * 0 if the fssnaphandle does not refer to a snapshot 01465 * -1 and errno is set (Failure) 01466 * 01467 * Errno: ENOSYS function not available 01468 * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle 01469 * 01470 * Notes: The snapshot need not be on-line to determine the 01471 * snapshot's numeric id. 01472 */ 01473 gpfs_snapid_t GPFS_API 01474 gpfs_get_snapid_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle); 01475 01476 gpfs_snapid64_t GPFS_API 01477 gpfs_get_snapid_from_fssnaphandle64(gpfs_fssnap_handle_t *fssnapHandle); 01478 01479 01480 /* NAME: gpfs_get_fssnapid_from_fssnaphandle() 01481 * 01482 * FUNCTION: Get a unique, non-volatile file system and snapshot id 01483 * for the file system and snapshot identified by a 01484 * volatile fssnap handle. 01485 * 01486 * Input: fssnapHandle: ptr to file system & snapshot handle 01487 * fssnapId: returned fssnapId uniquely identifying the 01488 * file system and snapshot being scanned 01489 * 01490 * Returns: 0 and fssnapId is set with id (Successful) 01491 * -1 and errno is set (Failure) 01492 * 01493 * Errno: GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle 01494 * EINVAL null ptr given for returned fssnapId 01495 * EFAULT size mismatch for fssnapId 01496 */ 01497 int GPFS_API 01498 gpfs_get_fssnapid_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle, 01499 gpfs_fssnap_id_t *fssnapId); 01500 01501 01502 /* NAME: gpfs_get_restore_fssnapid_from_fssnaphandle() 01503 * 01504 * FUNCTION: Get the unique, non-volatile file system and snapshot id 01505 * used for the last complete restore of a mirrored file 01506 * system. The file system must been a previous restore 01507 * target and ready for additional incremental restore. 01508 * 01509 * Input: fssnapHandle: ptr to file system & snapshot handle 01510 * fssnapId: returned fssnapId uniquely identifying the 01511 * last complete restored file system. 01512 * 01513 * Returns: 0 and fssnapId is set with id (Successful) 01514 * -1 and errno is set (Failure) 01515 * 01516 * Errno: GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle 01517 * EINVAL null ptr given for returned fssnapId 01518 * EFAULT size mismatch for fssnapId 01519 * EPERM caller must have superuser privilege 01520 * ENOMEM unable to allocate memory for request 01521 * GPFS_E_FS_NOT_RESTORABLE fs is not clean for restore 01522 */ 01523 int GPFS_API 01524 gpfs_get_restore_fssnapid_from_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle, 01525 gpfs_fssnap_id_t *fssnapId); 01526 01527 /* NAME: gpfs_free_fssnaphandle() 01528 * 01529 * FUNCTION: Free a fssnapHandle 01530 * 01531 * Input: fssnapHandle: ptr to file system & snapshot handle 01532 * 01533 * Returns: void 01534 * 01535 * Errno: None 01536 */ 01537 void GPFS_API 01538 gpfs_free_fssnaphandle(gpfs_fssnap_handle_t *fssnapHandle); 01539 01540 /* NAME: gpfs_get_snapdirname() 01541 * 01542 * FUNCTION: Get the name of the directory containing snapshots. 01543 * 01544 * Input: fssnapHandle: handle for the file system 01545 * snapdirName: buffer into which the name of the snapshot 01546 * directory will be copied 01547 * bufLen: the size of the provided buffer 01548 * 01549 * Returns: 0 (Successful) 01550 * -1 and errno is set (Failure) 01551 * 01552 * Errno: ENOSYS function not available 01553 * EPERM caller must have superuser privilege 01554 * ESTALE cached fs information was invalid 01555 * ENOMEM unable to allocate memory for request 01556 * GPFS_E_INVAL_FSSNAPHANDLE fssnapHandle is invalid 01557 * E2BIG buffer too small to return the snapshot directory name 01558 */ 01559 int GPFS_API 01560 gpfs_get_snapdirname(gpfs_fssnap_handle_t *fssnapHandle, 01561 char *snapdirName, 01562 int bufLen); 01563 01564 01565 /* NAME: gpfs_open_inodescan() 01566 * 01567 * FUNCTION: Open inode file for inode scan. 01568 * 01569 * Input: fssnapHandle: handle for file system and snapshot 01570 * to be scanned 01571 * prev_fssnapId: if NULL, all inodes of existing file will 01572 * be returned; if non-null, only returns inodes of files 01573 * that have changed since the specified previous snapshot 01574 * maxIno: if non-null, returns the maximum inode number 01575 * available in the inode file being scanned. 01576 * 01577 * Returns: pointer to gpfs_iscan_t (Successful) 01578 * NULL and errno is set (Failure) 01579 * 01580 * Errno: ENOSYS function not available 01581 * EINVAL bad parameters 01582 * EPERM caller must have superuser privilege 01583 * ESTALE cached fs information was invalid 01584 * ENOMEM unable to allocate memory for request 01585 * GPFS_E_INVAL_FSSNAPHANDLE fssnapHandle is invalid 01586 * GPFS_E_INVAL_FSSNAPID prev_fssnapId is invalid 01587 * EDOM prev_fssnapId is from a different fs 01588 * ERANGE prev_fssnapId is same as or more recent than snapId 01589 * being scanned 01590 * see system calls dup() and malloc() ERRORS 01591 */ 01592 gpfs_iscan_t * GPFS_API 01593 gpfs_open_inodescan(gpfs_fssnap_handle_t *fssnapHandle, 01594 const gpfs_fssnap_id_t *prev_fssnapId, 01595 gpfs_ino_t *maxIno); 01596 01597 gpfs_iscan_t * GPFS_API 01598 gpfs_open_inodescan64(gpfs_fssnap_handle_t *fssnapHandle, 01599 const gpfs_fssnap_id_t *prev_fssnapId, 01600 gpfs_ino64_t *maxIno); 01601 01602 01603 /* NAME: gpfs_open_inodescan_with_xattrs() 01604 * 01605 * FUNCTION: Open inode file and extended attributes for an inode scan 01606 * 01607 * Input: fssnapHandle: handle for file system and snapshot 01608 * to be scanned 01609 * prev_fssnapId: if NULL, all inodes of existing file will 01610 * be returned; if non-null, only returns inodes of files 01611 * that have changed since the specified previous snapshot 01612 * nxAttrs: count of extended attributes to be returned. 01613 * if nxAttrs is set to 0, call returns no extended 01614 * attributes, like gpfs_open_inodescan. 01615 * if nxAttrs is set to -1, call returns all extended attributes 01616 * xAttrList: pointer to array of pointers to names of extended 01617 * attribute to be returned. nxAttrList may be null if nxAttrs 01618 * is set to 0 or -1. 01619 * maxIno: if non-null, returns the maximum inode number 01620 * available in the inode file being scanned. 01621 * 01622 * Returns: pointer to gpfs_iscan_t (Successful) 01623 * NULL and errno is set (Failure) 01624 * 01625 * Errno: ENOSYS function not available 01626 * EINVAL bad parameters 01627 * EPERM caller must have superuser privilege 01628 * ESTALE cached fs information was invalid 01629 * ENOMEM unable to allocate memory for request 01630 * GPFS_E_INVAL_FSSNAPHANDLE fssnapHandle is invalid 01631 * GPFS_E_INVAL_FSSNAPID prev_fssnapId is invalid 01632 * EDOM prev_fssnapId is from a different fs 01633 * ERANGE prev_fssnapId is same as or more recent than snapId 01634 * being scanned 01635 * see system calls dup() and malloc() ERRORS 01636 */ 01637 gpfs_iscan_t * GPFS_API 01638 gpfs_open_inodescan_with_xattrs(gpfs_fssnap_handle_t *fssnapHandle, 01639 const gpfs_fssnap_id_t *prev_fssnapId, 01640 int nxAttrs, 01641 const char *xattrsList[], 01642 gpfs_ino_t *maxIno); 01643 01644 gpfs_iscan_t * GPFS_API 01645 gpfs_open_inodescan_with_xattrs64(gpfs_fssnap_handle_t *fssnapHandle, 01646 const gpfs_fssnap_id_t *prev_fssnapId, 01647 int nxAttrs, 01648 const char *xattrList[], 01649 gpfs_ino64_t *maxIno); 01650 01651 01652 /* NAME: gpfs_next_inode() 01653 * 01654 * FUNCTION: Get next inode from inode scan. Scan terminates before 01655 * the last inode specified or the last inode in the 01656 * inode file being scanned. 01657 * 01658 * Input: iscan: ptr to inode scan descriptor 01659 * termIno: scan terminates before this inode number 01660 * caller may specify maxIno from gpfs_open_inodescan() 01661 * or 0 to scan the entire inode file. 01662 * iattr: pointer to returned pointer to file's iattr. 01663 * 01664 * Returns: 0 and *iattr set to point to gpfs_iattr_t (Successful) 01665 * 0 and *iattr set to NULL for no more inodes before termIno 01666 * -1 and errno is set (Failure) 01667 * 01668 * Errno: ENOSYS function not available 01669 * EPERM caller must have superuser privilege 01670 * ESTALE cached fs information was invalid 01671 * ENOMEM buffer too small 01672 * GPFS_E_INVAL_ISCAN bad parameters 01673 * 01674 * Notes: The data returned by gpfs_next_inode() is overwritten by 01675 * subsequent calls to gpfs_next_inode() or gpfs_seek_inode(). 01676 * 01677 * The termIno parameter provides a means to partition an 01678 * inode scan such that it may be executed on more than one node. 01679 */ 01680 int GPFS_API 01681 gpfs_next_inode(gpfs_iscan_t *iscan, 01682 gpfs_ino_t termIno, 01683 const gpfs_iattr_t **iattr); 01684 01685 int GPFS_API 01686 gpfs_next_inode64(gpfs_iscan_t *iscan, 01687 gpfs_ino64_t termIno, 01688 const gpfs_iattr64_t **iattr); 01689 01690 01691 /* NAME: gpfs_next_inode_with_xattrs() 01692 * 01693 * FUNCTION: Get next inode and its extended attributes from the inode scan. 01694 * The set of extended attributes returned were defined when 01695 * the inode scan was opened. The scan terminates before the last 01696 * inode specified or the last inode in the inode file being 01697 * scanned. 01698 * 01699 * Input: iscan: ptr to inode scan descriptor 01700 * termIno: scan terminates before this inode number 01701 * caller may specify maxIno from gpfs_open_inodescan() 01702 * or 0 to scan the entire inode file. 01703 * iattr: pointer to returned pointer to file's iattr. 01704 * xattrBuf: pointer to returned pointer to xattr buffer 01705 * xattrBufLen: returned length of xattr buffer 01706 * 01707 * 01708 * Returns: 0 and *iattr set to point to gpfs_iattr_t (Successful) 01709 * 0 and *iattr set to NULL for no more inodes before termIno 01710 * -1 and errno is set (Failure) 01711 * 01712 * Errno: ENOSYS function not available 01713 * EPERM caller must have superuser privilege 01714 * ESTALE cached fs information was invalid 01715 * EFAULT buffer data was overwritten 01716 * ENOMEM buffer too small 01717 * GPFS_E_INVAL_ISCAN bad parameters 01718 * GPFS_E_INVAL_XATTR bad parameters 01719 * 01720 * Notes: The data returned by gpfs_next_inode() is overwritten by 01721 * subsequent calls to gpfs_next_inode(), gpfs_seek_inode() 01722 * or gpfs_stat_inode(). 01723 * 01724 * The termIno parameter provides a means to partition an 01725 * inode scan such that it may be executed on more than one node. 01726 * 01727 * The returned values for xattrBuf and xattrBufLen must be 01728 * provided to gpfs_next_xattr() to obtain the extended attribute 01729 * names and values. The buffer used for the extended attributes 01730 * is overwritten by subsequent calls to gpfs_next_inode(), 01731 * gpfs_seek_inode() or gpfs_stat_inode(); 01732 * 01733 * The returned pointers to the extended attribute name and value 01734 * will be aligned to a double-word boundary. 01735 */ 01736 int GPFS_API 01737 gpfs_next_inode_with_xattrs(gpfs_iscan_t *iscan, 01738 gpfs_ino_t termIno, 01739 const gpfs_iattr_t **iattr, 01740 const char **xattrBuf, 01741 unsigned int *xattrBufLen); 01742 01743 int GPFS_API 01744 gpfs_next_inode_with_xattrs64(gpfs_iscan_t *iscan, 01745 gpfs_ino64_t termIno, 01746 const gpfs_iattr64_t **iattr, 01747 const char **xattrBuf, 01748 unsigned int *xattrBufLen); 01749 01750 01751 /* NAME: gpfs_next_xattr() 01752 * 01753 * FUNCTION: Iterate over the extended attributes buffer returned 01754 * by get_next_inode_with_xattrs to return the individual 01755 * attributes and their values. Note that the attribute names 01756 * are null-terminated strings, whereas the atttribute value 01757 * contains binary data. 01758 * 01759 * Input: iscan: ptr to inode scan descriptor 01760 * xattrBufLen: ptr to attribute buffer length 01761 * xattrBuf: ptr to the ptr to the attribute buffer 01762 * 01763 * Returns: 0 and *name set to point attribue name (Successful) 01764 * also sets: *valueLen to length of attribute value 01765 * *value to point to attribute value 01766 * *xattrBufLen to remaining length of buffer 01767 * **xattrBuf to index next attribute in buffer 01768 * 0 and *name set to NULL for no more attributes in buffer 01769 * also sets: *valueLen to 0 01770 * *value to NULL 01771 * *xattrBufLen to 0 01772 * **xattrBuf to NULL 01773 * -1 and errno is set (Failure) 01774 * 01775 * Errno: ENOSYS function not available 01776 * GPFS_E_INVAL_ISCAN invalid iscan parameter 01777 * GPFS_E_INVAL_XATTR invalid xattr parameters 01778 * 01779 * Notes: The caller is not allowed to modify the returned attribute 01780 * names or values. The data returned by gpfs_next_attribute() 01781 * may be overwritten by subsequent calls to gpfs_next_attribute() 01782 * or other gpfs library calls. 01783 */ 01784 int GPFS_API 01785 gpfs_next_xattr(gpfs_iscan_t *iscan, 01786 const char **xattrBuf, 01787 unsigned int *xattrBufLen, 01788 const char **name, 01789 unsigned int *valueLen, 01790 const char **value); 01791 01792 01793 01794 /* NAME: gpfs_seek_inode() 01795 * 01796 * FUNCTION: Seek to a given inode number. 01797 * 01798 * Input: iscan: ptr to inode scan descriptor 01799 * ino: next inode number to be scanned 01800 * 01801 * Returns: 0 Successful 01802 * -1 Failure and errno is set 01803 * 01804 * Errno: ENOSYS function not available 01805 * GPFS_E_INVAL_ISCAN bad parameters 01806 */ 01807 int GPFS_API 01808 gpfs_seek_inode(gpfs_iscan_t *iscan, 01809 gpfs_ino_t ino); 01810 01811 int GPFS_API 01812 gpfs_seek_inode64(gpfs_iscan_t *iscan, 01813 gpfs_ino64_t ino); 01814 01815 01816 /* NAME: gpfs_stat_inode() 01817 * NAME: gpfs_stat_inode_with_xattrs() 01818 * 01819 * FUNCTION: Seek to the specified inode and get that inode and 01820 * its extended attributes from the inode scan. This is 01821 * simply a combination of gpfs_seek_inode and get_next_inode 01822 * but will only return the specified inode. 01823 * 01824 * Input: iscan: ptr to inode scan descriptor 01825 * ino: inode number to be returned 01826 * termIno: prefetch inodes up to this inode 01827 * caller may specify maxIno from gpfs_open_inodescan() 01828 * or 0 to allow prefetching over the entire inode file. 01829 * iattr: pointer to returned pointer to file's iattr. 01830 * xattrBuf: pointer to returned pointer to xattr buffer 01831 * xattrBufLen: returned length of xattr buffer 01832 * 01833 * Returns: 0 and *iattr set to point to gpfs_iattr_t (Successful) 01834 * 0 and *iattr set to NULL for no more inodes before termIno 01835 * or if requested inode does not exist. 01836 * -1 and errno is set (Failure) 01837 * 01838 * Errno: ENOSYS function not available 01839 * EPERM caller must have superuser privilege 01840 * ESTALE cached fs information was invalid 01841 * ENOMEM buffer too small 01842 * GPFS_E_INVAL_ISCAN bad parameters 01843 * 01844 * Notes: The data returned by gpfs_next_inode() is overwritten by 01845 * subsequent calls to gpfs_next_inode(), gpfs_seek_inode() 01846 * or gpfs_stat_inode(). 01847 * 01848 * The termIno parameter provides a means to partition an 01849 * inode scan such that it may be executed on more than one node. 01850 * It is only used by this call to control prefetching. 01851 * 01852 * The returned values for xattrBuf and xattrBufLen must be 01853 * provided to gpfs_next_xattr() to obtain the extended attribute 01854 * names and values. The buffer used for the extended attributes 01855 * is overwritten by subsequent calls to gpfs_next_inode(), 01856 * gpfs_seek_inode() or gpfs_stat_inode(); 01857 */ 01858 int GPFS_API 01859 gpfs_stat_inode(gpfs_iscan_t *iscan, 01860 gpfs_ino_t ino, 01861 gpfs_ino_t termIno, 01862 const gpfs_iattr_t **iattr); 01863 01864 int GPFS_API 01865 gpfs_stat_inode64(gpfs_iscan_t *iscan, 01866 gpfs_ino64_t ino, 01867 gpfs_ino64_t termIno, 01868 const gpfs_iattr64_t **iattr); 01869 01870 int GPFS_API 01871 gpfs_stat_inode_with_xattrs(gpfs_iscan_t *iscan, 01872 gpfs_ino_t ino, 01873 gpfs_ino_t termIno, 01874 const gpfs_iattr_t **iattr, 01875 const char **xattrBuf, 01876 unsigned int *xattrBufLen); 01877 01878 int GPFS_API 01879 gpfs_stat_inode_with_xattrs64(gpfs_iscan_t *iscan, 01880 gpfs_ino64_t ino, 01881 gpfs_ino64_t termIno, 01882 const gpfs_iattr64_t **iattr, 01883 const char **xattrBuf, 01884 unsigned int *xattrBufLen); 01885 01886 01887 /* NAME: gpfs_close_inodescan() 01888 * 01889 * FUNCTION: Close inode file. 01890 * 01891 * Input: iscan: ptr to inode scan descriptor 01892 * 01893 * Returns: void 01894 * 01895 * Errno: None 01896 */ 01897 void GPFS_API 01898 gpfs_close_inodescan(gpfs_iscan_t *iscan); 01899 01900 01901 /* NAME: gpfs_cmp_fssnapid() 01902 * 01903 * FUNCTION: Compare two fssnapIds for the same file system to 01904 * determine the order in which the two snapshots were taken. 01905 * The 'result' variable will be set as follows: 01906 * *result < 0: snapshot 1 was taken before snapshot 2 01907 * *result == 0: snapshot 1 and 2 are the same 01908 * *result > 0: snapshot 1 was taken after snapshot 2 01909 * 01910 * Input: fssnapId1: ptr to fssnapId 1 01911 * fssnapId2: ptr to fssnapId id 2 01912 * result: ptr to returned results 01913 * 01914 * Returns: 0 and *result is set as described above (Successful) 01915 * -1 and errno is set (Failure) 01916 * 01917 * Errno: ENOSYS function not available 01918 * GPFS_E_INVAL_FSSNAPID fssnapid1 or fssnapid2 is not a 01919 * valid snapshot id 01920 * EDOM the two snapshots cannot be compared because 01921 * they were taken from two different file systems. 01922 */ 01923 int GPFS_API 01924 gpfs_cmp_fssnapid(const gpfs_fssnap_id_t *fssnapId1, 01925 const gpfs_fssnap_id_t *fssnapId2, 01926 int *result); 01927 01928 01929 /* NAME: gpfs_iopen() 01930 * 01931 * FUNCTION: Open a file or directory by inode number. 01932 * 01933 * Input: fssnapHandle: handle for file system and snapshot 01934 * being scanned 01935 * ino: inode number 01936 * open_flags: O_RDONLY for gpfs_iread() 01937 * O_WRONLY for gpfs_iwrite() 01938 * O_CREAT create the file if it doesn't exist 01939 * O_TRUNC if the inode already exists delete it 01940 * caller may use GPFS_O_BACKUP to read files for backup 01941 * and GPFS_O_RESTORE to write files for restore 01942 * statxbuf: used only with O_CREAT/GPFS_O_BACKUP 01943 * all other cases set to NULL 01944 * symLink: used only with O_CREAT/GPFS_O_BACKUP for a symbolic link 01945 * all other cases set to NULL 01946 * 01947 * Returns: pointer to gpfs_ifile_t (Successful) 01948 * NULL and errno is set (Failure) 01949 * 01950 * Errno: ENOSYS function not available 01951 * EINVAL missing or bad parameter 01952 * EPERM caller must have superuser privilege 01953 * ESTALE cached fs information was invalid 01954 * ENOMEM unable to allocate memory for request 01955 * EFORMAT invalid fs version number 01956 * EIO error reading original inode 01957 * ERANGE error ino is out of range, should use gpfs_iopen64 01958 * GPFS_E_INVAL_IATTR iattr structure was corrupted 01959 * see dup() and malloc() ERRORS 01960 */ 01961 gpfs_ifile_t * GPFS_API 01962 gpfs_iopen(gpfs_fssnap_handle_t *fssnapHandle, 01963 gpfs_ino_t ino, 01964 int open_flags, 01965 const gpfs_iattr_t *statxbuf, 01966 const char *symLink); 01967 01968 gpfs_ifile_t * GPFS_API 01969 gpfs_iopen64(gpfs_fssnap_handle_t *fssnapHandle, 01970 gpfs_ino64_t ino, 01971 int open_flags, 01972 const gpfs_iattr64_t *statxbuf, 01973 const char *symLink); 01974 01975 01976 /* Define gpfs_iopen flags as used by the backup & restore by inode. 01977 The backup code will only read the source files. 01978 The restore code writes the target files & creates them if they 01979 don't already exist. The file length is set by the inode attributes. 01980 Consequently, to restore a user file it is unnecessary to include 01981 the O_TRUNC flag. */ 01982 #define GPFS_O_BACKUP (O_RDONLY) 01983 #define GPFS_O_RESTORE (O_WRONLY | O_CREAT) 01984 01985 01986 /* NAME: gpfs_iread() 01987 * 01988 * FUNCTION: Read file opened by gpfs_iopen. 01989 * 01990 * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen 01991 * buffer: buffer for data to be read 01992 * bufferSize: size of buffer (ie amount of data to be read) 01993 * In/Out offset: offset of where within the file to read 01994 * if successful, offset will be updated to the 01995 * next byte after the last one that was read 01996 * 01997 * Returns: number of bytes read (Successful) 01998 * -1 and errno is set (Failure) 01999 * 02000 * Errno: ENOSYS function not available 02001 * EISDIR file is a directory 02002 * EPERM caller must have superuser privilege 02003 * ESTALE cached fs information was invalid 02004 * GPFS_E_INVAL_IFILE bad ifile parameters 02005 * see system call read() ERRORS 02006 */ 02007 int GPFS_API 02008 gpfs_iread(gpfs_ifile_t *ifile, 02009 void *buffer, 02010 int bufferSize, 02011 gpfs_off64_t *offset); 02012 02013 02014 /* NAME: gpfs_iwrite() 02015 * 02016 * FUNCTION: Write file opened by gpfs_iopen. 02017 * 02018 * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen 02019 * buffer: the data to be written 02020 * writeLen: how much to write 02021 * In/Out offset: offset of where within the file to write 02022 * if successful, offset will be updated to the 02023 * next byte after the last one that was written 02024 * 02025 * Returns: number of bytes written (Successful) 02026 * -1 and errno is set (Failure) 02027 * 02028 * Errno: ENOSYS function not available 02029 * EISDIR file is a directory 02030 * EPERM caller must have superuser privilege 02031 * ESTALE cached fs information was invalid 02032 * GPFS_E_INVAL_IFILE bad ifile parameters 02033 * see system call write() ERRORS 02034 */ 02035 int GPFS_API 02036 gpfs_iwrite(gpfs_ifile_t *ifile, 02037 void *buffer, 02038 int writeLen, 02039 gpfs_off64_t *offset); 02040 02041 02042 /* NAME: gpfs_ireaddir() 02043 * 02044 * FUNCTION: Get next directory entry. 02045 * 02046 * Input: idir: pointer to gpfs_ifile_t from gpfs_iopen 02047 * dirent: pointer to returned pointer to directory entry 02048 * 02049 * Returns: 0 and pointer to gpfs_direntx set (Successful) 02050 * 0 and pointer to gpfs_direntx set to NULL (End of directory) 02051 * -1 and errno is set (Failure) 02052 * 02053 * Errno: ENOSYS function not available 02054 * ENOTDIR file is not a directory 02055 * EPERM caller must have superuser privilege 02056 * ESTALE cached fs information was invalid 02057 * GPFS_E_INVAL_IFILE bad ifile parameter 02058 * ENOMEM unable to allocate memory for request 02059 * 02060 * Notes: The data returned by gpfs_ireaddir() is overwritten by 02061 * subsequent calls to gpfs_ireaddir(). 02062 */ 02063 int GPFS_API 02064 gpfs_ireaddir(gpfs_ifile_t *idir, 02065 const gpfs_direntx_t **dirent); 02066 02067 int GPFS_API 02068 gpfs_ireaddir64(gpfs_ifile_t *idir, 02069 const gpfs_direntx64_t **dirent); 02070 02071 02072 int GPFS_API 02073 gpfs_ireaddirx(gpfs_ifile_t *idir, 02074 gpfs_iscan_t *iscan, /* in only */ 02075 const gpfs_direntx_t **dirent); 02076 02077 int GPFS_API 02078 gpfs_ireaddirx64(gpfs_ifile_t *idir, 02079 gpfs_iscan_t *iscan, /* in only */ 02080 const gpfs_direntx64_t **dirent); 02081 02082 02083 /* NAME: gpfs_iwritedir() 02084 * 02085 * FUNCTION: Create a directory entry in a directory opened by gpfs_iopen. 02086 * 02087 * Input: idir: pointer to gpfs_ifile_t from gpfs_iopen 02088 * dirent: directory entry to be written 02089 * 02090 * Returns: 0 (Successful) 02091 * -1 and errno is set (Failure) 02092 * 02093 * Errno: ENOSYS function not available 02094 * GPFS_E_INVAL_IFILE bad file pointer 02095 * ENOTDIR file is not a directory 02096 * EPERM caller must have superuser privilege 02097 * ESTALE cached fs information was invalid 02098 * ENOMEM unable to allocate memory for request 02099 * EFORMAT invalid dirent version number 02100 * see system call write() ERRORS 02101 */ 02102 int GPFS_API 02103 gpfs_iwritedir(gpfs_ifile_t *idir, 02104 const gpfs_direntx_t *dirent); 02105 02106 int GPFS_API 02107 gpfs_iwritedir64(gpfs_ifile_t *idir, 02108 const gpfs_direntx64_t *dirent); 02109 02110 02111 /* NAME: gpfs_igetattrs() 02112 * 02113 * FUNCTION: Retrieves all extended file attributes in opaque format. 02114 * This function together with gpfs_iputattrs is intended for 02115 * use by a backup program to save (gpfs_igetattrs) and 02116 * restore (gpfs_iputattrs) all extended file attributes 02117 * (ACLs, user attributes, ...) in one call. 02118 * 02119 * NOTE: This call does not return extended attributes used for 02120 * the Data Storage Management (XDSM) API (aka DMAPI). 02121 * 02122 * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen 02123 * buffer: pointer to buffer for returned attributes 02124 * bufferSize: size of buffer 02125 * attrSize: ptr to returned size of attributes 02126 * 02127 * Returns: 0 Successful 02128 * -1 Failure and errno is set 02129 * 02130 * Errno: ENOSYS function not available 02131 * EPERM caller must have superuser privilege 02132 * ESTALE cached fs information was invalid 02133 * ENOSPC buffer too small to return all attributes 02134 * *attrSizeP will be set to the size necessary 02135 * GPFS_E_INVAL_IFILE bad ifile parameters 02136 */ 02137 int GPFS_API 02138 gpfs_igetattrs(gpfs_ifile_t *ifile, 02139 void *buffer, 02140 int bufferSize, 02141 int *attrSize); 02142 02143 /* NAME: gpfs_igetattrsx() 02144 * 02145 * FUNCTION: Retrieves all extended file attributes in opaque format. 02146 * This function together with gpfs_iputattrsx is intended for 02147 * use by a backup program to save (gpfs_igetattrsx) and 02148 * restore (gpfs_iputattrsx) all extended file attributes 02149 * (ACLs, user attributes, ...) in one call. 02150 * 02151 * NOTE: This call can optionally return extended attributes 02152 * used for the Data Storage Management (XDSM) API 02153 * (aka DMAPI). 02154 * 02155 * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen 02156 * flags Define behavior of get attributes 02157 * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes for placement 02158 * are not saved, neither is the current storage pool. 02159 * GPFS_ATTRFLAG_IGNORE_POOL - file attributes for placement 02160 * are saved, but the current storage pool is not. 02161 * GPFS_ATTRFLAG_INCL_DMAPI - file attributes for dmapi are 02162 * included in the returned buffer 02163 * 02164 * buffer: pointer to buffer for returned attributes 02165 * bufferSize: size of buffer 02166 * attrSize: ptr to returned size of attributes 02167 * 02168 * Returns: 0 Successful 02169 * -1 Failure 02170 * 02171 * Errno: ENOSYS function not available 02172 * EINVAL Not a GPFS file 02173 * EINVAL invalid flags provided 02174 * ENOSPC buffer too small to return all attributes 02175 * *attrSizeP will be set to the size necessary 02176 */ 02177 int GPFS_API 02178 gpfs_igetattrsx(gpfs_ifile_t *ifile, 02179 int flags, 02180 void *buffer, 02181 int bufferSize, 02182 int *attrSize); 02183 02184 02185 /* NAME: gpfs_iputattrs() 02186 * 02187 * FUNCTION: Sets all extended file attributes of a file. 02188 * The buffer passed in should contain extended attribute data 02189 * that was obtained by a previous call to gpfs_igetattrs. 02190 * 02191 * NOTE: This call will not restore extended attributes 02192 * used for the Data Storage Management (XDSM) API 02193 * (aka DMAPI). They will be silently ignored. 02194 * 02195 * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen 02196 * buffer: pointer to buffer for returned attributes 02197 * 02198 * Returns: 0 Successful 02199 * -1 Failure and errno is set 02200 * 02201 * Errno: ENOSYS function not available 02202 * EINVAL the buffer does not contain valid attribute data 02203 * EPERM caller must have superuser privilege 02204 * ESTALE cached fs information was invalid 02205 * GPFS_E_INVAL_IFILE bad ifile parameters 02206 */ 02207 int GPFS_API 02208 gpfs_iputattrs(gpfs_ifile_t *ifile, 02209 void *buffer); 02210 02211 02212 /* NAME: gpfs_iputattrsx() 02213 * 02214 * FUNCTION: Sets all extended file attributes of a file. 02215 * 02216 * This routine can optionally invoke the policy engine 02217 * to match a RESTORE rule using the file's attributes saved 02218 * in the extended attributes to set the file's storage pool and 02219 * data replication as when calling gpfs_fputattrswithpathname. 02220 * When used with the policy the caller should include the 02221 * full path to the file, including the file name, to allow 02222 * rule selection based on file name or path. 02223 * 02224 * By default, the routine will not use RESTORE policy rules 02225 * for data placement. The pathName parameter will be ignored 02226 * and may be set to NULL. 02227 * 02228 * If the call does not use RESTORE policy rules, or if the 02229 * file fails to match a RESTORE rule, or if there are no 02230 * RESTORE rules installed, then the storage pool and data 02231 * replication are selected as when calling gpfs_fputattrs(). 02232 * 02233 * The buffer passed in should contain extended attribute data 02234 * that was obtained by a previous call to gpfs_fgetattrs. 02235 * 02236 * pathName is a UTF-8 encoded string. On Windows, applications 02237 * can convert UTF-16 ("Unicode") to UTF-8 using the platforms 02238 * WideCharToMultiByte function. 02239 * 02240 * NOTE: This call will restore extended attributes 02241 * used for the Data Storage Management (XDSM) API 02242 * (aka DMAPI) if they are present in the buffer. 02243 * 02244 * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen 02245 * flags Define behavior of put attributes 02246 * GPFS_ATTRFLAG_NO_PLACEMENT - file attributes are restored 02247 * but the storage pool and data replication are unchanged 02248 * GPFS_ATTRFLAG_IGNORE_POOL - file attributes are restored 02249 * but the storage pool and data replication are selected 02250 * by matching the saved attributes to a placement rule 02251 * instead of restoring the saved storage pool. 02252 * GPFS_ATTRFLAG_USE_POLICY - file attributes are restored 02253 * but the storage pool and data replication are selected 02254 * by matching the saved attributes to a RESTORE rule 02255 * instead of restoring the saved storage pool. 02256 * GPFS_ATTRFLAG_FINALIZE_ATTRS - file attributes that are restored 02257 * after data is retored. If file is immutable/appendOnly 02258 * call without this flag before restoring data 02259 * then call with this flag after restoring data 02260 * 02261 * buffer: pointer to buffer for returned attributes 02262 * pathName: pointer to file path and file name for file 02263 * May be set to NULL. 02264 * 02265 * Returns: 0 Successful 02266 * -1 Failure and errno is set 02267 * 02268 * Errno: ENOSYS function not available 02269 * EINVAL the buffer does not contain valid attribute data 02270 * EINVAL invalid flags provided 02271 * EPERM caller must have superuser privilege 02272 * ESTALE cached fs information was invalid 02273 * GPFS_E_INVAL_IFILE bad ifile parameters 02274 */ 02275 int GPFS_API 02276 gpfs_iputattrsx(gpfs_ifile_t *ifile, 02277 int flags, 02278 void *buffer, 02279 const char *pathName); 02280 02281 02282 /* NAME: gpfs_igetfilesetname() 02283 * 02284 * FUNCTION: Retrieves the name of the fileset which contains this file. 02285 * The fileset name is a null-terminated string, with a 02286 * a maximum length of GPFS_MAXNAMLEN. 02287 * 02288 * Input: iscan: ptr to gpfs_iscan_t from gpfs_open_inodescan() 02289 * filesetId: ia_filesetId returned in an iattr from the iscan 02290 * buffer: pointer to buffer for returned fileset name 02291 * bufferSize: size of buffer 02292 * 02293 * Returns: 0 Successful 02294 * -1 Failure and errno is set 02295 * 02296 * Errno: ENOSYS function not available 02297 * EPERM caller must have superuser privilege 02298 * ESTALE cached fs information was invalid 02299 * ENOSPC buffer too small to return fileset name 02300 * GPFS_E_INVAL_ISCAN bad iscan parameter 02301 */ 02302 int GPFS_API 02303 gpfs_igetfilesetname(gpfs_iscan_t *iscan, 02304 unsigned int filesetId, 02305 void *buffer, 02306 int bufferSize); 02307 02308 02309 /* NAME: gpfs_igetstoragepool() 02310 * 02311 * FUNCTION: Retrieves the name of the storage pool assigned for 02312 * this file's data. The storage pool name is a null-terminated 02313 * string, with a maximum length of GPFS_MAXNAMLEN. 02314 * 02315 * Input: iscan: ptr to gpfs_iscan_t from gpfs_open_inodescan() 02316 * dataPoolId: ia_dataPoolId returned in an iattr from the iscan 02317 * buffer: pointer to buffer for returned attributes 02318 * bufferSize: size of buffer 02319 * 02320 * Returns: 0 Successful 02321 * -1 Failure and errno is set 02322 * 02323 * Errno: ENOSYS function not available 02324 * EPERM caller must have superuser privilege 02325 * ESTALE cached fs information was invalid 02326 * ENOSPC buffer too small to return all storage pool name 02327 * GPFS_E_INVAL_ISCAN bad iscan parameters 02328 */ 02329 int GPFS_API 02330 gpfs_igetstoragepool(gpfs_iscan_t *iscan, 02331 unsigned int dataPoolId, 02332 void *buffer, 02333 int bufferSize); 02334 02335 02336 /* NAME: gpfs_iclose() 02337 * 02338 * FUNCTION: Close file opened by inode and update dates. 02339 * 02340 * Input: ifile: pointer to gpfs_ifile_t from gpfs_iopen 02341 * 02342 * Returns: void 02343 * 02344 * Errno: ENOSYS function not available 02345 * EPERM caller must have superuser privilege 02346 * ESTALE cached fs information was invalid 02347 */ 02348 void GPFS_API 02349 gpfs_iclose(gpfs_ifile_t *ifile); 02350 02351 02352 /* NAME: gpfs_ireadlink() 02353 * 02354 * FUNCTION: Read symbolic link by inode number. 02355 * 02356 * Input: fssnapHandle: handle for file system & snapshot being scanned 02357 * ino: inode number of link file to read 02358 * buffer: pointer to buffer for returned link data 02359 * bufferSize: size of the buffer 02360 * 02361 * Returns: number of bytes read (Successful) 02362 * -1 and errno is set (Failure) 02363 * 02364 * Errno: ENOSYS function not available 02365 * EPERM caller must have superuser privilege 02366 * ESTALE cached fs information was invalid 02367 * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnap handle 02368 * see system call readlink() ERRORS 02369 */ 02370 int GPFS_API 02371 gpfs_ireadlink(gpfs_fssnap_handle_t *fssnapHandle, 02372 gpfs_ino_t ino, 02373 char *buffer, 02374 int bufferSize); 02375 02376 int GPFS_API 02377 gpfs_ireadlink64(gpfs_fssnap_handle_t *fssnapHandle, 02378 gpfs_ino64_t ino, 02379 char *buffer, 02380 int bufferSize); 02381 02382 02383 /* NAME: gpfs_sync_fs() 02384 * 02385 * FUNCTION: sync file system. 02386 * 02387 * Input: fssnapHandle: handle for file system being restored 02388 * 02389 * Returns: 0 all data flushed to disk (Successful) 02390 * -1 and errno is set (Failure) 02391 * 02392 * Errno: ENOSYS function not available 02393 * ENOMEM unable to allocate memory for request 02394 * EPERM caller must have superuser privilege 02395 * ESTALE cached fs information was invalid 02396 * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle 02397 */ 02398 int GPFS_API 02399 gpfs_sync_fs(gpfs_fssnap_handle_t *fssnapHandle); 02400 02401 02402 /* NAME: gpfs_enable_restore() 02403 * 02404 * FUNCTION: Mark file system as enabled for restore on/off 02405 * 02406 * Input: fssnapHandle: handle for file system to be enabled 02407 * or disabled for restore 02408 * on_off: flag set to 1 to enable restore 02409 * 0 to disable restore 02410 * 02411 * Returns: 0 (Successful) 02412 * -1 and errno is set (Failure) 02413 * 02414 * Errno: ENOSYS function not available 02415 * EINVAL bad parameters 02416 * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle 02417 * EPERM caller must have superuser privilege 02418 * ESTALE cached fs information was invalid 02419 * ENOMEM unable to allocate memory for request 02420 * E_FS_NOT_RESTORABLE fs is not clean 02421 * EALREADY fs already marked as requested 02422 * E_RESTORE_STARTED restore in progress 02423 * 02424 * Notes: EALREADY indicates enable/disable restore was already called 02425 * for this fs. The caller must decide if EALREADY represents an 02426 * error condition. 02427 */ 02428 int GPFS_API 02429 gpfs_enable_restore(gpfs_fssnap_handle_t *fssnapHandle, 02430 int on_off); 02431 02432 02433 /* NAME: gpfs_start_restore() 02434 * 02435 * FUNCTION: Start a restore session. 02436 * 02437 * Input: fssnapHandle: handle for file system to be restored 02438 * restore_flags: Flag to indicate the restore should be started 02439 * even if a prior restore has not completed. 02440 * old_fssnapId: fssnapId of last restored snapshot 02441 * new_fssnapId: fssnapId of snapshot being restored 02442 * 02443 * Returns: pointer to gpfs_restore_t (Successful) 02444 * NULL and errno is set (Failure) 02445 * 02446 * Errno: ENOSYS function not available 02447 * ENOMEM unable to allocate memory for request 02448 * EINVAL missing parameter 02449 * EPERM caller must have superuser privilege 02450 * ESTALE cached fs information was invalid 02451 * EDOM restore fs does not match existing fs 02452 * ERANGE restore is missing updates 02453 * EFORMAT invalid fs version number 02454 * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnaphandle 02455 * GPFS_E_INVAL_FSSNAPID bad fssnapId parameter 02456 * E_FS_NOT_RESTORABLE fs is not clean for restore 02457 * E_RESTORE_NOT_ENABLED fs is not enabled for restore 02458 * EALREADY Restore already in progress 02459 * 02460 * Note: EALREADY indicates start restore was already called for 02461 * this fs. This could be due to a prior restore process that failed 02462 * or it could be due to a concurrent restore process still running. 02463 * The caller must decide if EALREADY represents an error condition. 02464 */ 02465 gpfs_restore_t * GPFS_API 02466 gpfs_start_restore(gpfs_fssnap_handle_t *fssnapHandle, 02467 int restore_flags, 02468 const gpfs_fssnap_id_t *old_fssnapId, 02469 const gpfs_fssnap_id_t *new_fssnapId); 02470 02471 #define GPFS_RESTORE_NORMAL 0 /* Restore not started if prior restore 02472 has not completed. */ 02473 #define GPFS_RESTORE_FORCED 1 /* Restore starts even if prior restore 02474 has not completed. */ 02475 02476 02477 /* NAME: gpfs_end_restore() 02478 * 02479 * FUNCTION: End a restore session. 02480 * 02481 * Input: restoreId: ptr to gpfs_restore_t 02482 * 02483 * Returns: 0 (Successful) 02484 * -1 and errno is set (Failure) 02485 * 02486 * Errno: ENOSYS function not available 02487 * EINVAL bad parameters 02488 * EPERM caller must have superuser privilege 02489 * ESTALE cached fs information was invalid 02490 * GPFS_E_INVAL_RESTORE bad restoreId parameter 02491 * GPFS_E_FS_NOT_RESTORABLE fs is not clean for restore 02492 * GPFS_E_RESTORE_NOT_ENABLED fs is not enabled for restore 02493 * EALREADY Restore already ended 02494 * 02495 * Note: EALREADY indicates end restore was already called for 02496 * this fs. This could be due to a concurrent restore process that 02497 * already completed. The caller must decide if EALREADY represents 02498 * an error condition. 02499 */ 02500 int GPFS_API 02501 gpfs_end_restore(gpfs_restore_t *restoreId); 02502 02503 02504 /* NAME: gpfs_ireadx() 02505 * 02506 * FUNCTION: Block level incremental read on a file opened by gpfs_iopen 02507 * with a given incremental scan opened via gpfs_open_inodescan. 02508 * 02509 * Input: ifile: ptr to gpfs_ifile_t returned from gpfs_iopen() 02510 * iscan: ptr to gpfs_iscan_t from gpfs_open_inodescan() 02511 * buffer: ptr to buffer for returned data 02512 * bufferSize: size of buffer for returned data 02513 * offset: ptr to offset value 02514 * termOffset: read terminates before reading this offset 02515 * caller may specify ia_size for the file's 02516 * gpfs_iattr_t or 0 to scan the entire file. 02517 * hole: ptr to returned flag to indicate a hole in the file 02518 * 02519 * Returns: number of bytes read and returned in buffer 02520 * or size of hole encountered in the file. (Success) 02521 * -1 and errno is set (Failure) 02522 * 02523 * On input, *offset contains the offset in the file 02524 * at which to begin reading to find a difference same file 02525 * in a previous snapshot specified when the inodescan was opened. 02526 * On return, *offset contains the offset of the first 02527 * difference. 02528 * 02529 * On return, *hole indicates if the change in the file 02530 * was data (*hole == 0) and the data is returned in the 02531 * buffer provided. The function's value is the amount of data 02532 * returned. If the change is a hole in the file, 02533 * *hole != 0 and the size of the changed hole is returned 02534 * as the function value. 02535 * 02536 * A call with a NULL buffer pointer will query the next increment 02537 * to be read from the current offset. The *offset, *hole and 02538 * returned length will be set for the next increment to be read, 02539 * but no data will be returned. The bufferSize parameter is 02540 * ignored, but the termOffset parameter will limit the 02541 * increment returned. 02542 * 02543 * Errno: ENOSYS function not available 02544 * EINVAL missing or bad parameter 02545 * EISDIR file is a directory 02546 * EPERM caller must have superuser privilege 02547 * ESTALE cached fs information was invalid 02548 * ENOMEM unable to allocate memory for request 02549 * EDOM fs snapId does match local fs 02550 * ERANGE previous snapId is more recent than scanned snapId 02551 * GPFS_E_INVAL_IFILE bad ifile parameter 02552 * GPFS_E_INVAL_ISCAN bad iscan parameter 02553 * see system call read() ERRORS 02554 * 02555 * Notes: The termOffset parameter provides a means to partition a 02556 * file's data such that it may be read on more than one node. 02557 */ 02558 gpfs_off64_t GPFS_API 02559 gpfs_ireadx(gpfs_ifile_t *ifile, /* in only */ 02560 gpfs_iscan_t *iscan, /* in only */ 02561 void *buffer, /* in only */ 02562 int bufferSize, /* in only */ 02563 gpfs_off64_t *offset, /* in/out */ 02564 gpfs_off64_t termOffset, /* in only */ 02565 int *hole); /* out only */ 02566 02567 02568 /* NAME: gpfs_iwritex() 02569 * 02570 * FUNCTION: Write file opened by gpfs_iopen. 02571 * If parameter hole == 0, then write data 02572 * addressed by buffer to the given offset for the 02573 * given length. If hole != 0, then write 02574 * a hole at the given offset for the given length. 02575 * 02576 * Input: ifile : ptr to gpfs_ifile_t returned from gpfs_iopen() 02577 * buffer: ptr to data buffer 02578 * writeLen: length of data to write 02579 * offset: offset in file to write data 02580 * hole: flag =1 to write a "hole" 02581 * =0 to write data 02582 * 02583 * Returns: number of bytes/size of hole written (Success) 02584 * -1 and errno is set (Failure) 02585 * 02586 * Errno: ENOSYS function not available 02587 * EINVAL missing or bad parameter 02588 * EISDIR file is a directory 02589 * EPERM caller must have superuser privilege 02590 * ESTALE cached fs information was invalid 02591 * GPFS_E_INVAL_IFILE bad ifile parameter 02592 * see system call write() ERRORS 02593 */ 02594 gpfs_off64_t GPFS_API 02595 gpfs_iwritex(gpfs_ifile_t *ifile, /* in only */ 02596 void *buffer, /* in only */ 02597 gpfs_off64_t writeLen, /* in only */ 02598 gpfs_off64_t offset, /* in only */ 02599 int hole); /* in only */ 02600 02601 02602 /* NAME: gpfs_statfspool() 02603 * 02604 * FUNCTION: Obtain status information about the storage pools 02605 * 02606 * Input: pathname : path to any file in the file system 02607 * poolId : id of first pool to return 02608 * on return set to next poolId or -1 02609 * to indicate there are no more pools. 02610 * options : option flags (currently not used) 02611 * nPools : number of stat structs requested or 0 02612 * on return number of stat structs in buffer 02613 * or if nPools was 0 its value is the max number 02614 * of storage pools currently defined 02615 * buffer : ptr to return stat structures 02616 * bufferSize : sizeof stat buffer 02617 * 02618 * The user is expected to issue two or more calls. On the first 02619 * call the user should pass nPools set to 0 and gpfs will 02620 * return in nPools the total number of storage pools currently 02621 * defined for the file system indicated by the pathname 02622 * and it returns in poolId the id of the first storage pool. 02623 * The buffer parameter may be set to NULL for this call. 02624 * 02625 * The user may then allocate a buffer large enough to contain 02626 * a gpfs_statfspool_t structure for each of the pools and issue 02627 * a second call to obtain stat information about each pool. 02628 * Parameter nPools should be set the number of pools requested. 02629 * On return, nPools will be set to the number of stat structs 02630 * contained in the buffer, and poolId will be set to the id 02631 * of the next storage pool or -1 to indicate there are no 02632 * additional storage pools defined. 02633 * 02634 * Alternatively, if the user has a valid poolId from a previous 02635 * call, the user may provide that poolId and a buffer large 02636 * enough for a single gpfs_statfspool_t structure, and the call 02637 * will return the status for a single storage pool. 02638 * 02639 * 02640 * Returns: 0 Successful 02641 * -1 Failure 02642 * 02643 * Errno: Specific error indication 02644 * EINVAL 02645 */ 02646 int GPFS_API 02647 gpfs_statfspool(const char *pathname, /* in only: path to file system*/ 02648 gpfs_pool_t *poolId, /* in out: id of first pool to return 02649 on return set to next poolId 02650 or -1 when there are no more pools */ 02651 unsigned int options, /* in only: option flags */ 02652 int *nPools, /* in out: number of pool stats requested 02653 on return number of stat structs 02654 returned in buffer or if nPools was 02655 set to 0, the return value is the 02656 number of pools currently defined */ 02657 void *buffer, /* ptr to return stat structures */ 02658 int bufferSize); /* sizeof stat buffer or 0 */ 02659 02660 02661 /* NAME: gpfs_getpoolname() 02662 * 02663 * FUNCTION: Retrieves the name of the storage pool assigned for 02664 * this file's data. The storage pool name is a null-terminated 02665 * string, with a maximum length of GPFS_MAXNAMLEN. 02666 * 02667 * Input: pathname: path to any file in the file system 02668 * poolId: f_poolid returned in gpfs_statfspool_t 02669 * buffer: pointer to buffer for returned name 02670 * bufferSize: size of buffer 02671 * 02672 * Returns: 0 Successful 02673 * -1 Failure and errno is set 02674 * 02675 * Errno: ENOSYS function not available 02676 * ESTALE file system was unmounted 02677 * E_FORMAT_INCOMPAT file system does not support pools 02678 * E2BIG buffer too small to return storage pool name 02679 */ 02680 int GPFS_API 02681 gpfs_getpoolname(const char *pathname, 02682 gpfs_pool_t poolId, 02683 void *buffer, 02684 int bufferSize); 02685 02686 02687 /* /usr/src/linux/include/linux/fs.h includes /usr/src/linux/include/linux/quota.h 02688 which has conflicting definitions. */ 02689 #ifdef _LINUX_QUOTA_ 02690 #undef Q_SYNC 02691 #undef Q_GETQUOTA 02692 #undef Q_SETQUOTA 02693 #undef Q_QUOTAON 02694 #undef Q_QUOTAOFF 02695 #endif 02696 02697 02698 /* GPFS QUOTACTL */ 02699 02700 /* 02701 * Command definitions for the 'gpfs_quotactl' system call. 02702 * The commands are broken into a main command defined below 02703 * and a subcommand that is used to convey the type of 02704 * quota that is being manipulated (see above). 02705 */ 02706 02707 #define SUBCMDMASK 0x00ff 02708 #define SUBCMDSHIFT 8 02709 #define GPFS_QCMD(cmd, type) (((cmd) << SUBCMDSHIFT) | ((type) & SUBCMDMASK)) 02710 02711 #define Q_QUOTAON 0x0100 /* enable quotas */ 02712 #define Q_QUOTAOFF 0x0200 /* disable quotas */ 02713 #define Q_GETQUOTA 0x0300 /* get limits and usage */ 02714 #ifndef _LINUX_SOURCE_COMPAT 02715 /* Standard AIX definitions of quota commands */ 02716 #define Q_SETQUOTA 0x0400 /* set limits */ 02717 #define Q_SETQLIM Q_SETQUOTA 02718 #else 02719 /* Alternate definitions, for Linux Affinity */ 02720 #define Q_SETQLIM 0x0400 /* set limits */ 02721 #define Q_SETQUOTA 0x0700 /* set limits and usage */ 02722 #endif 02723 #define Q_SETUSE 0x0500 /* set usage */ 02724 #define Q_SYNC 0x0600 /* sync disk copy of a filesystems quotas */ 02725 #define Q_SETGRACETIME 0x0700 /* set grace time */ 02726 #define Q_SETGRACETIME_ENHANCE 0x0800 /* set grace time and update all 02727 * quota entries */ 02728 02729 /* gpfs quota types */ 02730 #define GPFS_USRQUOTA 0 02731 #define GPFS_GRPQUOTA 1 02732 #define GPFS_FILESETQUOTA 2 02733 02734 /* define GPFS generated errno */ 02735 #define GPFS_E_NO_QUOTA_INST 237 /* file system does not support quotas */ 02736 02737 typedef struct gpfs_quotaInfo 02738 { 02739 gpfs_off64_t blockUsage; /* current block count in 1 KB units*/ 02740 gpfs_off64_t blockHardLimit; /* absolute limit on disk blks alloc */ 02741 gpfs_off64_t blockSoftLimit; /* preferred limit on disk blks */ 02742 gpfs_off64_t blockInDoubt; /* distributed shares + "lost" usage for blks */ 02743 int inodeUsage; /* current # allocated inodes */ 02744 int inodeHardLimit; /* absolute limit on allocated inodes */ 02745 int inodeSoftLimit; /* preferred inode limit */ 02746 int inodeInDoubt; /* distributed shares + "lost" usage for inodes */ 02747 gpfs_uid_t quoId; /* uid, gid or fileset id */ 02748 int entryType; /* entry type, not used */ 02749 unsigned int blockGraceTime; /* time limit for excessive disk use */ 02750 unsigned int inodeGraceTime; /* time limit for excessive inode use */ 02751 } gpfs_quotaInfo_t; 02752 02753 02754 /* NAME: gpfs_quotactl() 02755 * 02756 * FUNCTION: Manipulate disk quotas 02757 * INPUT: pathname: specifies the pathname of any file within the 02758 * mounted file system to which the command is to 02759 * be applied 02760 * cmd: specifies a quota control command to be applied 02761 * to UID/GID/FILESETID id. The cmd parameter can be 02762 * constructed using GPFS_QCMD(cmd, type) macro defined 02763 * in gpfs.h 02764 * id: UID or GID or FILESETID that command applied to. 02765 * bufferP: points to the address of an optional, command 02766 * specific, data structure that is copied in or out of 02767 * the system. 02768 * 02769 * OUTPUT: bufferP, if applicable. 02770 * 02771 * Returns: 0 success 02772 * -1 failure 02773 * 02774 * Errno: EACCESS 02775 * EFAULT An invalid bufferP parameter is supplied; 02776 * the associated structure could not be copied 02777 * in or out of the kernel 02778 * EINVAL 02779 * ENOENT No such file or directory 02780 * EPERM The quota control command is privileged and 02781 * the caller did not have root user authority 02782 * EOPNOTSUPP 02783 * GPFS_E_NO_QUOTA_INST The file system does not support quotas 02784 */ 02785 int GPFS_API 02786 gpfs_quotactl(const char *pathname, 02787 int cmd, 02788 int id, 02789 void *bufferP); 02790 02791 02792 /* NAME: gpfs_getfilesetid() 02793 * 02794 * FUNCTION: Translate FilesetName to FilesetID 02795 * 02796 * INPUT: pathname: specifies the pathname of any file within the 02797 * mounted file system to which the command is to 02798 * be applied 02799 * name: name of the fileset 02800 * 02801 * OUTPUT: idP: points to the address of an integer that receives the ID 02802 * 02803 * Returns: 0 success 02804 * -1 failure 02805 * 02806 * Errno: EACCESS 02807 * EFAULT An invalid pointer is supplied; the associated 02808 * data could not be copied in or out of the kernel 02809 * EINVAL 02810 * ENOENT No such file, directory or fileset 02811 */ 02812 int GPFS_API 02813 gpfs_getfilesetid(const char *pathname, 02814 const char *name, 02815 int *idP); 02816 02817 02818 /* NAME: gpfs_clone_snap() 02819 * 02820 * FUNCTION: Create an immutable clone parent from a source file 02821 * 02822 * Input: sourcePathP: path to source file, which will be cloned 02823 * destPathP: path to destination file, to be created 02824 * 02825 * If destPathP is NULL, then the source file will be changed 02826 * in place into an immutable clone parent. 02827 * 02828 * Returns: 0 Successful 02829 * -1 Failure 02830 * 02831 * Errno: ENOSYS Function not available 02832 * ENOENT File does not exist 02833 * EACCESS Write access to target or source search permission denied 02834 * EINVAL Not a regular file or not a GPFS filesystem 02835 * EFAULT Input argument points outside accessible address space 02836 * ENAMETOOLONG Source or destination path name too long 02837 * ENOSPC Not enough space on disk 02838 * EISDIR Destination is a directory 02839 * EXDEV Source and destination aren't in the same filesystem 02840 */ 02841 int GPFS_API 02842 gpfs_clone_snap(const char *sourcePathP, const char *destPathP); 02843 02844 /* NAME: gpfs_clone_copy() 02845 * 02846 * FUNCTION: Create a clone copy of an immutable clone parent file 02847 * 02848 * Input: sourcePathP: path to immutable source file, to be cloned 02849 * destPathP: path to destination file, to be created 02850 * 02851 * Returns: 0 Successful 02852 * -1 Failure 02853 * 02854 * Errno: ENOSYS Function not available 02855 * ENOENT File does not exist 02856 * EACCESS Write access to target or source search permission denied 02857 * EINVAL Not a regular file or not a GPFS filesystem 02858 * EFAULT Input argument points outside accessible address space 02859 * ENAMETOOLONG Source or destination path name too long 02860 * ENOSPC Not enough space on disk 02861 * EISDIR Destination is a directory 02862 * EXDEV Source and destination aren't in the same filesystem 02863 */ 02864 int GPFS_API 02865 gpfs_clone_copy(const char *sourcePathP, const char *destPathP); 02866 02867 02868 /* NAME: gpfs_declone() 02869 * 02870 * FUNCTION: Copy blocks from clone parent(s) to child so that the 02871 * parent blocks are no longer referenced by the child. 02872 * 02873 * Input: fileDesc: File descriptor for file to be de-cloned 02874 * ancLimit: Ancestor limit (immediate parent only, or all) 02875 * nBlocks: Maximum number of GPFS blocks to copy 02876 * In/Out: offsetP: Pointer to starting offset within file (will be 02877 * updated to offset of next block to process or 02878 * -1 if no more blocks) 02879 * 02880 * Returns: 0 Successful 02881 * -1 Failure 02882 * 02883 * Errno: ENOSYS Function not available 02884 * EINVAL Invalid argument to function 02885 * EBADF Bad file descriptor or not a GPFS file 02886 * EPERM Not a regular file 02887 * EACCESS Write access to target file not permitted 02888 * EFAULT Input argument points outside accessible address space 02889 * ENOSPC Not enough space on disk 02890 */ 02891 02892 /* Values for ancLimit */ 02893 #define GPFS_CLONE_ALL 0 02894 #define GPFS_CLONE_PARENT_ONLY 1 02895 02896 int GPFS_API 02897 gpfs_declone(gpfs_file_t fileDesc, int ancLimit, gpfs_off64_t nBlocks, 02898 gpfs_off64_t *offsetP); 02899 02900 /* NAME: gpfs_clone_split() 02901 * 02902 * FUNCTION: Split a clone child file from its parent. Must call 02903 * gpfs_declone first, to remove all references. 02904 * 02905 * Input: fileDesc: File descriptor for file to be split 02906 * ancLimit: Ancestor limit (immediate parent only, or all) 02907 * 02908 * Returns: 0 Successful 02909 * -1 Failure 02910 * 02911 * Errno: ENOSYS Function not available 02912 * EINVAL Invalid argument to function 02913 * EBADF Bad file descriptor or not a GPFS file 02914 * EPERM Not a regular file or not a clone child 02915 * EACCESS Write access to target file not permitted 02916 */ 02917 int GPFS_API 02918 gpfs_clone_split(gpfs_file_t fileDesc, int ancLimit); 02919 02920 /* NAME: gpfs_clone_unsnap() 02921 * 02922 * FUNCTION: Change a clone parent with no children back into a 02923 * normal file. 02924 * 02925 * Input: fileDesc: File descriptor for file to be un-snapped 02926 * 02927 * Returns: 0 Successful 02928 * -1 Failure 02929 * 02930 * Errno: ENOSYS Function not available 02931 * EINVAL Invalid argument to function 02932 * EBADF Bad file descriptor or not a GPFS file 02933 * EPERM Not a regular file or not a clone parent 02934 * EACCESS Write access to target file not permitted 02935 */ 02936 int GPFS_API 02937 gpfs_clone_unsnap(gpfs_file_t fileDesc); 02938 02939 /* NAME: gpfs_get_fset_masks() 02940 * 02941 * FUNCTION: return bit masks governing "external" inode and inode-space numbering 02942 * 02943 * Input: fset_snaphandle: ptr to an fset snaphandle 02944 * Output: the bit masks and inodes per block factor. 02945 * 02946 * Returns: 0 Success 02947 * -1 Failure 02948 * 02949 * Errno: ENOSYS function not available 02950 * GPFS_E_INVAL_FSSNAPHANDLE invalid fssnapHandle 02951 */ 02952 int GPFS_API 02953 gpfs_get_fset_masks(gpfs_fssnap_handle_t* fset_snapHandle, 02954 gpfs_ino64_t* inodeSpaceMask, 02955 gpfs_ino64_t* inodeBlockMask, 02956 int* inodesPerInodeBlock); 02957 02958 02959 /* 02960 API functions for Light Weight Event 02961 */ 02962 #include <gpfs_lweTypes.h> 02963 02964 /* NAME: gpfs_lweCreateSession() 02965 * 02966 * FUNCTION: create a light weight event session 02967 * 02968 * Input: oldsid: existing session id, 02969 INVALID_SID for create a new session, 02970 valid sid for resume an existing session 02971 sessinfop: session string, unique for each session 02972 * 02973 * Output: newsidp: session id for new session 02974 * 02975 * Returns: 0 Success 02976 * -1 Failure 02977 * 02978 * Errno: EINVAL oldsid and sessinfop mismatch 02979 * EEXIST session with the same name already exists, can not create. 02980 */ 02981 int GPFS_API 02982 gpfs_lweCreateSession(lwe_sessid_t oldsid, /* IN */ 02983 char *sessinfop, /* IN */ 02984 lwe_sessid_t *newsidp /* OUT */ 02985 ); 02986 02987 02988 /* NAME: gpfs_lweDestroySession() 02989 * 02990 * FUNCTION: destroy a light weight event session 02991 * 02992 * Input: sid: id of the session to be destroyed 02993 * 02994 * Returns: 0 Success 02995 * EINVAL sid invalid 02996 * EBUSY session is busy 02997 */ 02998 int GPFS_API 02999 gpfs_lweDestroySession(lwe_sessid_t sid); /* IN */ 03000 03001 /* NAME: gpfs_lweGetAllSessions() 03002 * 03003 * FUNCTION: fetch all lwe sessions 03004 * 03005 * Input: nelem: max number of elements 03006 sidbufp: array of session id 03007 nelemp: number of session returned in sidbufp 03008 * 03009 * Returns: 0 Success 03010 * EINVAL pass in args invalid 03011 * E2BIG information is too large 03012 */ 03013 int GPFS_API 03014 gpfs_lweGetAllSessions(unsigned int nelem, /* IN */ 03015 lwe_sessid_t *sidbufp, /* OUT */ 03016 unsigned int *nelemp); /* OUT */ 03017 03018 /* NAME: gpfs_lweQuerySession() 03019 * 03020 * FUNCTION: query session string by id 03021 * 03022 * Input: sid: id of session to be queryed 03023 buflen: length of buffer 03024 bufp: buffer to store sessions string 03025 rlenp: returned length of bufp 03026 * 03027 * Returns: 0 Success 03028 * EINVAL pass in args invalid 03029 * E2BIG information is too large 03030 */ 03031 int GPFS_API 03032 gpfs_lweQuerySession(lwe_sessid_t sid, /* IN */ 03033 size_t buflen, /* IN */ 03034 void *bufp, /* OUT */ 03035 size_t *rlenP); /* OUT */ 03036 03037 /* NAME: gpfs_lweGetEvents() 03038 * 03039 * FUNCTION: get events from a light weight session 03040 * 03041 * Input: sid: id of the session 03042 * maxmsgs: max number of event to fetch, 03043 * 0 to fetch all possible 03044 * flags: LWE_EV_WAIT: waiting for new events if event 03045 * queue is empty 03046 * buflen: length of the buffer 03047 * bufp: buffer to hold events 03048 * rlenp: returned length of bufp 03049 * 03050 * Returns: 0 Success 03051 * E2BIG information is too large 03052 * EINVAL pass in args invalid 03053 */ 03054 int GPFS_API 03055 gpfs_lweGetEvents(lwe_sessid_t sid, /* IN */ 03056 unsigned int maxmsgs, /* IN */ 03057 unsigned int flags, /* IN */ 03058 size_t buflen, /* IN */ 03059 void *bufp, /* OUT */ 03060 size_t *rlenp); /* OUT */ 03061 03062 /* NAME: gpfs_lweRespondEvent() 03063 * 03064 * FUNCTION: response to a light weight event 03065 * 03066 * Input: sid: id of the session 03067 * token: token of the event 03068 * response: response to the event 03069 * reterror: return error to event callers 03070 * 03071 * Returns: 0 Success 03072 * EINVAL pass in args invalid 03073 * 03074 */ 03075 int GPFS_API 03076 gpfs_lweRespondEvent(lwe_sessid_t sid, /* IN */ 03077 lwe_token_t token, /* IN */ 03078 lwe_resp_t response, /* IN */ 03079 int reterror); /* IN */ 03080 03081 03082 /* 03083 * When GPFS_64BIT_INODES is defined, use the 64-bit interface definitions as 03084 * the default. 03085 */ 03086 03087 #ifdef GPFS_64BIT_INODES 03088 #undef GPFS_D_VERSION 03089 #define GPFS_D_VERSION GPFS_D64_VERSION 03090 #undef GPFS_IA_VERSION 03091 #define GPFS_IA_VERSION GPFS_IA64_VERSION 03092 03093 #define gpfs_ino_t gpfs_ino64_t 03094 #define gpfs_gen_t gpfs_gen64_t 03095 #define gpfs_uid_t gpfs_uid64_t 03096 #define gpfs_gid_t gpfs_gid64_t 03097 #define gpfs_snapid_t gpfs_snapid64_t 03098 #define gpfs_nlink_t gpfs_nlink64_t 03099 #define gpfs_timestruc_t gpfs_timestruc64_t 03100 #define gpfs_direntx_t gpfs_direntx64_t 03101 #define gpfs_direntx gpfs_direntx64 03102 #define gpfs_iattr_t gpfs_iattr64_t 03103 03104 #define gpfs_get_snapid_from_fssnaphandle gpfs_get_snapid_from_fssnaphandle64 03105 #define gpfs_open_inodescan gpfs_open_inodescan64 03106 #define gpfs_open_inodescan_with_xattrs gpfs_open_inodescan_with_xattrs64 03107 #define gpfs_next_inode gpfs_next_inode64 03108 #define gpfs_next_inode_with_xattrs gpfs_next_inode_with_xattrs64 03109 #define gpfs_seek_inode gpfs_seek_inode64 03110 #define gpfs_stat_inode gpfs_stat_inode64 03111 #define gpfs_stat_inode_with_xattrs gpfs_stat_inode_with_xattrs64 03112 #define gpfs_iopen gpfs_iopen64 03113 #define gpfs_ireaddir gpfs_ireaddir64 03114 #define gpfs_ireaddirx gpfs_ireaddirx64 03115 #define gpfs_iwritedir gpfs_iwritedir64 03116 #define gpfs_ireadlink gpfs_ireadlink64 03117 #endif 03118 03119 03120 #ifdef __cplusplus 03121 } 03122 #endif 03123 03124 #endif /* H_GPFS */