* better
[mascara-docs.git] / i386 / linux-2.3.21 / include / asm-sparc64 / namei.h
blobd3d57545c186702870d497176e683287627cee5a
1 /* $Id: namei.h,v 1.15 1999/06/10 05:23:17 davem Exp $
2 * linux/include/asm-sparc64/namei.h
4 * Routines to handle famous /usr/gnemul/s*.
5 * Included from linux/fs/namei.c
6 */
8 #ifndef __SPARC64_NAMEI_H
9 #define __SPARC64_NAMEI_H
11 #define SPARC_BSD_EMUL "usr/gnemul/sunos/"
12 #define SPARC_SOL_EMUL "usr/gnemul/solaris/"
14 static inline struct dentry *
15 __sparc64_lookup_dentry(const char *name, int lookup_flags)
17 struct dentry *base;
18 char *emul;
20 switch (current->personality) {
21 case PER_BSD:
22 emul = SPARC_BSD_EMUL; break;
23 case PER_SVR4:
24 emul = SPARC_SOL_EMUL; break;
25 default:
26 return NULL;
29 base = lookup_dentry (emul,
30 dget (current->fs->root),
31 (LOOKUP_FOLLOW | LOOKUP_DIRECTORY));
33 if (IS_ERR (base)) return NULL;
35 base = lookup_dentry (name, base, lookup_flags);
37 if (IS_ERR (base)) return NULL;
39 if (!base->d_inode) {
40 struct dentry *fromroot;
42 fromroot = lookup_dentry (name, dget (current->fs->root), lookup_flags);
44 if (IS_ERR (fromroot)) return base;
46 if (fromroot->d_inode) {
47 dput(base);
48 return fromroot;
51 dput(fromroot);
54 return base;
57 #define __prefix_lookup_dentry(name, lookup_flags) \
58 if (current->personality) { \
59 dentry = __sparc64_lookup_dentry (name, lookup_flags); \
60 if (dentry) return dentry; \
63 #endif /* __SPARC64_NAMEI_H */