s3: Move dump_ntquota* to smbcquotas.c
authorVolker Lendecke <vl@samba.org>
Sun, 16 Jan 2011 11:26:45 +0000 (12:26 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 17 Jan 2011 07:03:41 +0000 (08:03 +0100)
source3/include/proto.h
source3/libsmb/cliquota.c
source3/utils/smbcquotas.c

index e58fd73e5f49a177ad99ad7e3dbfbe5d3cbc38a6..76313026c7eed5d71866f106ca71960cd1adf380 100644 (file)
@@ -2264,8 +2264,6 @@ NTSTATUS cli_get_fs_quota_info(struct cli_state *cli, int quota_fnum,
                               SMB_NTQUOTA_STRUCT *pqt);
 NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
                               SMB_NTQUOTA_STRUCT *pqt);
-void dump_ntquota(SMB_NTQUOTA_STRUCT *qt, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, struct dom_sid *sid, bool _numeric));
-void dump_ntquota_list(SMB_NTQUOTA_LIST **qtl, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, struct dom_sid *sid, bool _numeric));
 
 /* The following definitions come from libsmb/clirap.c  */
 
index be52f9b086a5ba6cb1add245fed3d51d04308a95..87ca00fd14456767410e37a93d538d3848aaf308 100644 (file)
@@ -509,78 +509,3 @@ NTSTATUS cli_set_fs_quota_info(struct cli_state *cli, int quota_fnum,
 
        return status;
 }
-
-static const char *quota_str_static(uint64_t val, bool special, bool _numeric)
-{
-       const char *result;
-
-       if (!_numeric&&special&&(val == SMB_NTQUOTAS_NO_LIMIT)) {
-               return "NO LIMIT";
-       }
-       result = talloc_asprintf(talloc_tos(), "%"PRIu64, val);
-       SMB_ASSERT(result != NULL);
-       return result;
-}
-
-void dump_ntquota(SMB_NTQUOTA_STRUCT *qt, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, struct dom_sid *sid, bool _numeric))
-{
-       TALLOC_CTX *frame = talloc_stackframe();
-
-       if (!qt) {
-               smb_panic("dump_ntquota() called with NULL pointer");
-       }
-
-       switch (qt->qtype) {
-               case SMB_USER_FS_QUOTA_TYPE:
-                       {
-                               d_printf("File System QUOTAS:\n");
-                               d_printf("Limits:\n");
-                               d_printf(" Default Soft Limit: %15s\n",quota_str_static(qt->softlim,True,_numeric));
-                               d_printf(" Default Hard Limit: %15s\n",quota_str_static(qt->hardlim,True,_numeric));
-                               d_printf("Quota Flags:\n");
-                               d_printf(" Quotas Enabled: %s\n",
-                                       ((qt->qflags&QUOTAS_ENABLED)||(qt->qflags&QUOTAS_DENY_DISK))?"On":"Off");
-                               d_printf(" Deny Disk:      %s\n",(qt->qflags&QUOTAS_DENY_DISK)?"On":"Off");
-                               d_printf(" Log Soft Limit: %s\n",(qt->qflags&QUOTAS_LOG_THRESHOLD)?"On":"Off");
-                               d_printf(" Log Hard Limit: %s\n",(qt->qflags&QUOTAS_LOG_LIMIT)?"On":"Off");
-                       }
-                       break;
-               case SMB_USER_QUOTA_TYPE:
-                       {
-                               fstring username_str = {0};
-
-                               if (_sidtostring) {
-                                       _sidtostring(username_str,&qt->sid,_numeric);
-                               } else {
-                                       sid_to_fstring(username_str, &qt->sid);
-                               }
-
-                               if (_verbose) { 
-                                       d_printf("Quotas for User: %s\n",username_str);
-                                       d_printf("Used Space: %15s\n",quota_str_static(qt->usedspace,False,_numeric));
-                                       d_printf("Soft Limit: %15s\n",quota_str_static(qt->softlim,True,_numeric));
-                                       d_printf("Hard Limit: %15s\n",quota_str_static(qt->hardlim,True,_numeric));
-                               } else {
-                                       d_printf("%-30s: ",username_str);
-                                       d_printf("%15s/",quota_str_static(qt->usedspace,False,_numeric));
-                                       d_printf("%15s/",quota_str_static(qt->softlim,True,_numeric));
-                                       d_printf("%15s\n",quota_str_static(qt->hardlim,True,_numeric));
-                               }
-                       }
-                       break;
-               default:
-                       d_printf("dump_ntquota() invalid qtype(%d)\n",qt->qtype);
-       }
-       TALLOC_FREE(frame);
-       return;
-}
-
-void dump_ntquota_list(SMB_NTQUOTA_LIST **qtl, bool _verbose, bool _numeric, void (*_sidtostring)(fstring str, struct dom_sid *sid, bool _numeric))
-{
-       SMB_NTQUOTA_LIST *cur;
-
-       for (cur = *qtl;cur;cur = cur->next) {
-               if (cur->quotas)
-                       dump_ntquota(cur->quotas,_verbose,_numeric,_sidtostring);
-       }       
-}
index 8cf1751578fe795082a85a7cd7c409fe3c88471c..e2ab52af4aa2198f6ae0ea9775a2b0aaf82fdbf0 100644 (file)
@@ -227,6 +227,105 @@ static int parse_quota_set(TALLOC_CTX *ctx,
        return 0;
 }
 
+
+static const char *quota_str_static(uint64_t val, bool special, bool _numeric)
+{
+       const char *result;
+
+       if (!_numeric&&special&&(val == SMB_NTQUOTAS_NO_LIMIT)) {
+               return "NO LIMIT";
+       }
+       result = talloc_asprintf(talloc_tos(), "%"PRIu64, val);
+       SMB_ASSERT(result != NULL);
+       return result;
+}
+
+static void dump_ntquota(SMB_NTQUOTA_STRUCT *qt, bool _verbose,
+                        bool _numeric,
+                        void (*_sidtostring)(fstring str,
+                                             struct dom_sid *sid,
+                                             bool _numeric))
+{
+       TALLOC_CTX *frame = talloc_stackframe();
+
+       if (!qt) {
+               smb_panic("dump_ntquota() called with NULL pointer");
+       }
+
+       switch (qt->qtype) {
+       case SMB_USER_FS_QUOTA_TYPE:
+       {
+               d_printf("File System QUOTAS:\n");
+               d_printf("Limits:\n");
+               d_printf(" Default Soft Limit: %15s\n",
+                        quota_str_static(qt->softlim,True,_numeric));
+               d_printf(" Default Hard Limit: %15s\n",
+                        quota_str_static(qt->hardlim,True,_numeric));
+               d_printf("Quota Flags:\n");
+               d_printf(" Quotas Enabled: %s\n",
+                        ((qt->qflags&QUOTAS_ENABLED)
+                         ||(qt->qflags&QUOTAS_DENY_DISK))?"On":"Off");
+               d_printf(" Deny Disk:      %s\n",
+                        (qt->qflags&QUOTAS_DENY_DISK)?"On":"Off");
+               d_printf(" Log Soft Limit: %s\n",
+                        (qt->qflags&QUOTAS_LOG_THRESHOLD)?"On":"Off");
+               d_printf(" Log Hard Limit: %s\n",
+                        (qt->qflags&QUOTAS_LOG_LIMIT)?"On":"Off");
+       }
+       break;
+       case SMB_USER_QUOTA_TYPE:
+       {
+               fstring username_str = {0};
+
+               if (_sidtostring) {
+                       _sidtostring(username_str,&qt->sid,_numeric);
+               } else {
+                       sid_to_fstring(username_str, &qt->sid);
+               }
+
+               if (_verbose) {
+                       d_printf("Quotas for User: %s\n",username_str);
+                       d_printf("Used Space: %15s\n",
+                                quota_str_static(qt->usedspace,False,
+                                                 _numeric));
+                       d_printf("Soft Limit: %15s\n",
+                                quota_str_static(qt->softlim,True,
+                                                 _numeric));
+                       d_printf("Hard Limit: %15s\n",
+                                quota_str_static(qt->hardlim,True,_numeric));
+               } else {
+                       d_printf("%-30s: ",username_str);
+                       d_printf("%15s/",quota_str_static(
+                                        qt->usedspace,False,_numeric));
+                       d_printf("%15s/",quota_str_static(
+                                        qt->softlim,True,_numeric));
+                       d_printf("%15s\n",quota_str_static(
+                                        qt->hardlim,True,_numeric));
+               }
+       }
+       break;
+       default:
+               d_printf("dump_ntquota() invalid qtype(%d)\n",qt->qtype);
+       }
+       TALLOC_FREE(frame);
+       return;
+}
+
+static void dump_ntquota_list(SMB_NTQUOTA_LIST **qtl, bool _verbose,
+                             bool _numeric,
+                             void (*_sidtostring)(fstring str,
+                                                  struct dom_sid *sid,
+                                                  bool _numeric))
+{
+       SMB_NTQUOTA_LIST *cur;
+
+       for (cur = *qtl;cur;cur = cur->next) {
+               if (cur->quotas)
+                       dump_ntquota(cur->quotas,_verbose,_numeric,
+                                    _sidtostring);
+       }
+}
+
 static int do_quota(struct cli_state *cli,
                enum SMB_QUOTA_TYPE qtype,
                uint16 cmd,