Re: chown/chmod -R from kernel

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

 



On Tue, Mar 30, 2004 at 11:02:57AM +0200, Jan Hudec wrote:
> On Tue, Mar 30, 2004 at 02:00:25 +0200, Domen Puncer wrote:
> > I've been trying to fix usbfs bug (bugme 1418), and i have problems
> > implementing chown/chmod.
> > 
> > I've come up with following code (outputs 4xabd, even when there should be
> > directories; nothing seems chmoded in /proc/bus/usb/)
> > 
> > Any pointer what did i do wrong appreciated.
> 
> You shouldn't do chmod from kernel. You should call_usermodehelper.

But then I have to set chmod path somewhere?

> Dentry cache is a cache -- it does not hold ALL the files. Only some of
> them. At mostly random.

Hmm... then how could i change it from kernel?

> Permissions for /proc files must be fixed in the code that registers
> them.

Problem is that files are created before mounting usbfs (with devuid
etc. options).

> > 
> > 	Domen
> > 
> > struct dentry *dentry;   
> > list_for_each_entry(dentry, &s_root->d_subdirs, d_subdirs) {  
> > 	printk("a\n");     
> > 	if (!dentry->d_inode)    
> > 		continue;     
> > 	printk("b\n");     
> > 	if (dentry->d_inode->i_mode & S_IFDIR) { 
> > 		printk("c\n");     
> > 		struct dentry *devd;   
> > 		     
> > 		dentry->d_inode->i_uid = busuid;   
> > 		dentry->d_inode->i_gid = busgid;   
> > 		dentry->d_inode->i_mode = busmode & S_IFDIR; 
> > 		     
> > 		list_for_each_entry(devd, &dentry->d_subdirs,    
> > 				d_subdirs) {    
> > 			dentry->d_inode->i_uid = devuid;   
> > 			dentry->d_inode->i_gid = devgid;   
> > 			dentry->d_inode->i_mode = devmode & S_IFREG; 
> > 		}     
> > 	} else {   
> > 		printk("d\n");     
> > 		dentry->d_inode->i_uid = listuid;   
> > 		dentry->d_inode->i_gid = listgid;   
> > 		dentry->d_inode->i_mode = listmode & S_IFREG; 
> > 	}     
> > }     
> > 
> > --
> > Kernelnewbies: Help each other learn about the Linux kernel.
> > Archive:       http://mail.nl.linux.org/kernelnewbies/
> > FAQ:           http://kernelnewbies.org/faq/
> > 
> -------------------------------------------------------------------------------
> 						 Jan 'Bulb' Hudec <bulb@ucw.cz>



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


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux