uint64_t *bsize, uint64_t *dfree,
uint64_t *dsize)
{
- uint64_t result;
+ if (sys_fsusage(path, dfree, dsize) != 0) {
+ return (uint64_t)-1;
+ }
- result = sys_disk_free(handle->conn, path, bsize, dfree, dsize);
- return result;
+ *bsize = 512;
+ return *dfree / 2;
}
static int vfswrap_get_quota(struct vfs_handle_struct *handle, const char *path,
syscmd, strerror(errno) ));
}
- if (sys_fsusage(path, dfree, dsize) != 0) {
- DEBUG (0, ("disk_free: sys_fsusage() failed. Error was : %s\n",
- strerror(errno) ));
+ if (SMB_VFS_DISK_FREE(conn, path, bsize, dfree, dsize) ==
+ (uint64_t)-1) {
+ DBG_ERR("VFS disk_free failed. Error was : %s\n",
+ strerror(errno));
return (uint64_t)-1;
}
- if (disk_quotas(path, &bsize_q, &dfree_q, &dsize_q)) {
+ if (disk_quotas(conn, path, &bsize_q, &dfree_q, &dsize_q)) {
(*bsize) = bsize_q;
(*dfree) = MIN(*dfree,dfree_q);
(*dsize) = MIN(*dsize,dsize_q);
uint64_t dfree_ret;
if (!dfree_cache_time) {
- return SMB_VFS_DISK_FREE(conn, path, bsize, dfree, dsize);
+ return sys_disk_free(conn, path, bsize, dfree, dsize);
}
if (dfc && (conn->lastused - dfc->last_dfree_time < dfree_cache_time)) {
return dfc->dfree_ret;
}
- dfree_ret = SMB_VFS_DISK_FREE(conn, path, bsize, dfree, dsize);
+ dfree_ret = sys_disk_free(conn, path, bsize, dfree, dsize);
if (dfree_ret == (uint64_t)-1) {
/* Don't cache bad data. */
/* The following definitions come from smbd/quotas.c */
-bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
+bool disk_quotas(connection_struct *conn, const char *path, uint64_t *bsize,
+ uint64_t *dfree, uint64_t *dsize);
bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
/* The following definitions come from smbd/reply.c */
Quota code by Peter Urbanec (amiga@cse.unsw.edu.au).
****************************************************************************/
-bool disk_quotas(const char *path,
- uint64_t *bsize,
- uint64_t *dfree,
- uint64_t *dsize)
+bool disk_quotas(connection_struct *conn, const char *path, uint64_t *bsize,
+ uint64_t *dfree, uint64_t *dsize)
{
uid_t euser_id;
int ret;
try to get the disk space from disk quotas - default version
****************************************************************************/
-bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
+bool disk_quotas(connection_struct *conn, const char *path, uint64_t *bsize,
+ uint64_t *dfree, uint64_t *dsize)
{
int r;
struct dqblk D;
#else /* WITH_QUOTAS */
-bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize)
+bool disk_quotas(connection_struct *conn, const char *path, uint64_t *bsize,
+ uint64_t *dfree, uint64_t *dsize)
{
(*bsize) = 512; /* This value should be ignored */
/* wrapper to the new sys_quota interface
this file should be removed later
*/
-bool disk_quotas(const char *path,uint64_t *bsize,uint64_t *dfree,uint64_t *dsize)
+bool disk_quotas(connection_struct *conn, const char *path, uint64_t *bsize,
+ uint64_t *dfree, uint64_t *dsize)
{
int r;
SMB_DISK_QUOTA D;
id.uid = geteuid();
ZERO_STRUCT(D);
- r=sys_get_quota(path, SMB_USER_QUOTA_TYPE, id, &D);
+ r = SMB_VFS_GET_QUOTA(conn, path, SMB_USER_QUOTA_TYPE, id, &D);
/* Use softlimit to determine disk space, except when it has been exceeded */
*bsize = D.bsize;
id.gid = getegid();
ZERO_STRUCT(D);
- r=sys_get_quota(path, SMB_GROUP_QUOTA_TYPE, id, &D);
+ r = SMB_VFS_GET_QUOTA(conn, path, SMB_GROUP_QUOTA_TYPE, id, &D);
/* Use softlimit to determine disk space, except when it has been exceeded */
*bsize = D.bsize;