コード例 #1
0
ファイル: xdr4.c プロジェクト: 274914765/C
static int
nlm4clt_decode_testres(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
{
    if (!(p = nlm4_decode_cookie(p, &resp->cookie)))
        return -EIO;
    resp->status = *p++;
    if (resp->status == nlm_lck_denied) {
        struct file_lock    *fl = &resp->lock.fl;
        u32            excl;
        __u64            start, len;
        __s64            end;

        memset(&resp->lock, 0, sizeof(resp->lock));
        locks_init_lock(fl);
        excl = ntohl(*p++);
        resp->lock.svid = ntohl(*p++);
        fl->fl_pid = (pid_t)resp->lock.svid;
        if (!(p = nlm4_decode_oh(p, &resp->lock.oh)))
            return -EIO;

        fl->fl_flags = FL_POSIX;
        fl->fl_type  = excl? F_WRLCK : F_RDLCK;
        p = xdr_decode_hyper(p, &start);
        p = xdr_decode_hyper(p, &len);
        end = start + len - 1;

        fl->fl_start = s64_to_loff_t(start);
        if (len == 0 || end < 0)
            fl->fl_end = OFFSET_MAX;
        else
            fl->fl_end = s64_to_loff_t(end);
    }
    return 0;
}
コード例 #2
0
ファイル: xdr4.c プロジェクト: 274914765/C
static int
nlm4clt_decode_res(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
{
    if (!(p = nlm4_decode_cookie(p, &resp->cookie)))
        return -EIO;
    resp->status = *p++;
    return 0;
}
コード例 #3
0
ファイル: xdr4.c プロジェクト: 274914765/C
int
nlm4svc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
{
    if (!(p = nlm4_decode_cookie(p, &resp->cookie)))
        return 0;
    resp->status = *p++;
    return xdr_argsize_check(rqstp, p);
}
コード例 #4
0
ファイル: xdr4.c プロジェクト: 274914765/C
int
nlm4svc_decode_unlockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
{
    if (!(p = nlm4_decode_cookie(p, &argp->cookie))
     || !(p = nlm4_decode_lock(p, &argp->lock)))
        return 0;
    argp->lock.fl.fl_type = F_UNLCK;
    return xdr_argsize_check(rqstp, p);
}
コード例 #5
0
ファイル: xdr4.c プロジェクト: 274914765/C
int
nlm4svc_decode_cancargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
{
    u32    exclusive;

    if (!(p = nlm4_decode_cookie(p, &argp->cookie)))
        return 0;
    argp->block = ntohl(*p++);
    exclusive = ntohl(*p++);
    if (!(p = nlm4_decode_lock(p, &argp->lock)))
        return 0;
    if (exclusive)
        argp->lock.fl.fl_type = F_WRLCK;
    return xdr_argsize_check(rqstp, p);
}
コード例 #6
0
ファイル: xdr4.c プロジェクト: 274914765/C
int
nlm4svc_decode_lockargs(struct svc_rqst *rqstp, __be32 *p, nlm_args *argp)
{
    u32    exclusive;

    if (!(p = nlm4_decode_cookie(p, &argp->cookie)))
        return 0;
    argp->block  = ntohl(*p++);
    exclusive    = ntohl(*p++);
    if (!(p = nlm4_decode_lock(p, &argp->lock)))
        return 0;
    if (exclusive)
        argp->lock.fl.fl_type = F_WRLCK;
    argp->reclaim = ntohl(*p++);
    argp->state   = ntohl(*p++);
    argp->monitor = 1;        /* monitor client by default */

    return xdr_argsize_check(rqstp, p);
}
int
nlm4svc_decode_shareargs(struct svc_rqst *rqstp, u32 *p, nlm_args *argp)
{
	struct nlm_lock	*lock = &argp->lock;

	memset(lock, 0, sizeof(*lock));
	locks_init_lock(&lock->fl);
	lock->fl.fl_pid = ~(u32) 0;

	if (!(p = nlm4_decode_cookie(p, &argp->cookie))
	 || !(p = xdr_decode_string_inplace(p, &lock->caller,
					    &lock->len, NLM_MAXSTRLEN))
	 || !(p = nlm4_decode_fh(p, &lock->fh))
	 || !(p = nlm4_decode_oh(p, &lock->oh)))
		return 0;
	argp->fsm_mode = ntohl(*p++);
	argp->fsm_access = ntohl(*p++);
	return xdr_argsize_check(rqstp, p);
}