+
+/* Specialized calls mkmountpoint and rmmountpoint are really
+ * variations on mkdir and rmdir which do no checking and (in the
+ * mkmountpoint case) set the root_mounted flag.
+ */
+int
+do_mkmountpoint (const char *path)
+{
+ int r;
+
+ /* NEED_ROOT (return -1); - we don't want this test for this call. */
+ ABS_PATH (path, 0, return -1);
+
+ CHROOT_IN;
+ r = mkdir (path, 0777);
+ CHROOT_OUT;
+
+ if (r == -1) {
+ reply_with_perror ("%s", path);
+ return -1;
+ }
+
+ /* Set the flag so that filesystems can be mounted here,
+ * not just on /sysroot.
+ */
+ root_mounted = 1;
+
+ return 0;
+}
+
+int
+do_rmmountpoint (const char *path)
+{
+ int r;
+
+ /* NEED_ROOT (return -1); - we don't want this test for this call. */
+ ABS_PATH (path, 0, return -1);
+
+ CHROOT_IN;
+ r = rmdir (path);
+ CHROOT_OUT;
+
+ if (r == -1) {
+ reply_with_perror ("%s", path);
+ return -1;
+ }
+
+ return 0;
+}