- /* 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;
+ process_release(process);
+}
+
+/**
+ * pb_load_nfs - Mounts the NFS export and returns the local file path.
+ *
+ * Returns the local file path in a talloc'ed character string on success,
+ * or NULL on error.
+ */
+static char *load_nfs(void *ctx, struct pb_url *url,
+ struct load_url_async_data *url_data)
+{
+ char *local, *opts;
+ int result;
+ struct process *process;
+ const char *argv[] = {
+ pb_system_apps.mount,
+ "-t", "nfs",
+ NULL,
+ url->host,
+ url->dir,
+ NULL,
+ NULL,
+ };
+
+ local = local_name(ctx);
+ if (!local)
+ return NULL;
+ argv[6] = local;
+
+ result = pb_mkdir_recursive(local);
+ if (result)
+ goto fail;
+
+ opts = talloc_strdup(NULL, "ro,nolock,nodiratime");
+ argv[3] = opts;
+
+ if (url->port)
+ opts = talloc_asprintf_append(opts, ",port=%s", url->port);
+
+ if (url_data) {
+ process = process_create(ctx);
+
+ process->path = pb_system_apps.mount;
+ process->argv = argv;
+ process->exit_cb = load_url_exit_cb;
+ process->data = url_data;
+
+ result = process_run_async(process);
+ if (result)
+ process_release(process);
+ } else {
+ result = process_run_simple_argv(ctx, argv);