summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2014-06-04 14:12:38 -0700
committerJeremy Allison <jra@samba.org>2014-06-07 03:15:14 +0200
commit66a04ba7c115d3be111296000e93cc18a1a05ef6 (patch)
tree69a53e6cf365caf4f106b586a1bb9d296a886f4d
parent536c799f00d7bdd6a574b6bdbc0e9c742eeef8b5 (diff)
downloadsamba-66a04ba7c115d3be111296000e93cc18a1a05ef6.tar.gz
samba-66a04ba7c115d3be111296000e93cc18a1a05ef6.tar.xz
samba-66a04ba7c115d3be111296000e93cc18a1a05ef6.zip
s3: libsmb : Move users of cli_dskattr to a 64-bit interface cli_disk_free().
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
-rw-r--r--source3/client/client.c10
-rw-r--r--source3/libsmb/clifile.c26
-rw-r--r--source3/libsmb/proto.h1
-rw-r--r--source3/torture/nbio.c4
4 files changed, 35 insertions, 6 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index 592258ddf43..17985b9d2b8 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -298,7 +298,7 @@ static void send_message(const char *username)
static int do_dskattr(void)
{
- int total, bsize, avail;
+ uint64_t total, bsize, avail;
struct cli_state *targetcli = NULL;
char *targetpath = NULL;
TALLOC_CTX *ctx = talloc_tos();
@@ -312,14 +312,16 @@ static int do_dskattr(void)
return 1;
}
- status = cli_dskattr(targetcli, &bsize, &total, &avail);
+ status = cli_disk_size(targetcli, &bsize, &total, &avail);
if (!NT_STATUS_IS_OK(status)) {
d_printf("Error in dskattr: %s\n", nt_errstr(status));
return 1;
}
- d_printf("\n\t\t%d blocks of size %d. %d blocks available\n",
- total, bsize, avail);
+ d_printf("\n\t\t%" PRIu64
+ " blocks of size %" PRIu64
+ ". %" PRIu64 " blocks available\n",
+ total, bsize, avail);
return 0;
}
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index 70b769d1bd8..8bb1512f787 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -4132,6 +4132,32 @@ NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail)
return status;
}
+NTSTATUS cli_disk_size(struct cli_state *cli, uint64_t *bsize, uint64_t *total, uint64_t *avail)
+{
+ int old_bsize, old_total, old_avail;
+ NTSTATUS status;
+
+ if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) {
+ status = cli_smb2_dskattr(cli, &old_bsize, &old_total, &old_avail);
+ } else {
+ status = cli_dskattr(cli, &old_bsize, &old_total, &old_avail);
+ }
+
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ if (bsize) {
+ *bsize = (uint64_t)old_bsize;
+ }
+ if (total) {
+ *total = (uint64_t)old_total;
+ }
+ if (avail) {
+ *avail = (uint64_t)old_avail;
+ }
+ return NT_STATUS_OK;
+}
+
/****************************************************************************
Create and open a temporary file.
****************************************************************************/
diff --git a/source3/libsmb/proto.h b/source3/libsmb/proto.h
index 525625cd300..63d2df4a37c 100644
--- a/source3/libsmb/proto.h
+++ b/source3/libsmb/proto.h
@@ -516,6 +516,7 @@ struct tevent_req *cli_dskattr_send(TALLOC_CTX *mem_ctx,
NTSTATUS cli_dskattr_recv(struct tevent_req *req, int *bsize, int *total,
int *avail);
NTSTATUS cli_dskattr(struct cli_state *cli, int *bsize, int *total, int *avail);
+NTSTATUS cli_disk_size(struct cli_state *cli, uint64_t *bsize, uint64_t *total, uint64_t *avail);
struct tevent_req *cli_ctemp_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct cli_state *cli,
diff --git a/source3/torture/nbio.c b/source3/torture/nbio.c
index ba4fa955987..55dd8363b07 100644
--- a/source3/torture/nbio.c
+++ b/source3/torture/nbio.c
@@ -285,9 +285,9 @@ void nb_qfileinfo(int fnum)
void nb_qfsinfo(int level)
{
- int bsize, total, avail;
+ uint64_t bsize, total, avail;
/* this is not the right call - we need cli_qfsinfo() */
- cli_dskattr(c, &bsize, &total, &avail);
+ cli_disk_size(c, &bsize, &total, &avail);
}
static NTSTATUS find_fn(const char *mnt, struct file_info *finfo, const char *name,