]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Make disk_quotas() take a fsp
authorVolker Lendecke <vl@samba.org>
Wed, 28 Jan 2026 14:26:47 +0000 (15:26 +0100)
committerAnoop C S <anoopcs@samba.org>
Sun, 15 Feb 2026 10:42:34 +0000 (10:42 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/smbd/dfree.c
source3/smbd/proto.h
source3/smbd/quotas.c

index 15db88adbd6ca91d51d5e23dd45df0e4107ad7c0..7d89acc3d298326713e1541e6b9a00cc61fc5818 100644 (file)
@@ -155,7 +155,7 @@ static uint64_t sys_disk_free(struct files_struct *fsp,
                return (uint64_t)-1;
        }
 
-       if (disk_quotas(conn, fname, &bsize_q, &dfree_q, &dsize_q)) {
+       if (disk_quotas(conn, fsp, &bsize_q, &dfree_q, &dsize_q)) {
                uint64_t min_bsize = MIN(*bsize, bsize_q);
 
                (*dfree) = (*dfree) * (*bsize) / min_bsize;
index b30e4c858c43457224dcfb68d9a02e300109fe72..2216445767f1a798cf0cc698d8af630c888c5f35 100644 (file)
@@ -877,8 +877,11 @@ bool init_smb1_request(struct smb_request *req,
 
 /* The following definitions come from smbd/quotas.c  */
 
-bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
-                uint64_t *bsize, uint64_t *dfree, uint64_t *dsize);
+bool disk_quotas(connection_struct *conn,
+                struct files_struct *fsp,
+                uint64_t *bsize,
+                uint64_t *dfree,
+                uint64_t *dsize);
 
 /* The following definitions come from smbd/smb2_reply.c  */
 
index 40fb3ee3c07f13c49767be817a40997ed00e37a2..e73e2982c1c3591e4468a973aa7b6912192d69e1 100644 (file)
@@ -216,9 +216,13 @@ try to get the disk space from disk quotas (SunOS & Solaris2 version)
 Quota code by Peter Urbanec (amiga@cse.unsw.edu.au).
 ****************************************************************************/
 
-bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
-                uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
+bool disk_quotas(connection_struct *conn,
+                struct files_struct *fsp,
+                uint64_t *bsize,
+                uint64_t *dfree,
+                uint64_t *dsize)
 {
+       struct smb_filename *fname = fsp->fsp_name;
        uid_t euser_id;
        int ret;
        struct dqblk D;
@@ -339,8 +343,11 @@ bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
 
 #else /* WITH_QUOTAS */
 
-bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
-                uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
+bool disk_quotas(connection_struct *conn,
+                struct files_struct *fsp,
+                uint64_t *bsize,
+                uint64_t *dfree,
+                uint64_t *dsize)
 {
        (*bsize) = 512; /* This value should be ignored */
 
@@ -358,9 +365,13 @@ bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
 /* wrapper to the new sys_quota interface
    this file should be removed later
    */
-bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
-                uint64_t *bsize, uint64_t *dfree, uint64_t *dsize)
+bool disk_quotas(connection_struct *conn,
+                struct files_struct *fsp,
+                uint64_t *bsize,
+                uint64_t *dfree,
+                uint64_t *dsize)
 {
+       struct smb_filename *fname = fsp->fsp_name;
        int r;
        SMB_DISK_QUOTA D;
        unid_t id;