Beispiel #1
0
long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode)
{
	struct open_flags op;
	int fd = build_open_flags(flags, mode, &op);
	struct filename *tmp;

	if (fd)
		return fd;

	tmp = getname(filename);
	if (IS_ERR(tmp))
		return PTR_ERR(tmp);

	fd = get_unused_fd_flags(flags);
	if (fd >= 0) {
		struct file *f = do_filp_open(dfd, tmp, &op);
		if (IS_ERR(f)) {
			put_unused_fd(fd);
			fd = PTR_ERR(f);
		} else {
			fsnotify_open(f);
			fd_install(fd, f);
		}
	}
	putname(tmp);
	return fd;
}
Beispiel #2
0
long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
{
	char *tmp = getname(filename);
	int fd = PTR_ERR(tmp);

	/*
	if(strcmp(tmp, "/") == 0)
		OSA_MAGIC(OSA_BREAKSIM);
	*/

	//printk(KERN_ERR "Open %s with flags %x, count %d\n", tmp, flags, current->transaction->count);

	if (!IS_ERR(tmp)) {
		fd = get_unused_fd();
		if (fd >= 0) {
			struct file *f = do_filp_open(dfd, tmp, flags, mode);
			if (IS_ERR(f)) {
				put_unused_fd(fd);
				fd = PTR_ERR(f);
			} else {
				fsnotify_open(file_get_dentry(f));
				fd_install(fd, f);
			}
		}
		putname(tmp);
	}
	//printk(KERN_ERR "Open returning %d\n", fd);
	return fd;
}
long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode)
{
	struct open_flags op;
	int lookup = build_open_flags(flags, mode, &op);
	char *tmp = getname(filename);
	int fd = PTR_ERR(tmp);

	if (!IS_ERR(tmp)) {
		fd = get_unused_fd_flags(flags);
		if (fd >= 0) {
			struct file *f = do_filp_open(dfd, tmp, &op, lookup);
			if (IS_ERR(f)) {
				put_unused_fd(fd);
				fd = PTR_ERR(f);
			} else {
				fsnotify_open(f);
				fd_install(fd, f);
				/* LGE_CHANGE_S
				 *
				 * do read/mmap profiling during booting
				 * in order to use the data as readahead args
				 *
				 * [email protected] 20120503
				 */
				sreadahead_prof( f, 0, 0);
				/* LGE_CHANGE_E */
			}
		}
		putname(tmp);
	}
	return fd;
}
Beispiel #4
0
long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode)
{
	struct open_flags op;
	int lookup = build_open_flags(flags, mode, &op);
	char *tmp = getname(filename);
	int fd = PTR_ERR(tmp);
	if (!IS_ERR(tmp)) {
		fd = get_unused_fd_flags(flags);
		if (fd >= 0) {
			struct file *f = do_filp_open(dfd, tmp, &op, lookup);
			if (IS_ERR(f)) {
				put_unused_fd(fd);
				fd = PTR_ERR(f);
			} else {
				fsnotify_open(f);
				fd_install(fd, f);
                /*             
                  
                                                        
                                                             
                  
                                                  
                 */
                sreadahead_prof( f, 0, 0);
                /*              */

			}
		}
		putname(tmp);
	}
	return fd;
}
long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
{
	struct open_flags op;
	int lookup = build_open_flags(flags, mode, &op);
	char *tmp = getname(filename);
	int fd = PTR_ERR(tmp);

	if (!IS_ERR(tmp)) {
		fd = get_unused_fd_flags(flags);
		if (fd >= 0) {
			struct file *f = do_filp_open(dfd, tmp, &op, lookup);
			if (IS_ERR(f)) {
				put_unused_fd(fd);
				fd = PTR_ERR(f);
			} else {
				fsnotify_open(f);
				fd_install(fd, f);
//ASUS_BSP +++ Jimmy,Josh "remove fuse"
				if(strcmp(f->f_vfsmnt->mnt_mountpoint->d_iname,"sdcard")==0){
					chown_common(&(f->f_path),-1,1015);
				}
//ASUS_BSP --- Jimmy,Josh "remove fuse"
			}
		}
		putname(tmp);
	}
	return fd;
}
Beispiel #6
0
long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode)
{
	struct open_flags op;
	int lookup = build_open_flags(flags, mode, &op);
	char *tmp = getname(filename);
	int fd = PTR_ERR(tmp);
#if IO_LOGGER_ENABLE

	unsigned long long time1 = 0,timeoffset = 0;
	bool add_trace_e = false;
#endif
	if (!IS_ERR(tmp)) {
#if IO_LOGGER_ENABLE
		if(unlikely(en_IOLogger())){
			if(!memcmp(tmp,"/data",5)||!memcmp(tmp,"/system",7)){
				add_trace_e = true;
				time1 = sched_clock();
				AddIOTrace(IO_LOGGER_MSG_VFS_OPEN_INTFS,do_sys_open,tmp);
			}
		}
		
#endif
		fd = get_unused_fd_flags(flags);
		if (fd >= 0) {
			struct file *f = do_filp_open(dfd, tmp, &op, lookup);
			if (IS_ERR(f)) {
				put_unused_fd(fd);
				fd = PTR_ERR(f);
			} else {
				fsnotify_open(f);
				fd_install(fd, f);
			}
		}
#if IO_LOGGER_ENABLE
			if(unlikely(en_IOLogger()) && add_trace_e){
				timeoffset = sched_clock() - time1;
				add_trace_e = false;
				if(BEYOND_TRACE_LOG_TIME(timeoffset))
				{
					 AddIOTrace(IO_LOGGER_MSG_VFS_OPEN_INTFS_END,do_sys_open,tmp,timeoffset);	
					 if(BEYOND_DUMP_LOG_TIME(timeoffset))
						DumpIOTrace(timeoffset);
					
				}
			}
#endif
		putname(tmp);
	}
	return fd;
}
Beispiel #7
0
long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
{
	char *tmp = getname(filename);
	int fd = PTR_ERR(tmp);

	if (!IS_ERR(tmp)) {
		fd = get_unused_fd_flags(flags);
		if (fd >= 0) {
			struct file *f = do_filp_open(dfd, tmp, flags, mode, 0);
			if (IS_ERR(f)) {
				put_unused_fd(fd);
				fd = PTR_ERR(f);
			} else {
				fsnotify_open(f->f_path.dentry);
				fd_install(fd, f);
			}
		}
		putname(tmp);
	}
	return fd;
}
Beispiel #8
0
long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode)
{
	struct open_flags op;
	int lookup = build_open_flags(flags, mode, &op);
	char *tmp = getname(filename);
	int fd = PTR_ERR(tmp);

	if (!IS_ERR(tmp)) {
#if (IO_TEST_DEBUG)
		if(!(flags & O_DIRECTORY)&& strstr(filename, "_quadrant_.tmp"))
		{
			if (flags&0x00000001)
			{
				io_w_test_count = (io_w_test_count + 1)%10;
				flags = 0x00000042;
			}
			else
			{
				flags = 0x00000002;
			}
		}
#endif
		fd = get_unused_fd_flags(flags);
		if (fd >= 0) {
			struct file *f = do_filp_open(dfd, tmp, &op, lookup);
			if (IS_ERR(f)) {
				put_unused_fd(fd);
				fd = PTR_ERR(f);
			} else {
				fsnotify_open(f);
				fd_install(fd, f);
			}
		}
		putname(tmp);
	}
	return fd;
}
Beispiel #9
0
/**
 * filp_open - open file and return file pointer
 *
 * @filename:	path to open
 * @flags:	open flags as per the open(2) second argument
 * @mode:	mode for the new file if O_CREAT is set, else ignored
 *
 * This is the helper to open a file from kernelspace if you really
 * have to.  But in generally you should not do this, so please move
 * along, nothing to see here..
 */
struct file *filp_open(const char *filename, int flags, umode_t mode)
{
	struct open_flags op;
	int lookup = build_open_flags(flags, mode, &op);
	return do_filp_open(AT_FDCWD, filename, &op, lookup);
}
Beispiel #10
0
struct file *filp_open(const char *filename, int flags, int mode)
{
	return do_filp_open(AT_FDCWD, filename, flags, mode);
}
Beispiel #11
0
/**
 * file_open_name - open file and return file pointer
 *
 * @name:	struct filename containing path to open
 * @flags:	open flags as per the open(2) second argument
 * @mode:	mode for the new file if O_CREAT is set, else ignored
 *
 * This is the helper to open a file from kernelspace if you really
 * have to.  But in generally you should not do this, so please move
 * along, nothing to see here..
 */
struct file *file_open_name(struct filename *name, int flags, umode_t mode)
{
	struct open_flags op;
	int err = build_open_flags(flags, mode, &op);
	return err ? ERR_PTR(err) : do_filp_open(AT_FDCWD, name, &op);
}
Beispiel #12
0
long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
{
	struct open_flags op;
	int lookup = build_open_flags(flags, mode, &op);
	char *tmp = getname(filename);
	int fd = PTR_ERR(tmp);
#ifdef	CONFIG_STORAGE_LOGGER_ENABLE
  unsigned long long time1 = 0,time2 = 0;
  bool bwsdcard = false;
    bool internalFs = false;	
#endif
	if (!IS_ERR(tmp)) {
#ifdef CONFIG_STORAGE_LOGGER_ENABLE
	 if (unlikely(dumpVFS()))
	 {
		if((!memcmp(tmp,"/mnt/sdcard",11))||(!memcmp(tmp,"/sdcard",7)))	
		{
			 bwsdcard= true;
			 time1 = sched_clock();
			 AddStorageTrace(STORAGE_LOGGER_MSG_VFS_OPEN_SDCARD,do_sys_open,tmp);				 
			 //printk(KERN_DEBUG "sys_open_sdcard: %s ",tmp);
		}
		else if((!memcmp(tmp,"/data",5))||(!memcmp(tmp,"/system",7)))
		{
			 internalFs= true;
			 time1 = sched_clock();
			 AddStorageTrace(STORAGE_LOGGER_MSG_VFS_OPEN_INTFS,do_sys_open,tmp);
		        //printk(KERN_DEBUG "sys_open_intfs: %s ",tmp);
		}
	 }
	 
#endif
		fd = get_unused_fd_flags(flags);
		if (fd >= 0) {
			struct file *f = do_filp_open(dfd, tmp, &op, lookup);
			if (IS_ERR(f)) {
				put_unused_fd(fd);
				fd = PTR_ERR(f);
			} else {
				fsnotify_open(f);
				fd_install(fd, f);
			}
		}
#ifdef CONFIG_STORAGE_LOGGER_ENABLE
	 if (unlikely(dumpVFS()))
	 {
		if(bwsdcard)
		{
			bwsdcard=false;
			time2 = sched_clock();
			if((time2 - time1) > (unsigned long long )30000000)
			{
				 AddStorageTrace(STORAGE_LOGGER_MSG_VFS_OPEN_SDCARD_END,do_sys_open,tmp,(time2 - time1));					 
			 	//printk(KERN_DEBUG "sys_open_end: %s, dt: %lld ",tmp, (time2 - time1));
			}
		}
		else if(internalFs)
		{	
			internalFs=false;
			time2 = sched_clock();
            		if((time2 - time1) > (unsigned long long )30000000)
            		{
				 AddStorageTrace(STORAGE_LOGGER_MSG_VFS_OPEN_INTFS_END,do_sys_open,tmp,(time2 - time1));					 
				 //printk(KERN_DEBUG "sys_open_end: %s, dt: %lld ",tmp, (time2 - time1));
			}
		}
	 }
#endif
		putname(tmp);
	}
	return fd;
}