2 #include <sys/statvfs.h>
8 #include <libsmbclient.h>
9 #include "get_auth_data_fn.h"
12 int main(int argc
, char * argv
[])
21 struct statvfs statvfsbuf
;
23 smbc_init(get_auth_data_fn
, debug
);
27 fprintf(stdout
, "Path: ");
29 fgets(path
, sizeof(path
) - 1, stdin
);
30 if (strlen(path
) == 0)
35 p
= path
+ strlen(path
) - 1;
41 /* Determine if it's a file or a folder */
42 if (smbc_stat(path
, &statbuf
) < 0)
48 if (S_ISREG(statbuf
.st_mode
))
50 if ((fd
= smbc_open(path
, O_RDONLY
, 0)) < 0)
58 if ((fd
= smbc_opendir(path
)) < 0)
60 perror("smbc_opendir");
65 ret
= smbc_fstatvfs(fd
, &statvfsbuf
);
76 printf("Block Size: %lu\n", statvfsbuf
.f_bsize
);
77 printf("Fragment Size: %lu\n", statvfsbuf
.f_frsize
);
78 printf("Blocks: %llu\n", statvfsbuf
.f_blocks
);
79 printf("Free Blocks: %llu\n", statvfsbuf
.f_bfree
);
80 printf("Available Blocks: %llu\n", statvfsbuf
.f_bavail
);
81 printf("Files : %llu\n", statvfsbuf
.f_files
);
82 printf("Free Files: %llu\n", statvfsbuf
.f_ffree
);
83 printf("Available Files: %llu\n", statvfsbuf
.f_favail
);
84 printf("File System ID: %lu\n", statvfsbuf
.f_fsid
);
87 printf("Flags: 0x%lx\n", statvfsbuf
.f_flag
);
88 printf("Extended Features: ");
90 if (statvfsbuf
.f_flag
& SMBC_VFS_FEATURE_NO_UNIXCIFS
)
92 printf("NO_UNIXCIFS ");
99 if (statvfsbuf
.f_flag
& SMBC_VFS_FEATURE_CASE_INSENSITIVE
)
101 printf("CASE_INSENSITIVE ");
105 printf("case_sensitive ");
108 if (statvfsbuf
.f_flag
& SMBC_VFS_FEATURE_NO_DFS
)