+static BlockdevOptionsNfs *nfs_options_qdict_to_qapi(QDict *options,
+ Error **errp)
+{
+ BlockdevOptionsNfs *opts = NULL;
+ QObject *crumpled = NULL;
+ Visitor *v;
+ const QDictEntry *e;
+ Error *local_err = NULL;
+
+ crumpled = qdict_crumple_for_keyval_qiv(options, errp);
+ if (crumpled == NULL) {
+ return NULL;
+ }
+
+ v = qobject_input_visitor_new_keyval(crumpled);
+ visit_type_BlockdevOptionsNfs(v, NULL, &opts, &local_err);
+ visit_free(v);
+ qobject_unref(crumpled);
+
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return NULL;
+ }
+
+ /* Remove the processed options from the QDict (the visitor processes
+ * _all_ options in the QDict) */
+ while ((e = qdict_first(options))) {
+ qdict_del(options, e->key);
+ }
+
+ return opts;
+}
+
+static int64_t nfs_client_open_qdict(NFSClient *client, QDict *options,
+ int flags, int open_flags, Error **errp)
+{
+ BlockdevOptionsNfs *opts;
+ int ret;
+
+ opts = nfs_options_qdict_to_qapi(options, errp);
+ if (opts == NULL) {
+ ret = -EINVAL;
+ goto fail;
+ }
+
+ ret = nfs_client_open(client, opts, flags, open_flags, errp);
+fail:
+ qapi_free_BlockdevOptionsNfs(opts);
+ return ret;
+}
+