Exemplo n.º 1
0
static noinline_for_stack
int au_do_h_d_reval(struct dentry *h_dentry, struct nameidata *nd,
		    struct dentry *dentry, aufs_bindex_t bindex)
{
	int err, valid;
	int (*reval)(struct dentry *, struct nameidata *);

	err = 0;
	reval = NULL;
	if (h_dentry->d_op)
		reval = h_dentry->d_op->d_revalidate;
	if (!reval)
		goto out;

	AuDbg("b%d\n", bindex);
	if (au_test_fs_null_nd(h_dentry->d_sb))
		/* it may return tri-state */
		valid = reval(h_dentry, NULL);
	else {
		struct nameidata h_nd;
		int locked;
		struct dentry *parent;

		au_h_nd(&h_nd, nd);
		parent = nd->path.dentry;
		locked = (nd && nd->path.dentry != dentry);
		if (locked)
			di_read_lock_parent(parent, AuLock_IR);
		BUG_ON(bindex > au_dbend(parent));
		h_nd.path.dentry = au_h_dptr(parent, bindex);
		BUG_ON(!h_nd.path.dentry);
		h_nd.path.mnt = au_sbr(parent->d_sb, bindex)->br_mnt;
		path_get(&h_nd.path);
		valid = reval(h_dentry, &h_nd);
		path_put(&h_nd.path);
		if (locked)
			di_read_unlock(parent, AuLock_IR);
	}

	if (unlikely(valid < 0))
		err = valid;
	else if (!valid)
		err = -EINVAL;

out:
	AuTraceErr(err);
	return err;
}
Exemplo n.º 2
0
void STGM::CBoolSphereSystem::simSphereSys(R_Calldata d)
{
   GetRNGstate();

   if(isNull(d->call)) {
       /* get arguments */
       double p1=REAL_ARG_LIST(d->args,0),p2=0;
       const char *fname = CHAR(STRING_ELT(d->fname,0));

       /* ACHTUNG: 'const' function braucht 2 Argumente */
       if(std::strcmp(fname, "const" ))
         p2=REAL_ARG_LIST(d->args,1);

       // set spheroid label
       const char *label = translateChar(asChar(d->label));

       if(!std::strcmp(fname, "rlnorm")) {
    	   simSpheresPerfect(p1,p2,label,d->isPerfect);
       } else {
           R_rndGen_t<rdist2_t> rrandom(p1,p2,fname);

           /* simulate with R's random generating functions */
           simSpheres<R_rndGen_t<rdist2_t> >(rrandom,label);
       }
   } else {
       /* eval R call for user defined radii distribution */
       const char *label = translateChar(asChar(d->label));
       R_eval_t<double> reval(d->call, d->rho);
       simSpheres<R_eval_t<double> &>(reval,label);
   }
   PutRNGstate();
}