static void _send_tclunk (Nptrans *t, int fid) { Npfcall *tc, *rc = _alloc_rc (); tc = np_create_tclunk (fid); if (!tc) msg_exit ("oom"); ttrans_rpc (t, tc, rc); free (tc); free (rc); }
static void test_tclunk (void) { Npfcall *fc, *fc2; if (!(fc = np_create_tclunk (1))) msg_exit ("out of memory in %s", __FUNCTION__); fc2 = _rcv_buf (fc, P9_TCLUNK, __FUNCTION__); assert (fc->u.tclunk.fid == fc2->u.tclunk.fid); free (fc); free (fc2); }
static int npc_clunk(Npcfid *fid) { Npfcall *tc, *rc; Npcfsys *fs; fs = fid->fsys; tc = np_create_tclunk(fid->fid); if (npc_rpc(fid->fsys, tc, &rc) < 0) { free(tc); return -1; } npc_fid_free(fid); free(tc); free(rc); return 0; }
int npc_clunk (Npcfid *fid) { Npfcall *tc = NULL, *rc = NULL; int ret = -1; if (!(tc = np_create_tclunk (fid->fid))) { np_uerror (ENOMEM); goto done; } if (fid->fsys->rpc (fid->fsys, tc, &rc) < 0) goto done; npc_fid_free(fid); ret = 0; done: if (tc) free (tc); if (rc) free (rc); return ret; }