- /* normalise '/dev/foo' to 'foo' for easy comparisons, we'll expand
- * back before returning.
- */
- if (!strncmp(dev_str, "/dev/", 5))
- dev_str += 5;
-
- /* PS3 hack: if we're reading from a ps3dx device, and we refer to
- * a sdx device, remap to ps3dx */
- if (cur_dev && !strncmp(cur_dev, "/dev/ps3d", 9)
- && !strncmp(dev_str, "sd", 2)) {
- snprintf(tmp, 255, "ps3d%s", dev_str + 2);
- dev_str = tmp;
+/**
+ * pb_load_nfs - Create a mountpoint, set the local file within that
+ * mountpoint, and run the appropriate mount command
+ */
+
+static void load_nfs(struct load_task *task)
+{
+ char *mountpoint, *opts;
+ int rc;
+ const char *argv[] = {
+ pb_system_apps.mount,
+ "-t", "nfs",
+ NULL, /* 3: opts */
+ task->url->host,
+ task->url->dir,
+ NULL, /* 6: mountpoint */
+ NULL,
+ };
+
+ task->result->status = LOAD_ERROR;
+ mountpoint = local_name(task->result);
+ if (!mountpoint)
+ return;
+ task->result->cleanup_local = true;
+ argv[6] = mountpoint;
+
+ rc = pb_mkdir_recursive(mountpoint);
+ if (rc)
+ return;
+
+ opts = talloc_strdup(NULL, "ro,nolock,nodiratime");
+ argv[3] = opts;
+
+ if (task->url->port)
+ opts = talloc_asprintf_append(opts, ",port=%s",
+ task->url->port);
+
+ task->result->local = talloc_asprintf(task->result, "%s/%s",
+ mountpoint,
+ task->url->path);
+
+ task->process->path = pb_system_apps.mount;
+ task->process->argv = argv;
+
+ if (task->async) {
+ rc = process_run_async(task->process);
+ if (rc) {
+ process_release(task->process);
+ task->process = NULL;
+ }
+ task->result->status = rc ? LOAD_ERROR : LOAD_ASYNC;
+ } else {
+ rc = process_run_sync(task->process);
+ task->result->status = rc ? LOAD_ERROR : LOAD_OK;
+ process_release(task->process);
+ task->process = NULL;