return 0;
}
-static int skel_get_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype,
- unid_t id, SMB_DISK_QUOTA *dq)
+static int skel_get_quota(vfs_handle_struct *handle, const char *path,
+ enum SMB_QUOTA_TYPE qtype, unid_t id,
+ SMB_DISK_QUOTA *dq)
{
errno = ENOSYS;
return -1;
return SMB_VFS_NEXT_DISK_FREE(handle, path, bsize, dfree, dsize);
}
-static int skel_get_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype,
- unid_t id, SMB_DISK_QUOTA *dq)
+static int skel_get_quota(vfs_handle_struct *handle, const char *path,
+ enum SMB_QUOTA_TYPE qtype, unid_t id,
+ SMB_DISK_QUOTA *dq)
{
- return SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, dq);
+ return SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, dq);
}
static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype,
void (*disconnect_fn)(struct vfs_handle_struct *handle);
uint64_t (*disk_free_fn)(struct vfs_handle_struct *handle, const char *path, uint64_t *bsize,
uint64_t *dfree, uint64_t *dsize);
- int (*get_quota_fn)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
+ int (*get_quota_fn)(struct vfs_handle_struct *handle, const char *path,
+ enum SMB_QUOTA_TYPE qtype, unid_t id,
+ SMB_DISK_QUOTA *qt);
int (*set_quota_fn)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
int (*get_shadow_copy_data_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, struct shadow_copy_data *shadow_copy_data, bool labels);
int (*statvfs_fn)(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf);
uint64_t smb_vfs_call_disk_free(struct vfs_handle_struct *handle,
const char *path, uint64_t *bsize,
uint64_t *dfree, uint64_t *dsize);
-int smb_vfs_call_get_quota(struct vfs_handle_struct *handle,
+int smb_vfs_call_get_quota(struct vfs_handle_struct *handle, const char *path,
enum SMB_QUOTA_TYPE qtype, unid_t id,
SMB_DISK_QUOTA *qt);
int smb_vfs_call_set_quota(struct vfs_handle_struct *handle,
#define SMB_VFS_NEXT_DISK_FREE(handle, path, bsize, dfree ,dsize)\
smb_vfs_call_disk_free((handle)->next, (path), (bsize), (dfree), (dsize))
-#define SMB_VFS_GET_QUOTA(conn, qtype, id, qt) \
- smb_vfs_call_get_quota((conn)->vfs_handles, (qtype), (id), (qt))
-#define SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, qt) \
- smb_vfs_call_get_quota((handle)->next, (qtype), (id), (qt))
+#define SMB_VFS_GET_QUOTA(conn, path, qtype, id, qt) \
+ smb_vfs_call_get_quota((conn)->vfs_handles, (path), (qtype), (id), (qt))
+#define SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, qt) \
+ smb_vfs_call_get_quota((handle)->next, (path), (qtype), (id), (qt))
#define SMB_VFS_SET_QUOTA(conn, qtype, id, qt) \
smb_vfs_call_set_quota((conn)->vfs_handles, (qtype), (id), (qt))
}
}
-static int cephwrap_get_quota(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt)
+static int cephwrap_get_quota(struct vfs_handle_struct *handle,
+ const char *path, enum SMB_QUOTA_TYPE qtype,
+ unid_t id, SMB_DISK_QUOTA *qt)
{
/* libceph: Ceph does not implement this */
#if 0
return result;
}
-static int vfswrap_get_quota(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt)
+static int vfswrap_get_quota(struct vfs_handle_struct *handle, const char *path,
+ enum SMB_QUOTA_TYPE qtype, unid_t id,
+ SMB_DISK_QUOTA *qt)
{
#ifdef HAVE_SYS_QUOTAS
int result;
START_PROFILE(syscall_get_quota);
- result = sys_get_quota(handle->conn->connectpath, qtype, id, qt);
+ result = sys_get_quota(path, qtype, id, qt);
END_PROFILE(syscall_get_quota);
return result;
#else
#define DEFAULT_QUOTA_GID_NOLIMIT(handle) \
lp_parm_bool(SNUM((handle)->conn),DEFAULT_QUOTA_NAME,"gid nolimit",DEFAULT_QUOTA_GID_NOLIMIT_DEFAULT)
-static int default_quota_get_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq)
+static int default_quota_get_quota(vfs_handle_struct *handle, const char *path,
+ enum SMB_QUOTA_TYPE qtype, unid_t id,
+ SMB_DISK_QUOTA *dq)
{
int ret = -1;
- if ((ret=SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, dq))!=0) {
+ if ((ret = SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, dq)) != 0) {
return ret;
}
unid_t qid;
uint32_t qflags = dq->qflags;
qid.uid = DEFAULT_QUOTA_UID(handle);
- SMB_VFS_NEXT_GET_QUOTA(handle, SMB_USER_QUOTA_TYPE, qid, dq);
+ SMB_VFS_NEXT_GET_QUOTA(
+ handle, path, SMB_USER_QUOTA_TYPE, qid, dq);
dq->qflags = qflags;
}
break;
unid_t qid;
uint32_t qflags = dq->qflags;
qid.gid = DEFAULT_QUOTA_GID(handle);
- SMB_VFS_NEXT_GET_QUOTA(handle, SMB_GROUP_QUOTA_TYPE, qid, dq);
+ SMB_VFS_NEXT_GET_QUOTA(handle, path,
+ SMB_GROUP_QUOTA_TYPE,
+ qid, dq);
dq->qflags = qflags;
}
break;
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_VFS
-static int dfq_get_quota_do(struct vfs_handle_struct *handle, const char *path,
- enum SMB_QUOTA_TYPE qtype, unid_t id,
- SMB_DISK_QUOTA *qt);
+static int dfq_get_quota(struct vfs_handle_struct *handle, const char *path,
+ enum SMB_QUOTA_TYPE qtype, unid_t id,
+ SMB_DISK_QUOTA *qt);
static uint64_t dfq_load_param(int snum, const char *path, const char *section,
const char *param, uint64_t def_val)
id.uid = geteuid();
ZERO_STRUCT(D);
- r = dfq_get_quota_do(handle, path, SMB_USER_QUOTA_TYPE, id, &D);
+ r = dfq_get_quota(handle, path, SMB_USER_QUOTA_TYPE, id, &D);
/* Use softlimit to determine disk space, except when it has been
* exceeded */
id.gid = getegid();
ZERO_STRUCT(D);
- r = dfq_get_quota_do(handle, path, SMB_GROUP_QUOTA_TYPE, id, &D);
+ r = dfq_get_quota(handle, path, SMB_GROUP_QUOTA_TYPE, id, &D);
/* Use softlimit to determine disk space, except when it has been
* exceeded */
return free_1k;
}
-static int dfq_get_quota_do(struct vfs_handle_struct *handle, const char *path,
- enum SMB_QUOTA_TYPE qtype, unid_t id,
- SMB_DISK_QUOTA *qt)
+static int dfq_get_quota(struct vfs_handle_struct *handle, const char *path,
+ enum SMB_QUOTA_TYPE qtype, unid_t id,
+ SMB_DISK_QUOTA *qt)
{
int rc = 0;
int save_errno;
goto out;
dflt:
- rc = SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, qt);
+ rc = SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, qt);
out:
save_errno = errno;
return rc;
}
-static int dfq_get_quota(struct vfs_handle_struct *handle,
- enum SMB_QUOTA_TYPE qtype, unid_t id,
- SMB_DISK_QUOTA *qt)
-{
- return dfq_get_quota_do(handle, handle->conn->connectpath, qtype, id,
- qt);
-}
-
struct vfs_fn_pointers vfs_fake_dfq_fns = {
/* Disk operations */
}
static int smb_full_audit_get_quota(struct vfs_handle_struct *handle,
- enum SMB_QUOTA_TYPE qtype, unid_t id,
- SMB_DISK_QUOTA *qt)
+ const char *path, enum SMB_QUOTA_TYPE qtype,
+ unid_t id, SMB_DISK_QUOTA *qt)
{
int result;
- result = SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, qt);
+ result = SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, qt);
- do_log(SMB_VFS_OP_GET_QUOTA, (result >= 0), handle, "");
+ do_log(SMB_VFS_OP_GET_QUOTA, (result >= 0), handle, "%s", path);
return result;
}
}
static int smb_time_audit_get_quota(struct vfs_handle_struct *handle,
- enum SMB_QUOTA_TYPE qtype, unid_t id,
- SMB_DISK_QUOTA *qt)
+ const char *path, enum SMB_QUOTA_TYPE qtype,
+ unid_t id, SMB_DISK_QUOTA *qt)
{
int result;
struct timespec ts1,ts2;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, qt);
+ result = SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, qt);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
sid_string_dbg(psid)));
}
- ret = SMB_VFS_GET_QUOTA(fsp->conn, qtype, id, &D);
+ ret = SMB_VFS_GET_QUOTA(fsp->conn, ".", qtype, id, &D);
if (psid)
qt->sid = *psid;
return handle->fns->disk_free_fn(handle, path, bsize, dfree, dsize);
}
-int smb_vfs_call_get_quota(struct vfs_handle_struct *handle,
+int smb_vfs_call_get_quota(struct vfs_handle_struct *handle, const char *path,
enum SMB_QUOTA_TYPE qtype, unid_t id,
SMB_DISK_QUOTA *qt)
{
VFS_FIND(get_quota);
- return handle->fns->get_quota_fn(handle, qtype, id, qt);
+ return handle->fns->get_quota_fn(handle, path, qtype, id, qt);
}
int smb_vfs_call_set_quota(struct vfs_handle_struct *handle,