/** * @brief * vn_encode_DIS_V4 - encode version 4 vnode information, used by Mom. * * @par Functionality: * Used to encode vnode information. See vn_encode_DIS() above for a * description of the information. Supports version 4 only. * * @param[in] fd - socket descriptor to which to write the encode info. * @param[in] vnlp - structure to encode and send. * * @return int * @retval DIS_SUCCESS (0) on success * @retval DIS_* on error. * * @par Side Effects: None * * @par MT-safe: No, the structure pointed to by vnlp needs to be locked * */ static int vn_encode_DIS_V4(int fd, vnl_t *vnlp) { int rc; unsigned int i, j; if (((rc = diswui(fd, PS_DIS_V4)) != 0) || ((rc = diswsl(fd, (long) vnlp->vnl_modtime)) != 0) || ((rc = diswui(fd, vnlp->vnl_used)) != 0)) return (rc); for (i = 0; i < vnlp->vnl_used; i++) { vnal_t *curreslist = VNL_NODENUM(vnlp, i); if ((rc = diswst(fd, curreslist->vnal_id)) != 0) return (rc); if ((rc = diswui(fd, curreslist->vnal_used)) != 0) return (rc); for (j = 0; j < curreslist->vnal_used; j++) { vna_t *curres = VNAL_NODENUM(curreslist, j); if ((rc = diswst(fd, curres->vna_name)) != 0) return (rc); if ((rc = diswst(fd, curres->vna_val)) != 0) return (rc); if ((rc = diswsi(fd, curres->vna_type)) != 0) return (rc); if ((rc = diswsi(fd, curres->vna_flag)) != 0) return (rc); } } return (DIS_SUCCESS); }
int encode_DIS_Register(int sock, struct batch_request *preq) { int rc; if ((rc = diswst(sock, preq->rq_ind.rq_register.rq_owner) != 0) || (rc = diswst(sock, preq->rq_ind.rq_register.rq_parent) != 0) || (rc = diswst(sock, preq->rq_ind.rq_register.rq_child) != 0) || (rc = diswui(sock, preq->rq_ind.rq_register.rq_dependtype) != 0) || (rc = diswui(sock, preq->rq_ind.rq_register.rq_op) != 0) || (rc = diswsl(sock, preq->rq_ind.rq_register.rq_cost) != 0)) return rc; return 0; }
int diswsi(struct tcp_chan *chan, int value) { return diswsl(chan, (long) value); }