/sound/i2c/

> The LITMUS^RT kernel.Bjoern Brandenburg
aboutsummaryrefslogblamecommitdiffstats
path: root/fs/utimes.c
blob: aa138d64560a6a3c2133bc70d57e367cc8c1476d (plain) (tree)
1
2
3
4
5
6
7
8
9
                           
                       

                          
                        
                        
                        
                       
                        
                           















                                                                    
                                                                               
 
                              
 
                    




                                                             
         
                                                                   



      

                                 
                                                    




                                              
                                                                   

                  
                              
                                                    
                                             
 
                                          
                  
                         
 



                                                     

                                                                 














                                                                     
                  


                                                                            
                   
                                                    
                




                                                                  

                                        
                                                    
 
                                                     
                                                                   

                                                            
                 
         
            
                                    
                                                                         
                                      




                                                           
 
                       



















                                                                       

                                                                            











                                                       
                            



                                                
                               
                               
                            

                                 

                                                              
                
                                 



                                                      
      
                                                                         


                                 

                                                    



                                                        

         



                     
                                                                   
                                                             





                                                                      









                                                                        
                                                                   
                                                

                                



















                                                                           
 
                                                                    

 

                                                


                                                         
#include <linux/compiler.h>
#include <linux/file.h>
#include <linux/fs.h>
#include <linux/linkage.h>
#include <linux/mount.h>
#include <linux/namei.h>
#include <linux/sched.h>
#include <linux/stat.h>
#include <linux/utime.h>
#include <linux/syscalls.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>

#ifdef __ARCH_WANT_SYS_UTIME

/*
 * sys_utime() can be implemented in user-level using sys_utimes().
 * Is this for backwards compatibility?  If so, why not move it
 * into the appropriate arch directory (for those architectures that
 * need it).
 */

/* If times==NULL, set access and modification to current time,
 * must be owner or have write permission.
 * Else, update from *times, must be owner or super user.
 */
SYSCALL_DEFINE2(utime, char __user *, filename, struct utimbuf __user *, times)
{
	struct timespec tv[2];

	if (times) {
		if (get_user(tv[0].tv_sec, &times->actime) ||
		    get_user(tv[1].tv_sec, &times->modtime))
			return -EFAULT;
		tv[0].tv_nsec = 0;
		tv[1].tv_nsec = 0;
	}
	return do_utimes(AT_FDCWD, filename, times ? tv : NULL, 0);
}

#endif

static bool nsec_valid(long nsec)
{
	if (nsec == UTIME_OMIT || nsec == UTIME_NOW)
		return true;

	return nsec >= 0 && nsec <= 999999999;
}

static int utimes_common(struct path *path, struct timespec *times)
{
	int error;
	struct iattr newattrs;
	struct inode *inode = path->dentry->d_inode;
	struct inode *delegated_inode = NULL;

	error = mnt_want_write(path->mnt);