summaryrefslogtreecommitdiff
path: root/source3/include
diff options
context:
space:
mode:
authorDerrell Lipman <derrell.lipman@unwireduniverse.com>2009-02-12 10:39:17 -0500
committerDerrell Lipman <derrell.lipman@unwireduniverse.com>2009-02-12 10:39:48 -0500
commitae259575c447e61665c8e7070c476914161b953f (patch)
tree4193eb1193c1b3e7625cd01fda6f742d896635e1 /source3/include
parent082ba6a1ad3a68aff118d96f855a2aa65eaeb359 (diff)
downloadsamba-ae259575c447e61665c8e7070c476914161b953f.tar.gz
samba-ae259575c447e61665c8e7070c476914161b953f.tar.bz2
samba-ae259575c447e61665c8e7070c476914161b953f.zip
[Bug 6069] Add a fstatvfs function for libsmbclient
- port functionality from v3_3_test to master Derrell
Diffstat (limited to 'source3/include')
-rw-r--r--source3/include/includes.h1
-rw-r--r--source3/include/libsmb_internal.h14
-rw-r--r--source3/include/libsmbclient.h75
-rw-r--r--source3/include/proto.h15
4 files changed, 105 insertions, 0 deletions
diff --git a/source3/include/includes.h b/source3/include/includes.h
index fc77534402..2c033e8b69 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -396,6 +396,7 @@ typedef sig_atomic_t volatile SIG_ATOMIC_T;
#endif
#define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
+#define BIG_UINT(p, ofs) ((((uint64_t) IVAL(p,(ofs)+4))<<32)|IVAL(p,ofs))
#define IVAL2_TO_SMB_BIG_UINT(buf,off) ( (((uint64_t)(IVAL((buf),(off)))) & ((uint64_t)0xFFFFFFFF)) | \
(( ((uint64_t)(IVAL((buf),(off+4)))) & ((uint64_t)0xFFFFFFFF) ) << 32 ) )
diff --git a/source3/include/libsmb_internal.h b/source3/include/libsmb_internal.h
index 67add074bf..166685c380 100644
--- a/source3/include/libsmb_internal.h
+++ b/source3/include/libsmb_internal.h
@@ -197,6 +197,8 @@ struct SMBC_internal_data {
smbc_stat_fn stat_fn;
smbc_fstat_fn fstat_fn;
#endif
+ smbc_statvfs_fn statvfs_fn;
+ smbc_fstatvfs_fn fstatvfs_fn;
smbc_ftruncate_fn ftruncate_fn;
#if 0 /* Left in libsmbclient.h for backward compatibility */
smbc_close_fn close_fn;
@@ -501,6 +503,18 @@ SMBC_fstat_ctx(SMBCCTX *context,
struct stat *st);
+int
+SMBC_statvfs_ctx(SMBCCTX *context,
+ char *path,
+ struct statvfs *st);
+
+
+int
+SMBC_fstatvfs_ctx(SMBCCTX *context,
+ SMBCFILE *file,
+ struct statvfs *st);
+
+
/* Functions in libsmb_xattr.c */
int
SMBC_setxattr_ctx(SMBCCTX *context,
diff --git a/source3/include/libsmbclient.h b/source3/include/libsmbclient.h
index b2d9483a0b..d35d9de6ea 100644
--- a/source3/include/libsmbclient.h
+++ b/source3/include/libsmbclient.h
@@ -75,6 +75,7 @@ extern "C" {
/* Make sure we have the following includes for now ... */
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/statvfs.h>
#include <fcntl.h>
#include <utime.h>
@@ -174,6 +175,22 @@ typedef enum smbc_smb_encrypt_level
} smbc_smb_encrypt_level;
+/**
+ * Capabilities set in the f_flag field of struct statvfs, from
+ * smbc_statvfs(). These may be OR-ed together to reflect a full set of
+ * available capabilities.
+ */
+typedef enum smbc_vfs_feature
+{
+ /* Defined by POSIX or in Linux include files (low-order bits) */
+ SMBC_VFS_FEATURE_RDONLY = (1 << 0),
+
+ /* Specific to libsmbclient (high-order bits) */
+ SMBC_VFS_FEATURE_DFS = (1 << 29),
+ SMBC_VFS_FEATURE_CASE_INSENSITIVE = (1 << 30),
+ SMBC_VFS_FEATURE_NO_UNIXCIFS = (1 << 31)
+} smbc_vfs_feature;
+
typedef int smbc_bool;
@@ -853,6 +870,18 @@ typedef int (*smbc_fstat_fn)(SMBCCTX *c,
smbc_fstat_fn smbc_getFunctionFstat(SMBCCTX *c);
void smbc_setFunctionFstat(SMBCCTX *c, smbc_fstat_fn fn);
+typedef int (*smbc_statvfs_fn)(SMBCCTX *c,
+ char *path,
+ struct statvfs *st);
+smbc_statvfs_fn smbc_getFunctionStatVFS(SMBCCTX *c);
+void smbc_setFunctionStatVFS(SMBCCTX *c, smbc_statvfs_fn fn);
+
+typedef int (*smbc_fstatvfs_fn)(SMBCCTX *c,
+ SMBCFILE *file,
+ struct statvfs *st);
+smbc_fstatvfs_fn smbc_getFunctionFstatVFS(SMBCCTX *c);
+void smbc_setFunctionFstatVFS(SMBCCTX *c, smbc_fstatvfs_fn fn);
+
typedef int (*smbc_ftruncate_fn)(SMBCCTX *c,
SMBCFILE *f,
off_t size);
@@ -1592,6 +1621,52 @@ int smbc_fstat(int fd, struct stat *st);
/**@ingroup attribute
+ * Get file system information for a specified path.
+ *
+ * @param url The smb url to get information for
+ *
+ * @param st pointer to a buffer that will be filled with
+ * standard Unix struct statvfs information.
+ *
+ * @return EBADF filedes is bad.
+ * - EACCES Permission denied.
+ * - EBADF fd is not a valid file descriptor
+ * - EINVAL Problems occurred in the underlying routines
+ * or smbc_init not called.
+ * - ENOMEM Out of memory
+ *
+ * @see Unix fstatvfs()
+ *
+ */
+int
+smbc_statvfs(char *url,
+ struct statvfs *st);
+
+/**@ingroup attribute
+ * Get file system information via an file descriptor.
+ *
+ * @param fd Open file handle from smbc_open(), smbc_creat(),
+ * or smbc_opendir()
+ *
+ * @param st pointer to a buffer that will be filled with
+ * standard Unix struct statvfs information.
+ *
+ * @return EBADF filedes is bad.
+ * - EACCES Permission denied.
+ * - EBADF fd is not a valid file descriptor
+ * - EINVAL Problems occurred in the underlying routines
+ * or smbc_init not called.
+ * - ENOMEM Out of memory
+ *
+ * @see Unix fstatvfs()
+ *
+ */
+int
+smbc_fstatvfs(int fd,
+ struct statvfs *st);
+
+
+/**@ingroup attribute
* Truncate a file given a file descriptor
*
* @param fd Open file handle from smbc_open() or smbc_creat()
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 3478ea4f85..1b17e0246a 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -2606,6 +2606,21 @@ bool cli_set_unix_extensions_capabilities(struct cli_state *cli, uint16 major, u
bool cli_get_fs_attr_info(struct cli_state *cli, uint32 *fs_attr);
bool cli_get_fs_volume_info_old(struct cli_state *cli, fstring volume_name, uint32 *pserial_number);
bool cli_get_fs_volume_info(struct cli_state *cli, fstring volume_name, uint32 *pserial_number, time_t *pdate);
+bool cli_get_fs_full_size_info(struct cli_state *cli,
+ uint64_t *total_allocation_units,
+ uint64_t *caller_allocation_units,
+ uint64_t *actual_allocation_units,
+ uint64_t *sectors_per_allocation_unit,
+ uint64_t *bytes_per_sector);
+bool cli_get_posix_fs_info(struct cli_state *cli,
+ uint32 *optimal_transfer_size,
+ uint32 *block_size,
+ uint64_t *total_blocks,
+ uint64_t *blocks_available,
+ uint64_t *user_blocks_available,
+ uint64_t *total_file_nodes,
+ uint64_t *free_file_nodes,
+ uint64_t *fs_identifier);
NTSTATUS cli_raw_ntlm_smb_encryption_start(struct cli_state *cli,
const char *user,
const char *pass,