{
int i;
int len = safe_strlen(s);
- if (len < 0){
+ if (len <= 0){
return 0;
}
{
int i;
int len = safe_strlen(s);
- if (len < 0)
+ if (len <= 0)
return 0;
for (i = 0; i < len; i++) {
struct xseg_request *rec;
xseg_prepare_wait(xseg, srcport);
while(1) {
- rec = xseg_receive(xseg, srcport);
+ rec = xseg_receive(xseg, srcport, 0);
if (rec) {
if (rec != expected_req) {
fprintf(stderr, "Unknown received req. Putting req.\n");
int vlmc_create(char *name, uint64_t size, char *snap)
{
+ int ret;
int targetlen = safe_strlen(name);
int snaplen = safe_strlen(snap);
if (targetlen <= 0) {
fprintf(stderr, "Size or snap must be provided in create\n");
return -1;
}
+ XSEGLOG("Name: %s", name);
+ XSEGLOG("Snap: %s", snap);
struct xseg_request *req = xseg_get_request(xseg, srcport, mportno, X_ALLOC);
if (!req) {
xseg_put_request(xseg, req, srcport);
return -1;
}
+ //FIXME what to do if no snap ? how do i send mapper to create a non copy up volume?
char *target = xseg_get_target(xseg, req);
strncpy(target, name, targetlen);
struct xseg_request_clone *xclone = (struct xseg_request_clone *) xseg_get_data(xseg, req);
- if (snaplen < 0)
+ if (snaplen <= 0){
memset(xclone->target, 0, XSEG_MAX_TARGETLEN);
+ xclone->targetlen = 0;
+ }
else {
strncpy(xclone->target, snap, snaplen);
- xclone->target[snaplen] = 0;
+ xclone->targetlen = snaplen;
}
xclone->size = size;
req->offset = 0;
}
xseg_signal(xseg, p);
- wait_reply(req);
+ ret = wait_reply(req);
xseg_put_request(xseg, req, srcport);
- return 0;
+ return ret;
}
int vlmc_snapshot(char *name)
}
char *target = xseg_get_target(xseg, req);
strncpy(target, name, targetlen);
- target[targetlen] = 0;
req->offset = 0;
req->size = req->datalen;
req->op = X_DELETE;
return -1;
}
- port = xseg_bind_port(xseg, srcport);
+ port = xseg_bind_port(xseg, srcport, NULL);
if (!port) {
fprintf(stderr, "Error binding port %u\n", srcport);
exit(-1);