summaryrefslogtreecommitdiffstats
path: root/include/asm-sparc64/namei.h
blob: 70d0f337fba201f7ee383422ffc5d83a749c682b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* $Id: namei.h,v 1.8 1997/09/06 02:25:27 davem Exp $
 * linux/include/asm-sparc64/namei.h
 *
 * Routines to handle famous /usr/gnemul/s*.
 * Included from linux/fs/namei.c
 */

#ifndef __SPARC64_NAMEI_H
#define __SPARC64_NAMEI_H

#define SPARC_BSD_EMUL "usr/gnemul/sunos/"
#define SPARC_SOL_EMUL "usr/gnemul/solaris/"

static inline struct dentry *
__sparc64_lookup_dentry(const char *name, int follow_link)
{
	struct dentry *base;

	switch (current->personality) {
	case PER_BSD:
	case PER_SVR4:
		break;
	default:
		return ERR_PTR(-ENOENT);
	}

	base = lookup_dentry ((current->personality == PER_BSD) ?
			SPARC_BSD_EMUL : SPARC_SOL_EMUL,
			dget (current->fs->root), 1);
			
	if (IS_ERR (base)) return base;
	
	base = lookup_dentry (name, base, follow_link);
	
	if (IS_ERR (base)) return base;
	
	if (!base->d_inode) {
		dput(base);
		return ERR_PTR(-ENOENT);
	}
	
	return base;
}

#define __prefix_lookup_dentry(name, follow_link)				\
	dentry = __sparc64_lookup_dentry (name, follow_link);			\
	if (!IS_ERR (dentry)) return dentry;

#endif /* __SPARC64_NAMEI_H */