[SCM] Samba Shared Repository - branch master updated
Volker Lendecke
vlendec at samba.org
Fri Jan 18 16:22:02 UTC 2019
The branch, master has been updated
via c41ec2a9751 lib: Use gpfs.h from third_party on Linux
via fd789b2c69c third_party: Add gpfs.h header file
via 528d33963ac wscript: Make non_posix_acls a subsystem
from b8c248e4d90 dns_hub: Rename variable to avoid naming collision in exception handler
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit c41ec2a9751a760eca1307a1e29508518999d097
Author: Christof Schmitt <cs at samba.org>
Date: Tue Dec 19 15:13:50 2017 -0700
lib: Use gpfs.h from third_party on Linux
Update the logic for finding the gpfs.h header file: Look for the header
file in the default location under /usr/lpp/mmfs/include. If it is not
available there, default to the file in third_party/gpfs/ on Linux (AIX
could be added if there is demand).
The configure option --with-gpfs=GPFS_HEADERS_DIR can always be used to
overwrite the default behavior with a specific location.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
Autobuild-User(master): Volker Lendecke <vl at samba.org>
Autobuild-Date(master): Fri Jan 18 17:21:02 CET 2019 on sn-devel-144
commit fd789b2c69ce3005cf9747fe525ee3a9e12b7e5b
Author: Christof Schmitt <cs at samba.org>
Date: Tue Dec 19 15:11:43 2017 -0700
third_party: Add gpfs.h header file
This is the only requirement for building the vfs_gpfs module; the
corresponding library is opened through dlopen at runtime. The intent
here is to always build the vfs_gpfs module to easily detect breakage
e.g. due to vfs interface changes.
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
commit 528d33963aceb137fb9fde5afa5dd5f4c4b1fac8
Author: Christof Schmitt <cs at samba.org>
Date: Fri Jan 11 15:02:03 2019 -0700
wscript: Make non_posix_acls a subsystem
This fixes build error when building vfs_gpfs as static module:
ERROR: circular library dependency between smbd_base and non_posix_acls
Signed-off-by: Christof Schmitt <cs at samba.org>
Reviewed-by: Volker Lendecke <vl at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/util/wscript | 2 +-
lib/util/wscript_configure | 23 +-
source3/modules/wscript_build | 5 +-
third_party/gpfs/gpfs.h | 4042 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 4064 insertions(+), 8 deletions(-)
create mode 100644 third_party/gpfs/gpfs.h
Changeset truncated at 500 lines:
diff --git a/lib/util/wscript b/lib/util/wscript
index d61b11e9e37..6f711adcd0c 100644
--- a/lib/util/wscript
+++ b/lib/util/wscript
@@ -20,4 +20,4 @@ def options(opt):
opt.add_option('--with-gpfs',
help=("Directory under which gpfs headers are installed"),
- action="store", dest='gpfs_headers_dir', default="/usr/lpp/mmfs/include/")
+ action="store", dest='gpfs_headers_dir')
diff --git a/lib/util/wscript_configure b/lib/util/wscript_configure
index b06f1c14074..93853511575 100644
--- a/lib/util/wscript_configure
+++ b/lib/util/wscript_configure
@@ -1,5 +1,7 @@
#!/usr/bin/env python
-from waflib import Options
+from waflib import Logs, Options
+
+import os, sys
if Options.options.disable_fault_handling:
conf.DEFINE('HAVE_DISABLE_FAULT_HANDLING',1)
@@ -136,6 +138,19 @@ if (conf.CONFIG_SET('HAVE_LTTNG_TRACEF_H') and
conf.DEFINE('HAVE_LTTNG_TRACEF', '1')
conf.env['HAVE_LTTNG_TRACEF'] = True
-conf.env['CPPPATH_GPFS'] = Options.options.gpfs_headers_dir
-if conf.CHECK_HEADERS('gpfs.h', False, False, "gpfs"):
- conf.DEFINE('HAVE_GPFS', '1')
+if Options.options.gpfs_headers_dir:
+ conf.env['CPPPATH_GPFS'] = Options.options.gpfs_headers_dir
+ if conf.CHECK_HEADERS('gpfs.h', False, False, "gpfs"):
+ Logs.info('Using gpfs.h from %s' % Options.options.gpfs_headers_dir)
+ conf.DEFINE('HAVE_GPFS', '1')
+else:
+ conf.env['CPPPATH_GPFS'] = "/usr/lpp/mmfs/include/"
+ if conf.CHECK_HEADERS('gpfs.h', False, False, "gpfs"):
+ Logs.info('Using gpfs.h from installed gpfs package.')
+ conf.DEFINE('HAVE_GPFS', '1')
+ else:
+ if sys.platform=="linux":
+ conf.env['CPPPATH_GPFS'] = os.path.abspath("third_party/gpfs")
+ if conf.CHECK_HEADERS('gpfs.h', False, False, "gpfs"):
+ Logs.info('Using gpfs.h from third_party directory.')
+ conf.DEFINE('HAVE_GPFS', '1')
diff --git a/source3/modules/wscript_build b/source3/modules/wscript_build
index db083f50646..ef1d476ef6a 100644
--- a/source3/modules/wscript_build
+++ b/source3/modules/wscript_build
@@ -12,10 +12,9 @@ bld.SAMBA3_SUBSYSTEM('POSIXACL_XATTR',
enabled=(bld.SAMBA3_IS_ENABLED_MODULE('vfs_ceph') or bld.SAMBA3_IS_ENABLED_MODULE('vfs_glusterfs')),
deps='acl attr')
-bld.SAMBA3_LIBRARY('non_posix_acls',
+bld.SAMBA3_SUBSYSTEM('non_posix_acls',
source='non_posix_acls.c',
- deps='samba-util vfs',
- private_library=True)
+ deps='samba-util vfs')
bld.SAMBA3_SUBSYSTEM('VFS_VIRUSFILTER_UTILS',
source='vfs_virusfilter_utils.c',
diff --git a/third_party/gpfs/gpfs.h b/third_party/gpfs/gpfs.h
new file mode 100644
index 00000000000..acafe12c2e7
--- /dev/null
+++ b/third_party/gpfs/gpfs.h
@@ -0,0 +1,4042 @@
+/* */
+/* Copyright (C) 2001 International Business Machines */
+/* All rights reserved. */
+/* */
+/* This file is part of the GPFS user library. */
+/* */
+/* Redistribution and use in source and binary forms, with or without */
+/* modification, are permitted provided that the following conditions */
+/* are met: */
+/* */
+/* 1. Redistributions of source code must retain the above copyright notice, */
+/* this list of conditions and the following disclaimer. */
+/* 2. Redistributions in binary form must reproduce the above copyright */
+/* notice, this list of conditions and the following disclaimer in the */
+/* documentation and/or other materials provided with the distribution. */
+/* 3. The name of the author may not be used to endorse or promote products */
+/* derived from this software without specific prior written */
+/* permission. */
+/* */
+/* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR */
+/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES */
+/* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. */
+/* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
+/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, */
+/* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; */
+/* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, */
+/* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR */
+/* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF */
+/* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+/* */
+/* @(#)42 1.1.12.3 src/avs/fs/mmfs/ts/util/gpfs.h, mmfs, avs_rttn423, rttn423s001a 4/10/17 10:46:33 */
+/*
+ * Library calls for GPFS interfaces
+ */
+#ifndef H_GPFS
+#define H_GPFS
+
+#include <stddef.h>
+
+/* Define GPFS_64BIT_INODES to map the default interface definitions
+ to 64-bit interfaces. Without this define, the 32-bit interface
+ is the default. Both interfaces are always present, but the
+ define sets the default. The actual mapping can be found near the
+ end of this header. */
+/* #define GPFS_64BIT_INODES 1 */
+
+#define NFS_IP_SIZE 32
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if defined(WIN32) && defined(GPFSDLL)
+
+ /* The following errno values either are missing from Windows errno.h or
+ have a conflicting value. Other errno values (e.g. EPERM) are okay. */
+ #define GPFS_EALREADY 37 /* Operation already in progress */
+ #define GPFS_EOPNOTSUPP 45 /* Operation not supported */
+ #define GPFS_EDQUOT 69 /* Disk quota exceeded */
+ #define GPFS_ESTALE 9 /* No file system (mapped to EBADF) */
+ #define GPFS_EFORMAT 19 /* Unformatted media (mapped to ENODEV) */
+
+ /* specify the library calling convention */
+ #define GPFS_API __stdcall
+
+ /* On Windows, this is a HANDLE as returned by CreateFile() */
+ typedef void* gpfs_file_t;
+
+#else /* not gpfs.dll on Windows */
+
+ #define GPFS_API
+ /* On UNIX systems, this is a file descriptor as returned by open() */
+ typedef int gpfs_file_t;
+
+#endif
+
+
+typedef unsigned int gpfs_uid_t;
+typedef long long gpfs_off64_t;
+typedef unsigned long long gpfs_uid64_t;
+
+typedef struct gpfs_timestruc
+{
+ unsigned int tv_sec;
+ unsigned int tv_nsec;
+} gpfs_timestruc_t;
+
+typedef struct gpfs_timestruc64
+{
+ long long tv_sec;
+ unsigned int tv_nsec;
+} gpfs_timestruc64_t;
+
+#define GPFS_SLITE_SIZE_BIT 0x00000001
+#define GPFS_SLITE_BLKSIZE_BIT 0x00000002
+#define GPFS_SLITE_BLOCKS_BIT 0x00000004
+#define GPFS_SLITE_ATIME_BIT 0x00000010
+#define GPFS_SLITE_MTIME_BIT 0x00000020
+#define GPFS_SLITE_CTIME_BIT 0x00000040
+#define GPFS_SLITE_EXACT_BITS 0x00000077
+
+/* Returns "1" if the attribute is requested to be accurate.
+ (On output, indicates the value returned in statbufP is accurate). */
+#define GPFS_SLITE(m) (0 == (m))
+#define GPFS_SLITE_SIZET(m) (0 != ((m) & GPFS_SLITE_SIZE_BIT))
+#define GPFS_SLITE_BLKSIZE(m) (0 != ((m) & GPFS_SLITE_BLKSIZE_BIT))
+#define GPFS_SLITE_BLOCKS(m) (0 != ((m) & GPFS_SLITE_BLOCKS_BIT))
+#define GPFS_SLITE_ATIME(m) (0 != ((m) & GPFS_SLITE_ATIME_BIT))
+#define GPFS_SLITE_MTIME(m) (0 != ((m) & GPFS_SLITE_MTIME_BIT))
+#define GPFS_SLITE_CTIME(m) (0 != ((m) & GPFS_SLITE_CTIME_BIT))
+#define GPFS_SLITE_EXACT(m) (GPFS_SLITE_EXACT_BITS == (m))
+
+/* Sets the litemask bit indicating that the attribute should be accurate */
+#define GPFS_S_SLITE(m) (m) = 0
+#define GPFS_S_SLITE_SIZET(m) (m) |= GPFS_SLITE_SIZE_BIT
+#define GPFS_S_SLITE_BLKSIZE(m) (m) |= GPFS_SLITE_BLKSIZE_BIT
+#define GPFS_S_SLITE_BLOCKS(m) (m) |= GPFS_SLITE_BLOCKS_BIT
+#define GPFS_S_SLITE_ATIME(m) (m) |= GPFS_SLITE_ATIME_BIT
+#define GPFS_S_SLITE_MTIME(m) (m) |= GPFS_SLITE_MTIME_BIT
+#define GPFS_S_SLITE_CTIME(m) (m) |= GPFS_SLITE_CTIME_BIT
+#define GPFS_S_SLITE_EXACT(m) (m) |= GPFS_SLITE_EXACT_BITS
+
+#define GPFS_STATLITE 0
+#define GPFS_NOFOLLOW 1
+
+/* Mapping of buffer for gpfs_getacl, gpfs_putacl. */
+typedef struct gpfs_opaque_acl
+{
+ int acl_buffer_len; /* INPUT: Total size of buffer (including this field).
+ OUTPUT: Actual size of the ACL information. */
+ unsigned short acl_version; /* INPUT: Set to zero.
+ OUTPUT: Current version of the returned ACL. */
+ unsigned char acl_type; /* INPUT: Type of ACL: access (1) or default (2). */
+ char acl_var_data[1]; /* OUTPUT: Remainder of the ACL information. */
+} gpfs_opaque_acl_t;
+
+/* ACL types (acl_type field in gpfs_opaque_acl_t or gpfs_acl_t) */
+#define GPFS_ACL_TYPE_ACCESS 1
+#define GPFS_ACL_TYPE_DEFAULT 2
+#define GPFS_ACL_TYPE_NFS4 3
+
+/* gpfs_getacl, gpfs_putacl flag indicating structures instead of the
+ opaque style data normally used. */
+#define GPFS_GETACL_STRUCT 0x00000020
+#define GPFS_PUTACL_STRUCT 0x00000020
+
+/* gpfs_getacl, gpfs_putacl flag indicating smbd is the caller */
+#define GPFS_ACL_SAMBA 0x00000040
+
+/* Defined values for gpfs_aclVersion_t */
+#define GPFS_ACL_VERSION_POSIX 1
+#define GPFS_ACL_VERSION_NFS4F 3 /* GPFS_ACL_VERSION_NFS4 plus V4FLAGS */
+#define GPFS_ACL_VERSION_NFS4 4
+
+/* Values for gpfs_aclLevel_t */
+#define GPFS_ACL_LEVEL_BASE 0 /* compatible with all acl_version values */
+#define GPFS_ACL_LEVEL_V4FLAGS 1 /* requires GPFS_ACL_VERSION_NFS4 */
+
+/* Values for gpfs_aceType_t (ACL_VERSION_POSIX) */
+#define GPFS_ACL_USER_OBJ 1
+#define GPFS_ACL_GROUP_OBJ 2
+#define GPFS_ACL_OTHER 3
+#define GPFS_ACL_MASK 4
+#define GPFS_ACL_USER 5
+#define GPFS_ACL_GROUP 6
+
+/* Values for gpfs_acePerm_t (ACL_VERSION_POSIX) */
+#define ACL_PERM_EXECUTE 001
+#define ACL_PERM_WRITE 002
+#define ACL_PERM_READ 004
+#define ACL_PERM_CONTROL 010
+
+/* Values for gpfs_aceType_t (ACL_VERSION_NFS4) */
+#define ACE4_TYPE_ALLOW 0
+#define ACE4_TYPE_DENY 1
+#define ACE4_TYPE_AUDIT 2
+#define ACE4_TYPE_ALARM 3
+
+/* Values for gpfs_aceFlags_t (ACL_VERSION_NFS4) */
+#define ACE4_FLAG_FILE_INHERIT 0x00000001
+#define ACE4_FLAG_DIR_INHERIT 0x00000002
+#define ACE4_FLAG_NO_PROPAGATE 0x00000004
+#define ACE4_FLAG_INHERIT_ONLY 0x00000008
+#define ACE4_FLAG_SUCCESSFUL 0x00000010
+#define ACE4_FLAG_FAILED 0x00000020
+#define ACE4_FLAG_GROUP_ID 0x00000040
+#define ACE4_FLAG_INHERITED 0x00000080
+
+/* GPFS-defined flags. Placed in a separate ACL field to avoid
+ ever running into newly defined NFSv4 flags. */
+#define ACE4_IFLAG_SPECIAL_ID 0x80000000
+
+/* Values for gpfs_aceMask_t (ACL_VERSION_NFS4) */
+#define ACE4_MASK_READ 0x00000001
+#define ACE4_MASK_LIST_DIR 0x00000001
+#define ACE4_MASK_WRITE 0x00000002
+#define ACE4_MASK_ADD_FILE 0x00000002
+#define ACE4_MASK_APPEND 0x00000004
+#define ACE4_MASK_ADD_SUBDIR 0x00000004
+#define ACE4_MASK_READ_NAMED 0x00000008
+#define ACE4_MASK_WRITE_NAMED 0x00000010
+#define ACE4_MASK_EXECUTE 0x00000020
+
+/* The rfc doesn't provide a mask equivalent to "search" ("x" on a
+ * directory in posix), but it also doesn't say that its EXECUTE
+ * is to have this dual use (even though it does so for other dual
+ * use permissions such as read/list. Going to make the assumption
+ * here that the EXECUTE bit has this dual meaning... otherwise
+ * we're left with no control over search.
+ */
+#define ACE4_MASK_SEARCH 0x00000020
+
+#define ACE4_MASK_DELETE_CHILD 0x00000040
+#define ACE4_MASK_READ_ATTR 0x00000080
+#define ACE4_MASK_WRITE_ATTR 0x00000100
+#define ACE4_MASK_DELETE 0x00010000
+#define ACE4_MASK_READ_ACL 0x00020000
+#define ACE4_MASK_WRITE_ACL 0x00040000
+#define ACE4_MASK_WRITE_OWNER 0x00080000
+#define ACE4_MASK_SYNCHRONIZE 0x00100000
+#define ACE4_MASK_ALL 0x001f01ff
+
+/* Values for gpfs_uid_t (ACL_VERSION_NFS4) */
+#define ACE4_SPECIAL_OWNER 1
+#define ACE4_SPECIAL_GROUP 2
+#define ACE4_SPECIAL_EVERYONE 3
+
+/* per-ACL flags imported from a Windows security descriptor object */
+#define ACL4_FLAG_OWNER_DEFAULTED 0x00000100
+#define ACL4_FLAG_GROUP_DEFAULTED 0x00000200
+#define ACL4_FLAG_DACL_PRESENT 0x00000400
+#define ACL4_FLAG_DACL_DEFAULTED 0x00000800
+#define ACL4_FLAG_SACL_PRESENT 0x00001000
+#define ACL4_FLAG_SACL_DEFAULTED 0x00002000
+#define ACL4_FLAG_DACL_UNTRUSTED 0x00004000
+#define ACL4_FLAG_SERVER_SECURITY 0x00008000
+#define ACL4_FLAG_DACL_AUTO_INHERIT_REQ 0x00010000
+#define ACL4_FLAG_SACL_AUTO_INHERIT_REQ 0x00020000
+#define ACL4_FLAG_DACL_AUTO_INHERITED 0x00040000
+#define ACL4_FLAG_SACL_AUTO_INHERITED 0x00080000
+#define ACL4_FLAG_DACL_PROTECTED 0x00100000
+#define ACL4_FLAG_SACL_PROTECTED 0x00200000
+#define ACL4_FLAG_RM_CONTROL_VALID 0x00400000
+#define ACL4_FLAG_NULL_DACL 0x00800000
+#define ACL4_FLAG_NULL_SACL 0x01000000
+#define ACL4_FLAG_VALID_FLAGS 0x01ffff00
+
+
+/* Externalized ACL defintions */
+typedef unsigned int gpfs_aclType_t;
+typedef unsigned int gpfs_aclLen_t;
+typedef unsigned int gpfs_aclLevel_t;
+typedef unsigned int gpfs_aclVersion_t;
+typedef unsigned int gpfs_aclCount_t;
+typedef unsigned int gpfs_aclFlag_t;
+
+typedef unsigned int gpfs_aceType_t;
+typedef unsigned int gpfs_aceFlags_t;
+typedef unsigned int gpfs_acePerm_t;
+typedef unsigned int gpfs_aceMask_t;
+
+/* A POSIX ACL Entry */
+typedef struct gpfs_ace_v1
+{
+ gpfs_aceType_t ace_type; /* POSIX ACE type */
+ gpfs_uid_t ace_who; /* uid/gid */
+ gpfs_acePerm_t ace_perm; /* POSIX permissions */
+} gpfs_ace_v1_t;
+
+/* An NFSv4 ACL Entry */
+typedef struct gpfs_ace_v4
+{
+ gpfs_aceType_t aceType; /* Allow or Deny */
+ gpfs_aceFlags_t aceFlags; /* Inherit specifications, etc. */
+ gpfs_aceFlags_t aceIFlags; /* GPFS Internal flags */
+ gpfs_aceMask_t aceMask; /* NFSv4 mask specification */
+ gpfs_uid_t aceWho; /* User/Group identification */
+} gpfs_ace_v4_t;
+
+/* when GPFS_ACL_VERSION_NFS4, and GPFS_ACL_LEVEL_V4FLAGS */
+typedef struct v4Level1_ext /* ACL extension */
+{
+ gpfs_aclFlag_t acl_flags; /* per-ACL flags */
+ gpfs_ace_v4_t ace_v4[1];
+} v4Level1_t;
+
+/* The GPFS ACL */
+typedef struct gpfs_acl
+{
+ gpfs_aclLen_t acl_len; /* Total length of this ACL in bytes */
+ gpfs_aclLevel_t acl_level; /* Reserved (must be zero) */
+ gpfs_aclVersion_t acl_version; /* POSIX or NFS4 ACL */
+ gpfs_aclType_t acl_type; /* Access, Default, or NFS4 */
+ gpfs_aclCount_t acl_nace; /* Number of Entries that follow */
+ union
+ {
+ gpfs_ace_v1_t ace_v1[1]; /* when GPFS_ACL_VERSION_POSIX */
+ gpfs_ace_v4_t ace_v4[1]; /* when GPFS_ACL_VERSION_NFS4 */
+ v4Level1_t v4Level1; /* when GPFS_ACL_LEVEL_V4FLAGS */
+ };
+} gpfs_acl_t;
+
+
+/* NAME: gpfs_getacl()
+ *
+ * FUNCTION: Retrieves the ACL information for a file.
+ *
+ * The aclP parameter must point to a buffer mapped by either:
+ * - gpfs_opaque_acl_t (when flags are zero). In this case,
+ * the opaque data that is intended to be used by a backup
+ * program (restoreed by passing this data back on a subsequent
+ * call to gpfs_putacl).
+ * - gpfs_acl_t (when GPFS_GETACL_STRUCT is specified). In this
+ * case, the data can be interpreted by the calling application
+ * (and may be modified and applied to the file by passing it
+ * to gpfs_putacl...along with the GPFS_PUTACL_STRUCT flag).
+ *
+ * On input, the first four bytes of the buffer must contain its
+ * total size.
+ *
+ * Returns: 0 Successful
+ * -1 Failure
+ *
+ * Errno: ENOSYS function not available
+ * ENOSPC buffer too small to return the entire ACL.
+ * Needed size is returned in the first four
+ * bytes of the buffer pointed to by aclP.
+ * EINVAL Invalid arguments
+ * ENOTDIR Not on directory
+ * ENOMEM Out of memory
+ */
+int GPFS_API
+gpfs_getacl(const char *pathname,
+ int flags,
+ void *acl);
+
+
+/* NAME: gpfs_putacl()
+ *
+ * FUNCTION: Sets the ACL information for a file.
+ * The buffer passed in should contain the ACL data
+ * that was obtained by a previous call to gpfs_getacl.
+ *
+ * Returns: 0 Successful
+ * -1 Failure
+ *
+ * Errno: ENOSYS function not available
+ * EINVAL Invalid arguments
+ * ENOTDIR Not on directory
+ * ENOMEM Out of memory
+ * EPERM Caller does not hold appropriate privilege
+ */
+int GPFS_API
+gpfs_putacl(const char *pathname,
+ int flags,
+ void *acl);
+
+
+/* NAME: gpfs_prealloc()
+ *
+ * FUNCTION: Preallocate disk storage for a file or directory, starting
+ * at the specified startOffset and covering at least the number
+ * of bytes requested by bytesToPrealloc. Allocations are rounded
+ * to block boundaries (block size can be found in st_blksize
+ * returned by fstat()), or possibly larger sizes. For files, the
+ * file descriptor must be open for write, but any existing data
+ * already present will not be modified. Reading the preallocated
+ * blocks will return zeros. For directories, the file descriptor
+ * may be open for read but the caller must have write permission,
+ * and existing entries are unaffected; startOffset must be zero.
+ *
+ * This function implements the behavior of mmchattr when invoked
+ * with --compact[=minimumEntries]. The minimumEntries value
+ * specifies both the lower bound on automatic compaction and the
+ * desired size for pre-allocation. It defaults to zero, meaning
+ * no pre-allocation and compact the directory as much as
+ * possible. The mapping between minimumEntries and the
+ * bytesToPrealloc is given by GPFS_PREALLOC_DIR_SLOT_SIZE, see
+ * below.
+ *
+ * Directory compaction (zero bytesToPrealloc) requires a file
+ * system supporting V2 directories (format version 1400, v4.1).
+ * Directories created before upgrading the file system to version
+ * 4.1, are upgraded from V1 to V2 by this operation even if no
+ * other change is made. Since v4.2.2, bytesToPrealloc may be
+ * nonzero effecting pre-allocation by setting a minimum
+ * compaction size. Prior to v4.2.2 the minimum size of any
+ * directory is zero.
+ *
+ * Returns: 0 Success
+ * -1 Failure
+ *
+ * Errno: ENOSYS No prealloc service available
+ * EBADF Bad file descriptor
+ * EINVAL Not a GPFS file
+ * EINVAL Not a regular file or directory
+ * EINVAL Directory pre-allocation not supported
+ * EINVAL startOffset or bytesToPrealloc < 0
+ * EACCES File not opened for writing
+ * EACCES Caller does not have write access to directory.
+ * EDQUOT Quota exceeded
+ * ENOSPC Not enough space on disk
+ * EPERM File is in a snapshot
+ */
+int GPFS_API
+gpfs_prealloc(gpfs_file_t fileDesc,
+ gpfs_off64_t startOffset,
+ gpfs_off64_t bytesToPrealloc);
+
+/* Directory entries are nominally (assuming compact names of 19 bytes or less)
+ 32 bytes in size. This conversion factor is used in mapping between a
+ number of entries (for mmchattr) and a size when calling gpfs_prealloc. */
+#define GPFS_PREALLOC_DIR_SLOT_SIZE 32 /* for size => bytes per entry */
+
+
+typedef struct gpfs_winattr
+{
+ gpfs_timestruc_t creationTime;
+ unsigned int winAttrs; /* values as defined below */
+} gpfs_winattr_t;
+
+/* winAttrs values */
+#define GPFS_WINATTR_ARCHIVE 0x0001
+#define GPFS_WINATTR_COMPRESSED 0x0002
+#define GPFS_WINATTR_DEVICE 0x0004
+#define GPFS_WINATTR_DIRECTORY 0x0008
+#define GPFS_WINATTR_ENCRYPTED 0x0010
+#define GPFS_WINATTR_HIDDEN 0x0020
+#define GPFS_WINATTR_NORMAL 0x0040
+#define GPFS_WINATTR_NOT_CONTENT_INDEXED 0x0080
+#define GPFS_WINATTR_OFFLINE 0x0100
--
Samba Shared Repository
More information about the samba-cvs
mailing list