s4:kdc: Implement KDC plugin hardware authentication policy
[samba.git] / source3 / modules / vfs_default_quota.c
index d8e5009b0c4dabac09535b4e75444b1e221a6ce7..326eb8c8f0a79345be6d088fc17ecff3fe1a7908 100644 (file)
@@ -14,8 +14,7 @@
  * GNU General Public License for more details.
  *  
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -69,6 +68,7 @@
  */
 
 #include "includes.h"
+#include "smbd/smbd.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_QUOTA
 #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 struct smb_filename *smb_fname,
+                               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, smb_fname,
+                               qtype, id, dq)) != 0) {
                return ret;
        }
 
@@ -120,9 +125,10 @@ static int default_quota_get_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYP
                case SMB_USER_FS_QUOTA_TYPE:
                        {
                                unid_t qid;
-                               uint32 qflags = dq->qflags;
+                               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, smb_fname,
+                                       SMB_USER_QUOTA_TYPE, qid, dq);
                                dq->qflags = qflags;
                        }
                        break;
@@ -130,9 +136,11 @@ static int default_quota_get_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYP
                case SMB_GROUP_FS_QUOTA_TYPE:
                        {
                                unid_t qid;
-                               uint32 qflags = dq->qflags;
+                               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, smb_fname,
+                                                      SMB_GROUP_QUOTA_TYPE,
+                                                      qid, dq);
                                dq->qflags = qflags;
                        }
                        break;
@@ -215,17 +223,14 @@ static int default_quota_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYP
        return ret;
 }
 
-/* VFS operations structure */
-
-static vfs_op_tuple default_quota_ops[] = {    
-       {SMB_VFS_OP(default_quota_get_quota),   SMB_VFS_OP_GET_QUOTA,   SMB_VFS_LAYER_TRANSPARENT},
-       {SMB_VFS_OP(default_quota_set_quota),   SMB_VFS_OP_SET_QUOTA,   SMB_VFS_LAYER_TRANSPARENT},
-
-       {SMB_VFS_OP(NULL),                      SMB_VFS_OP_NOOP,        SMB_VFS_LAYER_NOOP}
+static struct vfs_fn_pointers vfs_default_quota_fns = {
+       .get_quota_fn = default_quota_get_quota,
+       .set_quota_fn = default_quota_set_quota
 };
 
-NTSTATUS vfs_default_quota_init(void);
-NTSTATUS vfs_default_quota_init(void)
+static_decl_vfs;
+NTSTATUS vfs_default_quota_init(TALLOC_CTX *ctx)
 {
-       return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, DEFAULT_QUOTA_NAME, default_quota_ops);
+       return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, DEFAULT_QUOTA_NAME,
+                               &vfs_default_quota_fns);
 }