struct xseg_request *xreq;
struct xseg *xseg = mapperd->xseg;
uint32_t mportno = mapperd->mportno;
+ char *target, buf[MAX_FILENAME_SIZE];
+ xport p;
always_assert(xseg);
ret = xseg_prepare_wait(xseg, mportno);
always_assert(ret == 0);
- xreq = xseg_accept(xseg, mportno);
+ xreq = xseg_accept(xseg, mportno, 0);
if (xreq) {
xseg_cancel_wait(xseg, mportno);
/*
* the reply and the target name fits in the map reply.
*/
size_t s = sizeof(struct xseg_reply_map) +
- sizeof(struct xseg_reply_map_scatterlist);
- always_assert(xreq->datalen >= s);
- always_assert(xreq->targetlen <= XSEG_MAX_TARGETLEN);
-
- struct xseg_reply_map *mreply = (void *)xreq->data;
- mreply->cnt = 1;
+ 2 * sizeof(struct xseg_reply_map_scatterlist);
+ target = xseg_get_target(xseg, xreq);
+ strncpy(buf, target, xreq->targetlen);
+ xseg_resize_request(xseg, xreq, xreq->targetlen, s);
+ target = xseg_get_target(xseg, xreq);
+ strncpy(target, buf, xreq->targetlen);
+
+ struct xseg_reply_map *mreply = (void *)xseg_get_data(xseg, xreq);
+ mreply->cnt = 2;
mreply->segs[0].offset = xreq->offset;
- mreply->segs[0].size = xreq->size;
+ mreply->segs[0].size = xreq->size/2;
+ /* FIXME: strlcpy() would work nicely here */
+ strncpy(mreply->segs[0].target, target, xreq->targetlen);
+ mreply->segs[0].target[xreq->targetlen] = '_';
+ mreply->segs[0].target[xreq->targetlen + 1] = '1';
+ mreply->segs[0].target[xreq->targetlen + 2] = '\0';
+
+ mreply->segs[1].offset = xreq->offset;
+ mreply->segs[1].size = xreq->size/2;
/* FIXME: strlcpy() would work nicely here */
- strncpy(mreply->segs[0].target, xreq->target, xreq->targetlen);
- mreply->segs[0].target[xreq->targetlen] = '\0';
+ strncpy(mreply->segs[1].target, target, xreq->targetlen);
+ mreply->segs[1].target[xreq->targetlen] = '_';
+ mreply->segs[1].target[xreq->targetlen + 1] = '2';
+ mreply->segs[1].target[xreq->targetlen + 2] = '\0';
/* Respond to the initiator, signal the source port */
// perr(PI, 0, "completed io");
xreq->state |= XS_SERVED;
- ret = xseg_respond(xseg, xreq->portno, xreq);
- always_assert(ret != NoSerial);
- ret = xseg_signal(xseg, xreq->portno);
+ p = xseg_respond(xseg, xreq, mportno, X_ALLOC);
+ ret = xseg_signal(xseg, p);
// always_assert(ret == 1);
} else {
/*
goto out_with_xseginit;
}
- if (! (mapperd->mport = xseg_bind_port(mapperd->xseg, mapperd->mportno))) {
+ if (! (mapperd->mport = xseg_bind_port(mapperd->xseg, mapperd->mportno, NULL))) {
perr(PE, 0, "cannot bind to xseg port %ld", (long)mapperd->mportno);
ret = -EIO;
goto out_with_xsegjoin;
}
mapperd->mportno = xseg_portno(mapperd->xseg, mapperd->mport);
-
+ xseg_init_local_signal(mapperd->xseg, mapperd->mportno);
perr(PI, 0, "mapperd on port %u of %u",
mapperd->mportno, mapperd->xseg->config.nr_ports);