projects
/
nbd.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Oops
[nbd.git]
/
nbd-client.c
diff --git
a/nbd-client.c
b/nbd-client.c
index
aeaa231
..
b0631ca
100644
(file)
--- a/
nbd-client.c
+++ b/
nbd-client.c
@@
-37,14
+37,14
@@
#include <getopt.h>
#include <stdarg.h>
#include <getopt.h>
#include <stdarg.h>
-#ifndef __GNUC__
-#error I need GCC to work
-#endif
-
#include <linux/ioctl.h>
#define MY_NAME "nbd_client"
#include "cliserv.h"
#include <linux/ioctl.h>
#define MY_NAME "nbd_client"
#include "cliserv.h"
+#ifdef WITH_SDP
+#include <sdp_inet.h>
+#endif
+
int check_conn(char* devname, int do_print) {
char buf[256];
char* p;
int check_conn(char* devname, int do_print) {
char buf[256];
char* p;
@@
-141,8
+141,8
@@
void negotiate(int sock, u64 *rsize64, u32 *flags, char* name) {
magic = ntohll(magic);
if(name) {
uint32_t opt;
magic = ntohll(magic);
if(name) {
uint32_t opt;
- uint64_t namesize;
- uint64_t reserved = 0;
+ uint32_t namesize;
+ uint32_t reserved = 0;
if (magic != opts_magic)
err("Not enough opts_magic");
if (magic != opts_magic)
err("Not enough opts_magic");
@@
-156,12
+156,12
@@
void negotiate(int sock, u64 *rsize64, u32 *flags, char* name) {
write(sock, &reserved, sizeof(reserved));
/* Write the export name that we're after */
write(sock, &reserved, sizeof(reserved));
/* Write the export name that we're after */
- magic = ntohll(cliserv_magic);
+ magic = ntohll(opts_magic);
write(sock, &magic, sizeof(magic));
opt = ntohl(NBD_OPT_EXPORT_NAME);
write(sock, &opt, sizeof(opt));
write(sock, &magic, sizeof(magic));
opt = ntohl(NBD_OPT_EXPORT_NAME);
write(sock, &opt, sizeof(opt));
- namesize = (u64)strlen(name);
- namesize = ntohll(namesize);
+ namesize = (u32)strlen(name);
+ namesize = ntohl(namesize);
write(sock, &namesize, sizeof(namesize));
write(sock, name, strlen(name));
} else {
write(sock, &namesize, sizeof(namesize));
write(sock, name, strlen(name));
} else {
@@
-384,8
+384,7
@@
int main(int argc, char *argv[]) {
blocksize=(int)strtol(optarg, NULL, 0);
break;
case 'c':
blocksize=(int)strtol(optarg, NULL, 0);
break;
case 'c':
- check_conn(optarg, 1);
- exit(EXIT_SUCCESS);
+ return check_conn(optarg, 1);
case 'd':
disconnect(optarg);
exit(EXIT_SUCCESS);
case 'd':
disconnect(optarg);
exit(EXIT_SUCCESS);