X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Fnfsclient-raw.c;h=18b7ae5d45578231c47b38bb9bd3dea145c42f1e;hb=9ab4d56ef98e001a82feb2b6dba2cd4e76813618;hp=ad8576af6b219d04937c31d370958b2ab183bcf7;hpb=05a777d98ae6cd5dd121f5d7fe5193febb01a394;p=deb_libnfs.git diff --git a/examples/nfsclient-raw.c b/examples/nfsclient-raw.c index ad8576a..18b7ae5 100644 --- a/examples/nfsclient-raw.c +++ b/examples/nfsclient-raw.c @@ -24,6 +24,7 @@ #include #include +#include #include #include "libnfs.h" #include "libnfs-raw.h" @@ -43,7 +44,7 @@ struct client { void rquota_getquota_cb(struct rpc_context *rpc _U_, int status, void *data, void *private_data) { struct client *client = private_data; - GETQUOTA1res *res = data; +// GETQUOTA1res *res = data; if (status == RPC_STATUS_ERROR) { printf("rquota/getquota call failed with \"%s\"\n", (char *)data); @@ -157,9 +158,11 @@ void mount_mnt_cb(struct rpc_context *rpc, int status, void *data, void *private } -void mount_null_cb(struct rpc_context *rpc, int status, void *data, void *private_data) + +void mount_export_cb(struct rpc_context *rpc, int status, void *data, void *private_data) { struct client *client = private_data; + exports export = *(exports *)data; if (status == RPC_STATUS_ERROR) { printf("mount null call failed with \"%s\"\n", (char *)data); @@ -170,7 +173,11 @@ void mount_null_cb(struct rpc_context *rpc, int status, void *data, void *privat exit(10); } - printf("Got reply from server for MOUNT/NULL procedure.\n"); + printf("Got reply from server for MOUNT/EXPORT procedure.\n"); + while (export != NULL) { + printf("Export: %s\n", export->ex_dir); + export = export->ex_next; + } printf("Send MOUNT/MNT command for %s\n", client->export); if (rpc_mount_mnt_async(rpc, mount_mnt_cb, client->export, client) != 0) { printf("Failed to send mnt request\n"); @@ -178,6 +185,27 @@ void mount_null_cb(struct rpc_context *rpc, int status, void *data, void *privat } } +void mount_null_cb(struct rpc_context *rpc, int status, void *data, void *private_data) +{ + struct client *client = private_data; + + if (status == RPC_STATUS_ERROR) { + printf("mount null call failed with \"%s\"\n", (char *)data); + exit(10); + } + if (status != RPC_STATUS_SUCCESS) { + printf("mount null call to server %s failed, status:%d\n", client->server, status); + exit(10); + } + + printf("Got reply from server for MOUNT/NULL procedure.\n"); + printf("Send MOUNT/EXPORT command\n"); + if (rpc_mount_export_async(rpc, mount_export_cb, client) != 0) { + printf("Failed to send export request\n"); + exit(10); + } +} + void mount_connect_cb(struct rpc_context *rpc, int status, void *data _U_, void *private_data) { struct client *client = private_data; @@ -246,7 +274,7 @@ void pmap_getport1_cb(struct rpc_context *rpc, int status, void *data, void *pri printf("GETPORT returned RPC.RQUOTAD on port:%d\n", client->rquota_port); if (client->rquota_port == 0) { printf("RPC.RQUOTAD is not available on server : %s:%d\n", client->server, client->rquota_port); - exit(10); +// exit(10); } printf("Send getport request asking for MOUNT port\n");