int nfs4_op_putrootfh(struct nfs_argop4 *op, compound_data_t * data, struct nfs_resop4 *resp) { char __attribute__ ((__unused__)) funcname[] = "nfs4_op_putrootfh"; /* This NFS4 Operation has no argument, it just get then ROOTFH (replace MOUNTPROC3_MNT) */ /* First of all, set the reply to zero to make sure it contains no parasite information */ memset(resp, 0, sizeof(struct nfs_resop4)); resp->resop = NFS4_OP_PUTROOTFH; res_PUTROOTFH4.status = CreateROOTFH4(&(data->rootFH), data); if(res_PUTROOTFH4.status != NFS4_OK) return res_PUTROOTFH4.status; if (data->current_entry) { cache_inode_put(data->current_entry); } /* Fill in compound data */ set_compound_data_for_pseudo(data); /* I copy the root FH to the currentFH */ if(data->currentFH.nfs_fh4_len == 0) { res_PUTROOTFH4.status = nfs4_AllocateFH(&(data->currentFH)); if(res_PUTROOTFH4.status != NFS4_OK) return res_PUTROOTFH4.status; } /* Copy the data from root FH to current FH */ memcpy(data->currentFH.nfs_fh4_val, data->rootFH.nfs_fh4_val, data->rootFH.nfs_fh4_len); data->currentFH.nfs_fh4_len = data->rootFH.nfs_fh4_len; LogHandleNFS4("NFS4 PUTROOTFH ROOT FH: ", &data->rootFH); LogHandleNFS4("NFS4 PUTROOTFH CURRENT FH: ", &data->currentFH); LogFullDebug(COMPONENT_NFS_V4, "NFS4 PUTROOTFH: Ending on status %d", res_PUTROOTFH4.status); return res_PUTROOTFH4.status; } /* nfs4_op_putrootfh */
int nfs4_op_putrootfh(struct nfs_argop4 *op, compound_data_t * data, struct nfs_resop4 *resp) { int error; char __attribute__ ((__unused__)) funcname[] = "nfs4_op_putrootfh"; char fhstr[LEN_FH_STR]; /* This NFS4 Operation has no argument, it just get then ROOTFH (replace MOUNTPROC3_MNT) */ /* First of all, set the reply to zero to make sure it contains no parasite information */ memset(resp, 0, sizeof(struct nfs_resop4)); resp->resop = NFS4_OP_PUTROOTFH; resp->nfs_resop4_u.opputrootfh.status = NFS4_OK; if((error = CreateROOTFH4(&(data->rootFH), data)) != NFS4_OK) { res_PUTROOTFH4.status = error; return res_PUTROOTFH4.status; } data->current_entry = NULL; /* No cache inode entry for the directory within pseudo fs */ data->current_filetype = DIR_BEGINNING; /* Only directory in the pseudo fs */ /* I copy the root FH to the currentFH and, if not already done, to the publicFH */ /* For the moment, I choose to have rootFH = publicFH */ /* For initial mounted_on_FH, I'll use the rootFH, this will change at junction traversal */ if(data->currentFH.nfs_fh4_len == 0) { if((error = nfs4_AllocateFH(&(data->currentFH))) != NFS4_OK) { resp->nfs_resop4_u.opputrootfh.status = error; return error; } } memcpy((char *)(data->currentFH.nfs_fh4_val), (char *)(data->rootFH.nfs_fh4_val), data->rootFH.nfs_fh4_len); data->currentFH.nfs_fh4_len = data->rootFH.nfs_fh4_len; if(data->mounted_on_FH.nfs_fh4_len == 0) { if((error = nfs4_AllocateFH(&(data->mounted_on_FH))) != NFS4_OK) { resp->nfs_resop4_u.opputrootfh.status = error; return error; } } memcpy((char *)(data->mounted_on_FH.nfs_fh4_val), (char *)(data->rootFH.nfs_fh4_val), data->rootFH.nfs_fh4_len); data->mounted_on_FH.nfs_fh4_len = data->rootFH.nfs_fh4_len; if(data->publicFH.nfs_fh4_len == 0) { if((error = nfs4_AllocateFH(&(data->publicFH))) != NFS4_OK) { resp->nfs_resop4_u.opputrootfh.status = error; return error; } } /* Copy the data where they are supposed to be */ memcpy((char *)(data->publicFH.nfs_fh4_val), (char *)(data->rootFH.nfs_fh4_val), data->rootFH.nfs_fh4_len); data->publicFH.nfs_fh4_len = data->rootFH.nfs_fh4_len; /* Test */ nfs4_sprint_fhandle(&data->rootFH, fhstr); LogDebug(COMPONENT_NFS_V4, "NFS4 PUTROOTFH: rootFH=%s", fhstr); nfs4_sprint_fhandle(&data->currentFH, fhstr); LogDebug(COMPONENT_NFS_V4, "NFS4 PUTROOTFH: currentFH=%s", fhstr); LogFullDebug(COMPONENT_NFS_V4, "NFS4 PUTROOTFH: Ending on status %d", resp->nfs_resop4_u.opputrootfh.status); return resp->nfs_resop4_u.opputrootfh.status; } /* nfs4_op_putrootfh */