[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lookup_dentry



On Thu, 2 May 2002, Sridhar N wrote:

> > Use path_init() & path_walk()
> Oh, how do i use these. In particular, what should the nameidata structure 
> contain ? Whatever i do, the path_walk gives me a segmentation fault. Am I 
> supposed to initialize this structure to something ? the function 
> link_path_walk suggests so, but since i don't know what to initialize it to, 
> i'm not initializing it to anything.
> 	What am i supposed to do here ?

	struct nameidata nd;
	struct dentry *dentry;
	int error;

	if(path_init(filename, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd))
		error = path_walk(filename, &nd);
	if(error || !(nd.dentry->d_inode))
		printk("Problem with %s\n",filename);
	else{
		dentry = nd.dentry;
	}
	/* and here you can work with dentry as usual */

-- 
JiKos.


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/