summaryrefslogtreecommitdiff
path: root/sutils
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2023-04-15 01:12:20 -0400
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-04-15 08:34:08 +0200
commitac2803b4119db5e7c4eb56837f83811c51ec3ea0 (patch)
tree4d10a78bd57445ab7349cff0015dfa5857c4842b /sutils
parent608123211f8b4065863f866cd3abd9589731de6a (diff)
Remove default_pager_paging_file RPC from default pager
The default_pager_paging_storage RPC has already it more than 20 years ago. Given that we want to change the type of default_pager_filename_t to use c_string, we can just remove the unused RPC. Tested that swapon/swapoff still work with the new binaries. Message-Id: <ZDoyNOE0XB77d5xj@mars.tail36e24.ts.net>
Diffstat (limited to 'sutils')
-rw-r--r--sutils/swapon.c57
1 files changed, 8 insertions, 49 deletions
diff --git a/sutils/swapon.c b/sutils/swapon.c
index 78a45908..2ee3cd7f 100644
--- a/sutils/swapon.c
+++ b/sutils/swapon.c
@@ -362,10 +362,8 @@ swaponoff (const char *file, int add, int skipnotexisting)
{
error_t err;
struct store *store;
- static int old_protocol;
int quiet_now = 0;
- try_again:
err = store_open (file, 0, 0, &store);
if (err)
{
@@ -377,23 +375,7 @@ swaponoff (const char *file, int add, int skipnotexisting)
return err;
}
- /* Let's see what we've got. */
- if (old_protocol)
- {
- /* The default pager only lets us give a whole partition, and
- it will read the signature page (but not insist on it). */
- if (! (store->flags & STORE_ENFORCED))
- {
- error (0, 0, "%s: Can only page to the entire device", file);
- return EINVAL;
- }
- /* If we want to require the signature, we can check that it is
- actually there even though we won't be the one interpreting it. */
- if (require_signature
- && check_signature (file, &store, 1, quiet_now) != 0)
- return EINVAL;
- }
- else if (ignore_signature)
+ if (ignore_signature)
verbose ("%s: %uk swap space",
file, (unsigned int) (store->size / 1024));
else
@@ -420,38 +402,15 @@ swaponoff (const char *file, int add, int skipnotexisting)
get_def_pager();
- if (old_protocol)
- {
- /* The default pager does not support the new protocol.
- We tried it in a previous call (below) and got MIG_BAD_ID. */
- err = default_pager_paging_file (def_pager, dev_master, file, add);
- }
- else
+ recnum_t runs[store->num_runs * 2];
+ size_t i, j;
+ for (i = j = 0; i < store->num_runs; ++i)
{
- /* Try the new protocol, which will take our list of runs. */
- recnum_t runs[store->num_runs * 2];
- size_t i, j;
- for (i = j = 0; i < store->num_runs; ++i)
- {
- runs[j++] = store->runs[i].start;
- runs[j++] = store->runs[i].length;
- }
- err = default_pager_paging_storage (def_pager, store->port,
- runs, j, file, add);
- if (err == MIG_BAD_ID)
- {
- /* The default pager does not support the new protocol.
- We'll do the whole thing over again, since we have
- different requirements now. */
- old_protocol = 1;
- store_free (store);
- if (! ignore_signature)
- error (0, 0, "\
-default pager uses old protocol, does its own signature checking");
- quiet_now = 1;
- goto try_again;
- }
+ runs[j++] = store->runs[i].start;
+ runs[j++] = store->runs[i].length;
}
+ err = default_pager_paging_storage (def_pager, store->port,
+ runs, j, file, add);
store_free (store);