Exemple #1
0
static char *au_build_path(struct dentry *h_parent, struct path *h_rootpath,
			   char *buf, int len, struct super_block *sb)
{
	char *p;
	int n;

	AuTraceEnter();

	p = d_path(h_rootpath->dentry, h_rootpath->mnt, buf, len);
	if (IS_ERR(p))
		goto out;
	n = strlen(p);

	p = d_path(h_parent, h_rootpath->mnt, buf, len);
	if (IS_ERR(p))
		goto out;
	LKTRTrace("%s\n", p);
	if (n != 1)
		p += n;
	LKTRTrace("%p, %s, %ld\n",
		  p, p, (long)(p - buf));

	p = d_path(sb->s_root, au_sbi(sb)->si_mnt, buf, len - strlen(p));
	if (IS_ERR(p))
		goto out;
	if (n != 1)
		p[strlen(p)] = '/';
	LKTRTrace("%s\n", p);

 out:
	AuTraceErrPtr(p);
	return p;
}
Exemple #2
0
void di_write_lock2_parent(struct dentry *d1, struct dentry *d2, int isdir)
{
	AuTraceEnter();
	AuDebugOn(d1 == d2
		  || d1->d_inode == d2->d_inode
		  || d1->d_sb != d2->d_sb);

	if (isdir && au_test_subdir(d1, d2)) {
		di_write_lock_parent(d1);
		di_write_lock_parent2(d2);
	} else {
		/* there should be no races */
		di_write_lock_parent(d2);
		di_write_lock_parent2(d1);
	}
}
Exemple #3
0
void au_nhash_move(struct au_nhash *dst, struct au_nhash *src)
{
	int i;

	AuTraceEnter();

	*dst = *src;
	for (i = 0; i < AuSize_NHASH; i++) {
		struct hlist_head *h;
		h = dst->heads + i;
		if (h->first)
			h->first->pprev = &h->first;
		INIT_HLIST_HEAD(src->heads + i);
	}
	/* smp_mb(); */
}
Exemple #4
0
void au_nhash_fin(struct au_nhash *whlist)
{
	int i;
	struct hlist_head *head;
	struct au_vdir_wh *tpos;
	struct hlist_node *pos, *n;

	AuTraceEnter();

	for (i = 0; i < AuSize_NHASH; i++) {
		head = whlist->heads + i;
		hlist_for_each_entry_safe(tpos, pos, n, head, wh_hash) {
			/* hlist_del(pos); */
			kfree(tpos);
		}
	}
Exemple #5
0
void au_export_init(struct super_block *sb)
{
	struct au_sbinfo *sbinfo;
	__u32 u;

	AuTraceEnter();
	SiMustWriteLock(sb);

	sb->s_export_op = &aufs_export_op;
	sbinfo = au_sbi(sb);
	sbinfo->si_xigen = NULL;
	get_random_bytes(&u, sizeof(u));
	BUILD_BUG_ON(sizeof(u) != sizeof(int));
	atomic_set(&sbinfo->si_xigen_next, u);
	//memset(&sbinfo->si_xinodir, 0, sizeof(struct path));
}