当前位置: 首页>>代码示例>>C++>>正文


C++ do_fsync函数代码示例

本文整理汇总了C++中do_fsync函数的典型用法代码示例。如果您正苦于以下问题:C++ do_fsync函数的具体用法?C++ do_fsync怎么用?C++ do_fsync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了do_fsync函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SYSCALL_DEFINE1

SYSCALL_DEFINE1(fdatasync, unsigned int, fd)
{
	if (!fsync_enabled)
			return 0;

	return do_fsync(fd, 1);
}
开发者ID:ShinySide,项目名称:HispAsian_Lollipop,代码行数:7,代码来源:sync.c

示例2: SYSCALL_DEFINE1

SYSCALL_DEFINE1(fdatasync, unsigned int, fd)
{
	#ifdef CONFIG_FSYNC_OFF
		return 0;
	#endif
	return do_fsync(fd, 1);
}
开发者ID:bigzz,项目名称:Galaxy_S6_920F_Kernel,代码行数:7,代码来源:sync.c

示例3: SYSCALL_DEFINE1

SYSCALL_DEFINE1(fdatasync, unsigned int, fd)
{
	//conditional fsync disable
	#ifdef CONFIG_FSYNC_OFF
	  return 0;
	#endif
	return do_fsync(fd, 1);
}
开发者ID:rajpurush,项目名称:Note2Core_v3_kernel_N710x,代码行数:8,代码来源:sync.c

示例4: SYSCALL_DEFINE1

SYSCALL_DEFINE1(fdatasync, unsigned int, fd)
{
#ifdef CONFIG_FSYNC_CONTROL
	if (!fsynccontrol_fsync_enabled())
		return 0;
#endif
	return do_fsync(fd, 1);
}
开发者ID:marcOcram,项目名称:android_kernel_primou,代码行数:8,代码来源:sync.c

示例5: SYSCALL_DEFINE1

SYSCALL_DEFINE1(fdatasync, unsigned int, fd)
{
#ifdef CONFIG_DYNAMIC_FSYNC
	if (likely(dyn_fsync_active && suspend_active))
		return 0;
#endif
	return do_fsync(fd, 1);
}
开发者ID:Slim80,项目名称:Imperium_LG_G4_MM_Kernel,代码行数:8,代码来源:sync.c

示例6: SYSCALL_DEFINE1

SYSCALL_DEFINE1(fdatasync, unsigned int, fd)
{
#if 0
	if (likely(dyn_fsync_active && !power_suspend_active))
		return 0;
	else
#endif
	return do_fsync(fd, 1);
}
开发者ID:marcio199226,项目名称:ebreo_kernel_d802_msm8974,代码行数:9,代码来源:sync.c

示例7: SYSCALL_DEFINE1

SYSCALL_DEFINE1(fdatasync, unsigned int, fd)
{
	#ifdef CONFIG_DYNAMIC_FSYNC
	  if (!early_suspend_active)
	    return 0;
	  else
	#endif
	return do_fsync(fd, 1);
}
开发者ID:aatjitra,项目名称:Note2,代码行数:9,代码来源:sync.c

示例8: close

 void close() final {
     if (m_fd >= 0) {
         int fd = m_fd;
         m_fd = -1;
         if (do_fsync()) {
             osmium::io::detail::reliable_fsync(fd);
         }
         osmium::io::detail::reliable_close(fd);
     }
 }
开发者ID:dforsi,项目名称:libosmium,代码行数:10,代码来源:compression.hpp

示例9: __do_fsync

static long __do_fsync(unsigned int fd, int datasync)
{
	struct file *file;
	int ret = -EBADF;

	file = fget(fd);
	if (file) {
		ret = do_fsync(file, datasync);
		fput(file);
	}
	return ret;
}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:12,代码来源:sync.c

示例10: close

 void close() final {
     if (m_gzfile) {
         const int result = ::gzclose(m_gzfile);
         m_gzfile = nullptr;
         if (result != Z_OK) {
             detail::throw_gzip_error(m_gzfile, "write close failed", result);
         }
         if (do_fsync()) {
             osmium::io::detail::reliable_fsync(m_fd);
         }
         osmium::io::detail::reliable_close(m_fd);
     }
 }
开发者ID:tomhughes,项目名称:libosmium,代码行数:13,代码来源:gzip_compression.hpp

示例11: close

 void close() final {
     if (m_bzfile) {
         int error;
         ::BZ2_bzWriteClose(&error, m_bzfile, 0, nullptr, nullptr);
         m_bzfile = nullptr;
         if (m_file) {
             if (do_fsync()) {
                 osmium::io::detail::reliable_fsync(::fileno(m_file));
             }
             if (fclose(m_file) != 0) {
                 throw std::system_error(errno, std::system_category(), "Close failed");
             }
         }
         if (error != BZ_OK) {
             detail::throw_bzip2_error(m_bzfile, "write close failed", error);
         }
     }
 }
开发者ID:Project-OSRM,项目名称:osrm-backend,代码行数:18,代码来源:bzip2_compression.hpp

示例12: reset_block_stats

static void reset_block_stats( const char *dev_name, const char *mount_dir )
{
  int fd;
  int rv;


  do_fsync( mount_dir );

  fd = open( dev_name, O_RDONLY );
  rtems_test_assert( fd >= 0 );

  rv = ioctl( fd, RTEMS_BLKIO_PURGEDEV );
  rtems_test_assert( rv == 0 );

  rv = ioctl( fd, RTEMS_BLKIO_RESETDEVSTATS );
  rtems_test_assert( rv == 0 );

  rv = close( fd );
  rtems_test_assert( rv == 0 );
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:20,代码来源:init.c

示例13: check_block_stats

static void check_block_stats( const char *dev_name,
  const char                              *mount_dir,
  const rtems_blkdev_stats                *expected_stats )
{
  int                fd;
  int                rv;
  rtems_blkdev_stats actual_stats;


  do_fsync( mount_dir );

  fd = open( dev_name, O_RDONLY );
  rtems_test_assert( fd >= 0 );

  rv = ioctl( fd, RTEMS_BLKIO_GETDEVSTATS, &actual_stats );
  rtems_test_assert( rv == 0 );
  rtems_test_assert( memcmp( &actual_stats, expected_stats,
                             sizeof( actual_stats ) ) == 0 );

  rv = close( fd );
  rtems_test_assert( rv == 0 );
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:22,代码来源:init.c

示例14: rk28_write_file

int rk28_write_file( char *filename )
{
        char *procmtd = "/proc/mtd";
        struct file			*filp = NULL;
        loff_t		                pos;
        long    fd;
        
        ssize_t l=0;
        char    pathname[64];
        char    buf[1024] ;
        mm_segment_t old_fs;
        struct rtc_time tm;
        ktime_t now;        
        char *tmpbuf; 
        int     mtdidx=0;
        int mtdsize = 0x200000; // 2M 
        char *log_buf;
        int     log_len;

        debug_print("%s: filename=%s\n" , __func__ , filename );

        old_fs = get_fs();
        set_fs(KERNEL_DS);        
        fd = sys_open( procmtd , O_RDONLY , 0 );
        if( fd >= 0 ) {
                memset( buf , 0 , 1024 );
                l = sys_read( fd , buf , 1024 );
               // debug_print("/proc/mtd,total byte=%d\n" , l );
                tmpbuf = strstr( buf , filename );
                if( tmpbuf ) {
                        tmpbuf[10] = 0;
                        mtdsize = simple_strtoul(tmpbuf-19, NULL , 16);
                        mtdidx = tmpbuf[-22];
                        //debug_print("size=%s\n,idx=%s\nmtdsize=%x , mtdidx=%d" , tmpbuf-19 , tmpbuf - 22 ,
                        //        mtdsize , mtdidx );
                        mtdsize *= 512;
                        mtdidx -= '0';
                }
                sys_close( fd );
        } else {
                debug_print("open %s failed\n" , procmtd );
        }
        sprintf(pathname , "/dev/block/mtdblock%d" , mtdidx );
        filp = filp_open(pathname, O_WRONLY , 0);
        if( IS_ERR(filp) ) {
                debug_print("open %s failed n" , pathname  );
                goto out_print;
        }
        if (!(filp->f_op->write || filp->f_op->aio_write)) {
                debug_print("can not write file %s \n" , pathname  );
                goto close_file;
        }
        now = ktime_get();
        rtc_time_to_tm( now.tv.sec , &tm );
        printk( "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n"
                          "++++++++++RECORD LOG AT %04d-%02d-%02d %02d:%02d:%02d++++++++++\n"
                          "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n\n\n"
                          ,
                tm.tm_year+1900 , tm.tm_mon , tm.tm_mday , tm.tm_hour , tm.tm_min , tm.tm_sec );
        /* 20090924,HSL,FTL only intial first 256M at loader , MUST write 32 sector one time */
        //debug_print("write first pack , pos=%d\n" , pos ); /* pos = 2 ?? */
        kernel_getlog(&log_buf , NULL ,  &log_len );
        log_len = (log_len+(32*512-1)) / (32*512) * (32*512);
        pos = 0;
        l = vfs_write( filp , log_buf  , log_len , &pos );
        do_fsync(filp, 1);
close_file:
        filp_close(filp , NULL);
out_print:  
        set_fs(old_fs);
        debug_print("\nlog len=%d,write=%d\n" ,log_len , l);
        return 0x2b;
}
开发者ID:loyfan,项目名称:android-kernel-mediacom-mp810c,代码行数:73,代码来源:debug.c

示例15: SYSCALL_DEFINE3

/*
 * MS_SYNC syncs the entire file - including mappings.
 *
 * MS_ASYNC does not start I/O (it used to, up to 2.5.67).
 * Nor does it marks the relevant pages dirty (it used to up to 2.6.17).
 * Now it doesn't do anything, since dirty pages are properly tracked.
 *
 * The application may now run fsync() to
 * write out the dirty pages and wait on the writeout and check the result.
 * Or the application may run fadvise(FADV_DONTNEED) against the fd to start
 * async writeout immediately.
 * So by _not_ starting I/O in MS_ASYNC we provide complete flexibility to
 * applications.
 */
SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags)
{
	unsigned long end;
	struct mm_struct *mm = current->mm;
	struct vm_area_struct *vma;
	int unmapped_error = 0;
	int error = -EINVAL;

	if (flags & ~(MS_ASYNC | MS_INVALIDATE | MS_SYNC))
		goto out;
	if (start & ~PAGE_MASK)
		goto out;
	if ((flags & MS_ASYNC) && (flags & MS_SYNC))
		goto out;
	error = -ENOMEM;
	len = (len + ~PAGE_MASK) & PAGE_MASK;
	end = start + len;
	if (end < start)
		goto out;
	error = 0;
	if (end == start)
		goto out;
	/*
	 * If the interval [start,end) covers some unmapped address ranges,
	 * just ignore them, but return -ENOMEM at the end.
	 */
	down_read(&mm->mmap_sem);
	vma = find_vma(mm, start);
	for (;;) {
		struct file *file;

		/* Still start < end. */
		error = -ENOMEM;
		if (!vma)
			goto out_unlock;
		/* Here start < vma->vm_end. */
		if (start < vma->vm_start) {
			start = vma->vm_start;
			if (start >= end)
				goto out_unlock;
			unmapped_error = -ENOMEM;
		}
		/* Here vma->vm_start <= start < vma->vm_end. */
		if ((flags & MS_INVALIDATE) &&
				(vma->vm_flags & VM_LOCKED)) {
			error = -EBUSY;
			goto out_unlock;
		}
		file = vma->vm_file;
		start = vma->vm_end;
		if ((flags & MS_SYNC) && file &&
				(vma->vm_flags & VM_SHARED)) {
			get_file(file);
			up_read(&mm->mmap_sem);
			error = do_fsync(file, 0);
			fput(file);
			if (error || start >= end)
				goto out;
			down_read(&mm->mmap_sem);
			vma = find_vma(mm, start);
		} else {
			if (start >= end) {
				error = 0;
				goto out_unlock;
			}
			vma = vma->vm_next;
		}
	}
out_unlock:
	up_read(&mm->mmap_sem);
out:
	return error ? : unmapped_error;
}
开发者ID:deepikateriar,项目名称:Onlive-Source-Backup,代码行数:87,代码来源:msync.c


注:本文中的do_fsync函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。