- return nfs_pwrite(nfs, nfsfh, nfs_get_current_offset(nfsfh), count, buf);
+ struct sync_cb_data cb_data;
+
+ cb_data.is_finished = 0;
+ cb_data.call = "write";
+
+ if (nfs_write_async(nfs, nfsfh, count, buf, pwrite_cb, &cb_data) != 0) {
+ nfs_set_error(nfs, "nfs_write_async failed");
+ return -1;
+ }
+
+ wait_for_nfs_reply(nfs, &cb_data);
+
+ return cb_data.status;