summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavio Cruz <flaviocruz@gmail.com>2023-04-24 23:53:52 -0400
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2023-04-25 22:12:00 +0200
commit0afac7ab288a2a259bbc6bdb7e20b686b3913274 (patch)
treebe7b66587fa09204a9e16462242c0b47335170e0
parenta3cf2656cabaf5691a4e45302eea879791917e2b (diff)
Use c_string for default_pager_filename_t to define a new default_pager_paging_storage RPC.
This brings us a bit closer to having all types' msgt_size representable with a single byte. We will be able to avoid mach_msg_type_long_t entirely for x86_64 since mach_msg_type_t can represent long types using a separate field. Message-Id: <ZEdO0Grm2AUw4Tfe@jupiter.tail36e24.ts.net>
-rw-r--r--hurd/default_pager.defs30
-rw-r--r--mach-defpager/setup.c10
-rw-r--r--sutils/swapon.c9
-rw-r--r--trans/proxy-defpager.c11
4 files changed, 50 insertions, 10 deletions
diff --git a/hurd/default_pager.defs b/hurd/default_pager.defs
index 6b834584..3ca34fc4 100644
--- a/hurd/default_pager.defs
+++ b/hurd/default_pager.defs
@@ -69,14 +69,10 @@ skip; /* default_pager_paging_file */
skip; /* default_pager_register_fileserver */
-/* Add or remove an area of paging storage, which is a subset of the
- Mach device for which device_open returned DEVICE_PORT. The area
- consists of the concatenation of contiguous regions described by
- RUNS. Each even-numbered element of RUNS gives the starting record
- number of a region whose length is given by the next odd-numbered
- element. NAME is used in any diagnostics the default pager prints
- about device errors when paging. When removing a paging area, NAME
- and RUNS must match exactly. */
+/* Deprecated RPC to add or remove an area of paging storage.
+ * Was superseded in favor of default_pager_paging_storage_new which
+ * uses the correct type for default_pager_filename_t using c_string.
+ */
routine default_pager_paging_storage(
default_pager : mach_port_t;
device_port : mach_port_t;
@@ -101,3 +97,21 @@ routine default_pager_storage_info(
array[] of vm_size_t, dealloc;
out name : data_t);
+type new_default_pager_filename_t = c_string[256]
+ ctype: default_pager_filename_t;
+
+/* Add or remove an area of paging storage, which is a subset of the
+ Mach device for which device_open returned DEVICE_PORT. The area
+ consists of the concatenation of contiguous regions described by
+ RUNS. Each even-numbered element of RUNS gives the starting record
+ number of a region whose length is given by the next odd-numbered
+ element. NAME is used in any diagnostics the default pager prints
+ about device errors when paging. When removing a paging area, NAME
+ and RUNS must match exactly. */
+routine default_pager_paging_storage_new(
+ default_pager : mach_port_t;
+ device_port : mach_port_t;
+ runs : recnum_array_t =
+ array[] of recnum_t;
+ name : new_default_pager_filename_t;
+ add : boolean_t);
diff --git a/mach-defpager/setup.c b/mach-defpager/setup.c
index 8cd1fed2..087ede71 100644
--- a/mach-defpager/setup.c
+++ b/mach-defpager/setup.c
@@ -100,6 +100,16 @@ S_default_pager_paging_storage (mach_port_t pager,
return 0;
}
+kern_return_t
+S_default_pager_paging_storage_new (mach_port_t pager,
+ mach_port_t device,
+ const recnum_t *runs, mach_msg_type_number_t nrun,
+ const_default_pager_filename_t name,
+ boolean_t add)
+{
+ return S_default_pager_paging_storage (pager,
+ device, runs, nrun, name, add);
+}
/* Called to read a page from backing store. */
int
diff --git a/sutils/swapon.c b/sutils/swapon.c
index 2ee3cd7f..c965d8e2 100644
--- a/sutils/swapon.c
+++ b/sutils/swapon.c
@@ -409,8 +409,13 @@ swaponoff (const char *file, int add, int skipnotexisting)
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);
+ err = default_pager_paging_storage_new (def_pager, store->port,
+ runs, j, file, add);
+ if (err == MIG_BAD_ID || err == EOPNOTSUPP)
+ {
+ err = default_pager_paging_storage (def_pager, store->port,
+ runs, j, file, add);
+ }
store_free (store);
diff --git a/trans/proxy-defpager.c b/trans/proxy-defpager.c
index 878beffe..5d952546 100644
--- a/trans/proxy-defpager.c
+++ b/trans/proxy-defpager.c
@@ -113,6 +113,17 @@ S_default_pager_paging_storage (mach_port_t default_pager,
}
kern_return_t
+S_default_pager_paging_storage_new (mach_port_t default_pager,
+ mach_port_t device,
+ const recnum_t *runs, mach_msg_type_number_t nruns,
+ const_default_pager_filename_t name,
+ boolean_t add)
+{
+ return S_default_pager_paging_storage (default_pager,
+ device, runs, nruns, name, add);
+}
+
+kern_return_t
S_default_pager_object_set_size (mach_port_t memory_object,
mach_port_seqno_t seqno,
vm_size_t object_size_limit)