ctdb-daemon: Add control CTDB_CONTROL_DB_DETACH
[Samba/wip.git] / examples / libsmbclient / teststatvfs.c
blob2f656d5e645de799a005fb9a5914776a511ca521
1 #include <sys/types.h>
2 #include <sys/statvfs.h>
3 #include <stdio.h>
4 #include <unistd.h>
5 #include <string.h>
6 #include <time.h>
7 #include <errno.h>
8 #include <libsmbclient.h>
9 #include "get_auth_data_fn.h"
12 int main(int argc, char * argv[])
14 int ret;
15 int debug = 0;
16 char * p;
17 char path[2048];
18 struct statvfs statvfsbuf;
20 smbc_init(get_auth_data_fn, debug);
22 for (;;)
24 fprintf(stdout, "Path: ");
25 *path = '\0';
26 fgets(path, sizeof(path) - 1, stdin);
27 if (strlen(path) == 0)
29 return 0;
32 p = path + strlen(path) - 1;
33 if (*p == '\n')
35 *p = '\0';
38 ret = smbc_statvfs(path, &statvfsbuf);
40 if (ret < 0)
42 perror("fstatvfs");
44 else
46 printf("\n");
47 printf("Block Size: %lu\n", statvfsbuf.f_bsize);
48 printf("Fragment Size: %lu\n", statvfsbuf.f_frsize);
49 printf("Blocks: %llu\n",
50 (unsigned long long) statvfsbuf.f_blocks);
51 printf("Free Blocks: %llu\n",
52 (unsigned long long) statvfsbuf.f_bfree);
53 printf("Available Blocks: %llu\n",
54 (unsigned long long) statvfsbuf.f_bavail);
55 printf("Files : %llu\n",
56 (unsigned long long) statvfsbuf.f_files);
57 printf("Free Files: %llu\n",
58 (unsigned long long) statvfsbuf.f_ffree);
59 printf("Available Files: %llu\n",
60 (unsigned long long) statvfsbuf.f_favail);
61 #ifdef HAVE_FSID_INT
62 printf("File System ID: %lu\n",
63 (unsigned long) statvfsbuf.f_fsid);
64 #endif
65 printf("\n");
67 printf("Flags: 0x%lx\n", statvfsbuf.f_flag);
68 printf("Extended Features: ");
70 if (statvfsbuf.f_flag & SMBC_VFS_FEATURE_NO_UNIXCIFS)
72 printf("NO_UNIXCIFS ");
74 else
76 printf("unixcifs ");
79 if (statvfsbuf.f_flag & SMBC_VFS_FEATURE_CASE_INSENSITIVE)
81 printf("CASE_INSENSITIVE ");
83 else
85 printf("case_sensitive ");
88 if (statvfsbuf.f_flag & SMBC_VFS_FEATURE_DFS)
90 printf("DFS ");
92 else
94 printf("no_dfs ");
97 printf("\n");
101 return 0;