static void test_tmkdir (void) { Npfcall *fc, *fc2; if (!(fc = np_create_tmkdir (1, "abc", 2, 3))) msg_exit ("out of memory"); fc2 = _rcv_buf (fc, P9_TMKDIR, __FUNCTION__); assert (fc->u.tmkdir.fid == fc2->u.tmkdir.fid); assert (np_str9cmp (&fc->u.tmkdir.name, &fc2->u.tmkdir.name) == 0); assert (fc->u.tmkdir.mode == fc2->u.tmkdir.mode); assert (fc->u.tmkdir.gid == fc2->u.tmkdir.gid); free (fc); free (fc2); }
int npc_mkdir (Npcfid *fid, char *name, u32 mode) { Npfcall *tc = NULL, *rc = NULL; int ret = -1; if (!(tc = np_create_tmkdir(fid->fid, name, mode, getegid()))) { np_uerror (ENOMEM); goto done; } if (fid->fsys->rpc(fid->fsys, tc, &rc) < 0) goto done; ret = 0; done: if (tc) free(tc); if (rc) free(rc); return ret; }