patch-2.1.53 linux/include/asm-sparc/namei.h

Next file: linux/include/asm-sparc64/ebus.h
Previous file: linux/include/asm-sparc/elf.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.52/linux/include/asm-sparc/namei.h linux/include/asm-sparc/namei.h
@@ -1,4 +1,4 @@
-/* $Id: namei.h,v 1.6 1997/07/17 02:24:25 davem Exp $
+/* $Id: namei.h,v 1.7 1997/08/29 15:52:27 jj Exp $
  * linux/include/asm-sparc/namei.h
  *
  * Routines to handle famous /usr/gnemul/s*.
@@ -11,41 +11,31 @@
 #define SPARC_BSD_EMUL "usr/gnemul/sunos/"
 #define SPARC_SOL_EMUL "usr/gnemul/solaris/"
 
-#if 0 /* XXX FIXME */
-
-extern int __namei(int, const char *, struct inode *, char *, struct inode **,
-		   struct inode **, struct qstr *, struct dentry **, int *);
-
-static __inline__ int
-__prefix_namei(int retrieve_mode, const char * name, struct inode * base,
-	       char * buf, struct inode ** res_dir, struct inode ** res_inode,
-	       struct qstr * last_name, struct dentry ** last_entry,
-	       int * last_error)
+static inline struct dentry *
+__sparc_lookup_dentry(const char *name, int follow_link)
 {
 	int error;
+	struct dentry *base;
 
-	if (!(current->personality & (PER_BSD|PER_SVR4)))
-		return -ENOENT;
-
-	while (*name == '/')
-		name++;
-
-	atomic_inc(&current->fs->root->i_count);
-	error = __namei(NAM_FOLLOW_LINK,
-		        current->personality & PER_BSD ?
-		        SPARC_BSD_EMUL : SPARC_SOL_EMUL, current->fs->root,
-		        buf, NULL, &base, NULL, NULL, NULL);
-	if (error)
-		return error;
-
-	error = __namei(retrieve_mode, name, base, buf, res_dir, res_inode,
-			last_name, last_entry, last_error);
-	if (error)
-		return error;
-
-	return 0;
+	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;
+	
+	return lookup_dentry (name, base, follow_link);
 }
 
-#endif /* XXX FIXME */
+#define __prefix_lookup_dentry(name, follow_link)				\
+	dentry = __sparc_lookup_dentry (name, follow_link);			\
+	if (!IS_ERR (dentry)) return dentry;
 
 #endif /* __SPARC_NAMEI_H */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov