+static void send_read_requests(NFSConnection *nfs, const struct nfs_fh3 *fh)
+{
+ int i;
+
+ g_print("Sending read requests...\n");
+ for (i = 0; i < 4; i++) {
+ char buf[64];
+ struct read3args read;
+ memcpy(&read.file, fh, sizeof(struct nfs_fh3));
+ read.offset = (1 << 20) * i;
+ read.count = (1 << 20);
+
+ GString *str = g_string_new("");
+ XDR xdr;
+ xdr_string_create(&xdr, str, XDR_ENCODE);
+ xdr_read3args(&xdr, &read);
+ send_rpc(nfs, NFSPROC3_READ, str, NULL, NULL);
+ g_string_free(str, TRUE);
+ }
+}
+
+static void store_fh(NFSConnection *nfs, gpointer user_data,
+ const char *reply, size_t len)
+{
+ struct lookup3res res;
+ XDR xdr;
+ memset(&res, 0, sizeof(res));
+ xdrmem_create(&xdr, (char *)reply, len, XDR_DECODE);
+ if (!xdr_lookup3res(&xdr, &res)) {
+ g_print("Decode error for lookup3res!\n");
+ return;
+ }
+ if (res.status != NFS3_OK) {
+ g_print("Response not NFS3_OK\n");
+ return;
+ }
+
+ struct nfs_fh3 *fh = g_new0(struct nfs_fh3, 1);
+ fh->data.data_len = res.lookup3res_u.resok.object.data.data_len;
+ fh->data.data_val = g_memdup(res.lookup3res_u.resok.object.data.data_val,
+ fh->data.data_len);
+
+ xdr.x_op = XDR_FREE;
+ xdr_lookup3res(&xdr, &res);
+
+ send_read_requests(nfs, fh);
+}
+