Exemplo n.º 1
0
static int send_reply_iov(fuse_req_t req, int error, struct iovec *iov,
                          int count)
{
    struct fuse_out_header out;
    int res;

    if (error <= -1000 || error > 0) {
        fprintf(stderr, "fuse: bad error value: %i\n",  error);
        error = -ERANGE;
    }

    out.unique = req->unique;
    out.error = error;
    iov[0].iov_base = &out;
    iov[0].iov_len = sizeof(struct fuse_out_header);
    out.len = iov_length(iov, count);

    /* Foxconn removed start pling 06/19/2009 */
#if 0
    if (req->f->debug)
        fprintf(stderr, "   unique: %llu, error: %i (%s), outsize: %i\n",
                (unsigned long long) out.unique, out.error,
                strerror(-out.error), out.len);
#endif
    /* Foxconn removed end pling 06/19/2009 */

    res = fuse_chan_send(req->ch, iov, count);
    free_req(req);

    return res;
}
Exemplo n.º 2
0
int fuse_send_reply_iov_nofree(fuse_req_t req, int error, struct iovec *iov,
			       int count)
{
	struct fuse_out_header out;

	if (error <= -1000 || error > 0) {
		fprintf(stderr, "fuse: bad error value: %i\n",	error);
		error = -ERANGE;
	}

	out.unique = req->unique;
	out.error = error;
	iov[0].iov_base = &out;
	iov[0].iov_len = sizeof(struct fuse_out_header);
	out.len = iov_length(iov, count);

	if (req->f->debug) {
		if (out.error) {
			fprintf(stderr,
				"   unique: %llu, error: %i (%s), outsize: %i\n",
				(unsigned long long) out.unique, out.error,
				strerror(-out.error), out.len);
		} else {
			fprintf(stderr,
				"   unique: %llu, success, outsize: %i\n",
				(unsigned long long) out.unique, out.len);
		}
	}

	return fuse_chan_send(req->ch, iov, count);
}
Exemplo n.º 3
0
static int send_reply(fuse_req_t req, int error, const void *arg,
                      size_t argsize)
{
    struct fuse_out_header out;
    struct iovec iov[2];
    size_t count;
    int res;

    if (error <= -1000 || error > 0) {
        fprintf(stderr, "fuse: bad error value: %i\n",  error);
        error = -ERANGE;
    }

    out.unique = req->unique;
    out.error = error;
    count = 1;
    iov[0].iov_base = &out;
    iov[0].iov_len = sizeof(struct fuse_out_header);
    if (argsize && !error) {
        count++;
        iov[1].iov_base = (void *) arg;
        iov[1].iov_len = argsize;
    }
    out.len = iov_length(iov, count);

    if (req->f->debug) {
        printf("   unique: %llu, error: %i (%s), outsize: %i\n",
               out.unique, out.error, strerror(-out.error), out.len);
        fflush(stdout);
    }
    res = fuse_chan_send(req->ch, iov, count);
    free_req(req);

    return res;
}
static int send_notify_iov(struct fuse_ll *f, struct fuse_chan *ch,
			   int notify_code, struct iovec *iov, int count)
{
	struct fuse_out_header out;

	out.unique = 0;
	out.error = notify_code;
	iov[0].iov_base = &out;
	iov[0].iov_len = sizeof(struct fuse_out_header);
	out.len = iov_length(iov, count);

	if (f->debug)
		fprintf(stderr, "NOTIFY: code=%d count=%d length=%u\n",
			notify_code, count, out.len);

	return fuse_chan_send(ch, iov, count);
}
Exemplo n.º 5
0
static int mt_chan_send(struct fuse_chan *ch, const struct iovec iov[],
                        size_t count)
{
    struct procdata *pd = (struct procdata *) fuse_chan_data(ch);
    return fuse_chan_send(pd->prevch, iov, count);
}
Exemplo n.º 6
0
void fuse_reply_none(fuse_req_t req)
{
    fuse_chan_send(req->ch, NULL, 0);
    free_req(req);
}