};
-static void wait_for_reply(struct nfs_context *nfs, struct sync_cb_data *cb_data)
+static void wait_for_reply(struct rpc_context *rpc, struct sync_cb_data *cb_data)
{
struct pollfd pfd;
if (cb_data->is_finished) {
break;
}
- pfd.fd = nfs_get_fd(nfs);
- pfd.events = nfs_which_events(nfs);
+ pfd.fd = rpc_get_fd(rpc);
+ pfd.events = rpc_which_events(rpc);
if (poll(&pfd, 1, -1) < 0) {
- nfs_set_error(nfs, "Poll failed");
+ rpc_set_error(rpc, "Poll failed");
cb_data->status = -EIO;
break;
}
- if (nfs_service(nfs, pfd.revents) < 0) {
- nfs_set_error(nfs, "nfs_service failed");
+ if (rpc_service(rpc, pfd.revents) < 0) {
+ rpc_set_error(rpc, "rpc_service failed");
cb_data->status = -EIO;
break;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
return -1;
}
- wait_for_reply(nfs, &cb_data);
+ wait_for_reply(nfs_get_rpc_context(nfs), &cb_data);
return cb_data.status;
}
+
+void mount_getexports_cb(struct rpc_context *mount_context _U_, int status, void *data, void *private_data)
+{
+ struct sync_cb_data *cb_data = private_data;
+ exports export = *(exports *)data;
+
+ printf("got exports back\n");
+ cb_data->is_finished = 1;
+ cb_data->status = status;
+ cb_data->return_data = NULL;
+
+ while (export != NULL) {
+ exports new_export;
+
+ new_export = malloc(sizeof(*new_export));
+ memset(new_export, 0, sizeof(*new_export));
+ new_export->ex_dir = strdup(export->ex_dir);
+ new_export->ex_next = cb_data->return_data;
+
+ cb_data->return_data = new_export;
+
+ export = export->ex_next;
+ }
+}
+
+struct exportnode *mount_getexports(struct rpc_context *rpc, const char *server)
+{
+ struct sync_cb_data cb_data;
+
+ cb_data.is_finished = 0;
+ cb_data.return_data = NULL;
+
+ if (mount_getexports_async(rpc, server, mount_getexports_cb, &cb_data) != 0) {
+ rpc_set_error(rpc, "mount_getexports_async failed");
+ return NULL;
+ }
+
+ wait_for_reply(rpc, &cb_data);
+
+ return cb_data.return_data;
+}
+
+void mount_free_export_list(struct exportnode *exports)
+{
+ struct exportnode *tmp;
+
+ while ((tmp = exports)) {
+ exports = exports->ex_next;
+ free(tmp->ex_dir);
+ free(tmp);
+ }
+}
+