Exemple #1
0
static void
test_txattrcreate (void)
{
    Npfcall *fc, *fc2;

    if (!(fc = np_create_txattrcreate(1, "abc", 3, 4)))
        msg_exit ("out of memory");
    fc2 = _rcv_buf (fc, P9_TXATTRCREATE,  __FUNCTION__);

    assert (fc->u.txattrcreate.fid == fc2->u.txattrcreate.fid);
    assert (np_str9cmp (&fc->u.txattrcreate.name, &fc2->u.txattrcreate.name) == 0);
    assert (fc->u.txattrcreate.size == fc2->u.txattrcreate.size);
    assert (fc->u.txattrcreate.flag == fc2->u.txattrcreate.flag);

    free (fc);
    free (fc2);
}
Exemple #2
0
Fichier : xattr.c Projet : 8l/diod
int
npc_xattrcreate (Npcfid *fid, char *name, u64 attr_size, u32 flags)
{
	Npfcall *tc = NULL, *rc = NULL;
	int ret = -1;

	if (!(tc = np_create_txattrcreate (fid->fid, name, attr_size, flags))) {
		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;
}