--- /dev/null
+/* The "vos listpart" command
+ *
+ * Copyright (C) 2020 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells (dhowells@redhat.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public Licence
+ * as published by the Free Software Foundation; either version
+ * 2 of the Licence, or (at your option) any later version.
+ */
+
+#include <fmt/core.h>
+#include "kafs.H"
+#include "volservice.H"
+#include "arg_parse.H"
+#include "display.H"
+#include "afs_xg.H"
+
+using rxrpc::ref;
+
+/***
+ * COMMAND: vos listpart - Display all AFS partitions on a file server machine
+ * ARG: "-server <machine name>"
+ * ARG: "[-cell <cell name>]"
+ * ARG: "[-noauth]" - Auth
+ * ARG: "[-localauth]" - Auth
+ * ARG: "[-verbose]"
+ * ARG: "[-encrypt]" - Auth
+ * ARG: "[-noresolve]"
+ *
+ * Displays all AFS partitions on a file server machine
+ */
+void COMMAND_vos_listpart(
+ kafs::Context *ctx,
+ kafs::Volserver_spec &a_server,
+ bool a_verbose,
+ bool a_noresolve)
+{
+ kafs::Partition_list partitions;
+ ref<kafs::Volserver> server;
+ ref<kafs::FS_site> site;
+ unsigned int i, n;
+
+ _enter("");
+
+ ctx->no_resolve = a_noresolve;
+
+ site = kafs::resolve_server_spec(ctx, a_server);
+ server = new kafs::Volserver(ctx, site);
+ server->list_partitions(partitions);
+
+ fmt::print("The partitions on the server are:\n");
+
+ n = 0;
+ for (i = 0; i < partitions.size(); i++) {
+ if (partitions[i].id != 0xffffffff) {
+ fmt::print(" {}", kafs::sprint_partition(partitions[i]));
+ n++;
+ }
+ }
+
+ fmt::print("\n");
+ fmt::print("Total: {:d}\n", n);
+}