vfs: Make function pointer names consistent. They all end in _fn
[ira/wip.git] / source3 / modules / vfs_default_quota.c
index 4636441999582155cc72958b7f87213e34eb6c7e..7b9b0c8470541ee609967a2bada548f9b14c6290 100644 (file)
@@ -5,7 +5,7 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *  
  * This program is distributed in the hope that it will be useful,
@@ -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/>.
  */
 
 /*
  * This module takes 2 parametric parameters in smb.conf:
  * (the default prefix for them is 'default_quota',
  *  it can be overwrittem when you load the module in
- *  the 'vfs modules' parameter like this:
- *  vfs modules = default_quota:myprefix)
+ *  the 'vfs objects' parameter like this:
+ *  vfs objects = default_quota:myprefix)
  * 
- * "<prefix>:uid" parameter takes a integer argument,
+ * "<myprefix>:uid" parameter takes a integer argument,
  *     it specifies the uid of the quota record, that will be taken for
  *     storing the default USER-quotas.
  *
  *     - default value: '0' (for root user)
  *     - e.g.: default_quota:uid = 65534
  *
- * "<prefix>:uid nolimit" parameter takes a boolean argument,
+ * "<myprefix>:uid nolimit" parameter takes a boolean argument,
  *     it specifies if we should report the stored default quota values,
  *     also for the user record, or if you should just report NO_LIMIT
  *     to the windows client for the user specified by the "<prefix>:uid" parameter.
  *     - default value: yes (that means to report NO_LIMIT)
  *     - e.g.: default_quota:uid nolimit = no
  * 
- * "<prefix>:gid" parameter takes a integer argument,
+ * "<myprefix>:gid" parameter takes a integer argument,
  *     it's just like "<prefix>:uid" but for group quotas.
  *     (NOTE: group quotas are not supported from the windows explorer!)
  *
  *     - default value: '0' (for root group)
  *     - e.g.: default_quota:gid = 65534
  *
- * "<prefix>:gid nolimit" parameter takes a boolean argument,
+ * "<myprefix>:gid nolimit" parameter takes a boolean argument,
  *     it's just like "<prefix>:uid nolimit" but for group quotas.
  *     (NOTE: group quotas are not supported from the windows explorer!)
  *     
@@ -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, connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq)
+static int default_quota_get_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq)
 {
        int ret = -1;
 
-       if ((ret=SMB_VFS_NEXT_GET_QUOTA(handle, conn, qtype, id, dq))!=0) {
+       if ((ret=SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, dq))!=0) {
                return ret;
        }
 
@@ -122,7 +122,7 @@ static int default_quota_get_quota(vfs_handle_struct *handle, connection_struct
                                unid_t qid;
                                uint32 qflags = dq->qflags;
                                qid.uid = DEFAULT_QUOTA_UID(handle);
-                               SMB_VFS_NEXT_GET_QUOTA(handle, conn, SMB_USER_QUOTA_TYPE, qid, dq);
+                               SMB_VFS_NEXT_GET_QUOTA(handle, SMB_USER_QUOTA_TYPE, qid, dq);
                                dq->qflags = qflags;
                        }
                        break;
@@ -132,7 +132,7 @@ static int default_quota_get_quota(vfs_handle_struct *handle, connection_struct
                                unid_t qid;
                                uint32 qflags = dq->qflags;
                                qid.gid = DEFAULT_QUOTA_GID(handle);
-                               SMB_VFS_NEXT_GET_QUOTA(handle, conn, SMB_GROUP_QUOTA_TYPE, qid, dq);
+                               SMB_VFS_NEXT_GET_QUOTA(handle, SMB_GROUP_QUOTA_TYPE, qid, dq);
                                dq->qflags = qflags;
                        }
                        break;
@@ -146,7 +146,7 @@ static int default_quota_get_quota(vfs_handle_struct *handle, connection_struct
        return ret;
 }
 
-static int default_quota_set_quota(vfs_handle_struct *handle, connection_struct *conn, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq)
+static int default_quota_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq)
 {
        int ret = -1;
 
@@ -179,7 +179,7 @@ static int default_quota_set_quota(vfs_handle_struct *handle, connection_struct
                        break;
        }
 
-       if ((ret=SMB_VFS_NEXT_SET_QUOTA(handle, conn, qtype, id, dq))!=0) {
+       if ((ret=SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, dq))!=0) {
                return ret;
        }
 
@@ -194,7 +194,7 @@ static int default_quota_set_quota(vfs_handle_struct *handle, connection_struct
                        {
                                unid_t qid;
                                qid.uid = DEFAULT_QUOTA_UID(handle);
-                               ret = SMB_VFS_NEXT_SET_QUOTA(handle, conn, SMB_USER_QUOTA_TYPE, qid, dq);
+                               ret = SMB_VFS_NEXT_SET_QUOTA(handle, SMB_USER_QUOTA_TYPE, qid, dq);
                        }
                        break;
 #ifdef HAVE_GROUP_QUOTA
@@ -202,7 +202,7 @@ static int default_quota_set_quota(vfs_handle_struct *handle, connection_struct
                        {
                                unid_t qid;
                                qid.gid = DEFAULT_QUOTA_GID(handle);
-                               ret = SMB_VFS_NEXT_SET_QUOTA(handle, conn, SMB_GROUP_QUOTA_TYPE, qid, dq);
+                               ret = SMB_VFS_NEXT_SET_QUOTA(handle, SMB_GROUP_QUOTA_TYPE, qid, dq);
                        }
                        break;
 #endif /* HAVE_GROUP_QUOTA */
@@ -215,16 +215,14 @@ static int default_quota_set_quota(vfs_handle_struct *handle, connection_struct
        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)
 {
-       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);
 }