X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=nfs3%2Fnfs3.c;h=0ba7f56a4cb3757504d60e72fb0c04e9959bfef7;hb=4bef26446b9100f63ac3c953b7f96f1966673980;hp=70c9a606f09d31e581626c09aac3f3132123b940;hpb=1fddb0453f35dd19cb96d2ef14784f0e31e63564;p=bluesky.git diff --git a/nfs3/nfs3.c b/nfs3/nfs3.c index 70c9a60..0ba7f56 100644 --- a/nfs3/nfs3.c +++ b/nfs3/nfs3.c @@ -609,8 +609,37 @@ rename3res * nfsproc3_rename_3_svc(rename3args *argp, struct svc_req *rqstp) { static rename3res result; + wcc_data *wcc1 = &result.rename3res_u.res.fromdir_wcc; + wcc_data *wcc2 = &result.rename3res_u.res.todir_wcc; + memset(wcc1, 0, sizeof(*wcc1)); + memset(wcc2, 0, sizeof(*wcc2)); - result.status = NFS3ERR_NOTSUPP; + BlueSkyInode *dir1 = lookup_fh(&argp->from.dir); + if (dir1 == NULL) { + result.status = NFS3ERR_STALE; + return &result; + } + encode_pre_wcc(wcc1, dir1); + + BlueSkyInode *dir2 = lookup_fh(&argp->to.dir); + if (dir2 == NULL) { + result.status = NFS3ERR_STALE; + return &result; + } + encode_pre_wcc(wcc2, dir1); + + gboolean status = bluesky_rename(dir1, argp->from.name, + dir2, argp->to.name, + TRUE, TRUE); + + wcc1->after.present = TRUE; + encode_fattr3(&wcc1->after.post_op_attr_u.attributes, dir1); + wcc2->after.present = TRUE; + encode_fattr3(&wcc2->after.post_op_attr_u.attributes, dir2); + if (status) + result.status = NFS3_OK; + else + result.status = NFS3ERR_PERM; return &result; }