]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbstatus: add struct traverse_state
authorJule Anger <janger@samba.org>
Wed, 23 Mar 2022 14:17:48 +0000 (15:17 +0100)
committerJule Anger <janger@samba.org>
Mon, 8 Aug 2022 12:56:28 +0000 (12:56 +0000)
Signed-off-by: Jule Anger <janger@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/utils/status.c
source3/utils/status.h [new file with mode: 0644]

index ea7797f2705756d66af193321c125d512f9f6a0d..300cdc0df952fa5bd90f82120f677f3268228a35 100644 (file)
@@ -48,6 +48,7 @@
 #include "conn_tdb.h"
 #include "serverid.h"
 #include "status_profile.h"
+#include "status.h"
 #include "smbd/notifyd/notifyd_db.h"
 #include "cmdline_contexts.h"
 #include "locking/leases_db.h"
@@ -618,8 +619,8 @@ int main(int argc, const char *argv[])
        int profile_only = 0;
        bool show_processes, show_locks, show_shares;
        bool show_notify = false;
-       bool resolve_uids = false;
        poptContext pc = NULL;
+       struct traverse_state state = {0};
        struct poptOption long_options[] = {
                POPT_AUTOHELP
                {
@@ -736,6 +737,8 @@ int main(int argc, const char *argv[])
        char *db_path;
        bool ok;
 
+       state.resolve_uids = false;
+
        smb_init_locale();
 
        ok = samba_cmdline_init(frame,
@@ -796,7 +799,7 @@ int main(int argc, const char *argv[])
                        do_checks = false;
                        break;
                case OPT_RESOLVE_UIDS:
-                       resolve_uids = true;
+                       state.resolve_uids = true;
                        break;
                case POPT_ERROR_BADOPT:
                        fprintf(stderr, "\nInvalid option %s: %s\n\n",
@@ -916,7 +919,7 @@ int main(int argc, const char *argv[])
                        goto done;
                }
 
-               result = share_entry_forall(print_share_mode, &resolve_uids);
+               result = share_entry_forall(print_share_mode, &state.resolve_uids);
 
                if (result == 0) {
                        fprintf(stderr, "No locked files\n");
diff --git a/source3/utils/status.h b/source3/utils/status.h
new file mode 100644 (file)
index 0000000..5855d93
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Samba Unix/Linux SMB client library
+ * State struct
+ * Copyright (C) Jule Anger 2022
+ *
+ * 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef STATUS_H
+#define STATUS_H
+
+struct traverse_state {
+       bool resolve_uids;
+};
+
+#endif