]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - spaceman/init.c
xfsprogs: make static things static
[thirdparty/xfsprogs-dev.git] / spaceman / init.c
index 107a692423c061359b108470b1c964e70748788a..181a3446282b3d25188679e72864e6473c6e0802 100644 (file)
@@ -1,31 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2012 Red Hat, Inc
  * All Rights Reserved.
- *
- * 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.
- *
- * This program is distributed in the hope that it would 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, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
 #include "libxfs.h"
 #include "command.h"
 #include "input.h"
 #include "init.h"
+#include "path.h"
 #include "space.h"
 
 char   *progname;
 int    exitcode;
 
-void
+static void
 usage(void)
 {
        fprintf(stderr,
@@ -39,8 +28,11 @@ init_commands(void)
 {
        print_init();
        help_init();
+       info_init();
+       prealloc_init();
        quit_init();
        trim_init();
+       freesp_init();
 }
 
 static int
@@ -62,24 +54,29 @@ init_check_command(
        return 1;
 }
 
-void
+static void
 init(
        int             argc,
        char            **argv)
 {
        int             c;
        xfs_fsop_geom_t geometry = { 0 };
+       struct fs_path  fsp;
 
        progname = basename(argv[0]);
        setlocale(LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
 
-       while ((c = getopt(argc, argv, "c:V")) != EOF) {
+       fs_table_initialise(0, NULL, 0, NULL);
+       while ((c = getopt(argc, argv, "c:p:V")) != EOF) {
                switch (c) {
                case 'c':
                        add_user_command(optarg);
                        break;
+               case 'p':
+                       progname = optarg;
+                       break;
                case 'V':
                        printf(_("%s version %s\n"), progname, VERSION);
                        exit(0);
@@ -91,11 +88,11 @@ init(
        if (optind != argc - 1)
                usage();
 
-       if ((c = openfile(argv[optind], &geometry)) < 0)
+       if ((c = openfile(argv[optind], &geometry, &fsp)) < 0)
                exit(1);
        if (!platform_test_xfs_fd(c))
                printf(_("Not an XFS filesystem!\n"));
-       if (addfile(argv[optind], c, &geometry) < 0)
+       if (addfile(argv[optind], c, &geometry, &fsp) < 0)
                exit(1);
 
        init_commands();