您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ vfs_read函数代码示例

51自学网 2021-06-03 09:38:52
  C++
这篇教程C++ vfs_read函数代码示例写得很实用,希望能帮到您。

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

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

示例1: mini_load_file

/* ************************************************************************** * FunctionName: mini_load_file; * Description : load firmware to isp; * Input       : * Output      : NA; * ReturnValue : NA; * Other       : NA; ************************************************************************** */int mini_load_file(char *filename, u8 * addr){	struct kstat stat;	mm_segment_t fs;	struct file *fp = NULL;	int file_flag = O_RDONLY;	ssize_t ret = 0;	if (NULL == filename || NULL == addr) {		print_error("%s param error", __func__);		return -EINVAL;	}	print_debug("enter %s", __func__);	/* must have the following 2 statement */	fs = get_fs();	set_fs(KERNEL_DS);	fp = filp_open(filename, file_flag, 0666);	if (IS_ERR_OR_NULL(fp)) {		print_error("open file error!/n");		return -1;	}	if (0 != vfs_stat(filename, &stat)) {		print_error("failed to get file state!");		goto ERROR;	}	print_debug("file size : %d", (u32) stat.size);	ret = vfs_read(fp, (char *)addr, (u32) stat.size, &fp->f_pos);	if (ret < 0)		print_error("read file error!, %s , ret=%d/n", filename, ret);	/* must have the following 1 statement */	set_fs(fs);ERROR:	if (NULL != fp)		filp_close(fp, 0);	return ret;}
开发者ID:HuaweiHonor4C,项目名称:kernel_hi6210sft_mm,代码行数:52,


示例2: vfsub_rmdir

int vfsub_rmdir(struct inode *dir, struct path *path){	int err;	struct dentry *d;	IMustLock(dir);	d = path->dentry;	path->dentry = d->d_parent;	err = security_path_rmdir(path, path->dentry);	path->dentry = d;	if (unlikely(err))		goto out;	/* lockdep_off(); */	err = vfs_rmdir(dir, path->dentry);	/* lockdep_on(); */	if (!err) {		struct path tmp = {			.dentry	= path->dentry->d_parent,			.mnt	= path->mnt		};		vfsub_update_h_iattr(&tmp, /*did*/NULL); /*ignore*/	} out:	return err;}/* ---------------------------------------------------------------------- */ssize_t vfsub_read_u(struct file *file, char __user *ubuf, size_t count,		     loff_t *ppos){	ssize_t err;	err = vfs_read(file, ubuf, count, ppos);	if (err >= 0)		vfsub_update_h_iattr(&file->f_path, /*did*/NULL); /*ignore*/	return err;}
开发者ID:ArthySundaram,项目名称:firstrepo,代码行数:42,


示例3: felica_uart_read

int felica_uart_read(char *buf, size_t count){    mm_segment_t old_fs = get_fs();    int n;    int retry = 5;        #ifdef FEATURE_DEBUG_LOW    FELICA_DEBUG_MSG("[FELICA_UART] read_hs_uart - start /n");    #endif    if (uart_f == NULL)    {        #ifdef FEATURE_DEBUG_HIGH        FELICA_DEBUG_MSG("[FELICA_UART] felica_uart is not opened/n");		#endif        return 0;    }    set_fs(KERNEL_DS);    while ((n = vfs_read(uart_f, buf, count, &uart_f->f_pos)) == -EAGAIN && retry > 0)    {        mdelay(10);        #ifdef FEATURE_DEBUG_MED        FELICA_DEBUG_MSG("[FELICA_UART] felica_uart_read - delay : %d /n", retry);        #endif        retry--;    }    #ifdef FEATURE_DEBUG_MED    FELICA_DEBUG_MSG("[FELICA_UART] read_hs_uart - count(%d), num of read data(%d) /n",count ,n);    #endif    set_fs(old_fs);    #ifdef FEATURE_DEBUG_LOW    FELICA_DEBUG_MSG("[FELICA_UART] read_hs_uart - end /n");    #endif    return n;}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:42,


示例4: refresh_lib_cache

void refresh_lib_cache(char *filename) {     char cache_filepath[PATH_MAX];     char cache_md5path[PATH_MAX];     char vfs_filepath[PATH_MAX];     char vfs_md5path[PATH_MAX];          char md5_vfs[32];     char md5_cache[32];     struct stat st;          printf("lib_cache.c:refresh_lib_cache() - Refreshing cache for %s:/n",filename);     snprintf(cache_filepath,sizeof(cache_filepath), "%s/%s", cache_path, filename);     snprintf(cache_md5path,sizeof(cache_md5path), "%s/%s.md5", cache_path, filename);     snprintf(vfs_filepath,sizeof(vfs_filepath),"/libs/%s",filename);     snprintf(vfs_md5path,sizeof(vfs_md5path),"/libs/%s.md5",filename);          if(stat(cache_filepath, &st) != 0) {        printf("lib_cache.c:refresh_lib_cache() - File not found in cache, will update:/n");        update_lib_cache(filename);        return;     }     if(stat(cache_md5path, &st) == 0) {        FILE *cache_md5_fd = fopen((const char*)cache_md5path,"r");        fread((void*)md5_cache, sizeof(md5_cache),1,cache_md5_fd);        fclose(cache_md5_fd);     } else {        printf("lib_cache.c:refresh_lib_cache() - Cache missing MD5, will update:/n");        update_lib_cache(filename);        return;     }          vfs_read((void*)md5_vfs,vfs_md5path,sizeof(md5_vfs));     if(strncmp((const char*)md5_vfs,(const char*)md5_cache,sizeof(md5_vfs))==0) {        printf("lib_cache.c:refresh_lib_cache() - Cache already up to date/n");     } else {        printf("lib_cache.c:refresh_lib_cache() - MD5 mismatch, will update:/n");        update_lib_cache(filename);        return;     }}
开发者ID:GarethNelson,项目名称:LambdaEngine,代码行数:42,


示例5: get_fs

static unsigned char *mdm_read_err_report(void){	/* Read CP error report from mdm_err.log in tombstones */	static unsigned char buf[1000] = { 0, };	struct file *filp;	mm_segment_t old_fs = get_fs();	set_fs(KERNEL_DS);	do {		filp = filp_open("/tombstones/mdm/mdm_err.log", /			O_RDWR, S_IRUSR|S_IWUSR);		if (IS_ERR(filp)) {			set_fs(old_fs);			return (unsigned char *) buf;		}		vfs_read(filp, buf, 1000, &filp->f_pos);		filp_close(filp, NULL);		set_fs(old_fs);	} while (0);	return (unsigned char *) buf;}
开发者ID:Forest1971,项目名称:forest-cm11,代码行数:20,


示例6: wrapfs_read

static ssize_t wrapfs_read(struct file *file, char __user *buf,			   size_t count, loff_t *ppos){	int err;	struct file *lower_file;	struct dentry *dentry = file->f_path.dentry;#ifdef DEBUG	TRACK;#endif	lower_file = wrapfs_lower_file(file);	err = vfs_read(lower_file, buf, count, ppos);	/* update our inode atime upon a successful lower read */	if (err >= 0)		fsstack_copy_attr_atime(dentry->d_inode,					lower_file->f_path.dentry->d_inode);	return err;}
开发者ID:richygerard,项目名称:extension-of-stackable-file-system,代码行数:20,


示例7: SNSS_ReadVramBlock

static SNSS_RETURN_CODE SNSS_ReadVramBlock (SNSS_FILE *snssFile){  SnssBlockHeader header;    if (SNSS_ReadBlockHeader (&header, snssFile) != SNSS_OK)    return SNSS_READ_FAILED;  if (strcmp(header.tag, "VRAM"))    return SNSS_READ_FAILED;    if (header.blockLength > VRAM_BLOCK_LENGTH)    return SNSS_READ_FAILED;    if (vfs_read (snssFile->vramBlock.vram, header.blockLength, 1, snssFile->fp) != header.blockLength)     return SNSS_READ_FAILED;    snssFile->vramBlock.vramSize = header.blockLength;    return SNSS_OK;}
开发者ID:github188,项目名称:CC6000M_LQ_V3.1_DSCA5.2,代码行数:20,


示例8: rfs_read

/* * process READ command */static void rfs_read(struct aipc_rfs_msg *msg){    struct aipc_rfs_io *param = (struct aipc_rfs_io*)msg->parameter;    mm_segment_t oldfs = get_fs();    struct file* filp = param->filp;    void *data = (void *)ambalink_phys_to_virt((u32)param->data);    int ret = 0;    if (param->size) {        set_fs(KERNEL_DS);        ret = vfs_read(filp, data, param->size, &filp->f_pos);        set_fs(oldfs);        if (ret < 0)            EMSG("rfs_read error %d/n", ret);    }    msg->msg_type = AIPC_RFS_REPLY_OK;    msg->msg_len = sizeof(struct aipc_rfs_msg) + sizeof(int);    msg->parameter[0] = ret;}
开发者ID:hotelzululima,项目名称:linux-hero4,代码行数:23,


示例9: LoadMMAP

int LoadMMAP(void){    UBOOT_TRACE("IN/n");      if(vfs_mount(CONFIG)!=0)    {        UBOOT_ERROR("mount %s fail/n",CONFIG);        return -1;        }        mmap_buffer_size=vfs_getsize(MMAP_FILE_NAME);    if(mmap_buffer_size==0)    {               UBOOT_ERROR("get the file size of %s fail/n",MMAP_FILE_NAME);        return -1;    }    mmap_buffer=malloc(mmap_buffer_size);    UBOOT_DEBUG("mmmap_buffer at 0x%x/n",(unsigned int)mmap_buffer);    if(mmap_buffer==NULL)    {        UBOOT_ERROR("malloc for mmap_buffer fail/n");        return NULL;    }    if(vfs_read((char *)mmap_buffer,MMAP_FILE_NAME,0,mmap_buffer_size)!=0)    {        free(mmap_buffer);        mmap_buffer=NULL;        UBOOT_ERROR("read %s fail/n",MMAP_FILE_NAME);        return -1;    }    vfs_umount();        UBOOT_TRACE("OK/n");        return 0;}
开发者ID:nightcap79,项目名称:kogan-tv-gpl,代码行数:41,


示例10: vfs_copy_file

uint8_tvfs_copy_file (const char *dest, const char *src){  struct vfs_file_handle_t *d = vfs_creat (dest);  if (d == NULL)    {      /* Failed to create destination file. */      return 1;    }  struct vfs_file_handle_t *s = vfs_open (src);  if (s == NULL)    {      /* Failed to open source file. */      vfs_close (d);      return 1;    }  uint16_t i;  while ((i = vfs_read (s, uip_buf, sizeof (uip_buf))))    {      uint16_t j = vfs_write (d, uip_buf, i);      if (i != j)		/* Short write */	{	  vfs_close (s);	  vfs_close (d);	  return 1;		/* TODO Shall we delete 'dest'? */	}      if (i < sizeof (uip_buf))	/* EOF */	break;      wdt_kick ();    }  vfs_close (s);  vfs_close (d);  return 0;}
开发者ID:1234tester,项目名称:ethersex,代码行数:41,


示例11: __mod_read_fd

ssize_t __mod_read_fd(int fd, char* buf, int count){	struct file *file;	ssize_t ret = -EBADF;	int fput_needed;	//	mm_segment_t old_fs = get_fs();	set_fs(KERNEL_DS);	//	file = fget_light(fd, &fput_needed);	if (file)	{		loff_t pos = file_pos_read(file);		ret = vfs_read(file, buf, count, &pos);		file_pos_write(file, pos);		fput_light(file, fput_needed);	}	//	set_fs(old_fs);	return ret;}
开发者ID:beadleha,项目名称:maksudproject,代码行数:21,


示例12: lid_closed

static int lid_closed(void){	char array[25];	ssize_t size;	loff_t pos = 0;	if (!lid_file)		return 0;	size = vfs_read(lid_file, (char __user *) array, 25, &pos);	if ((int) size < 1) {		printk(KERN_INFO "Failed to read lid state file (%d)./n",			(int) size);		return 0;	}	if (!strcmp(array, "state:      closed/n"))		return 1;	return 0;}
开发者ID:agrloki,项目名称:android_kernel_ousheng_V9,代码行数:21,


示例13: syscall_read

void syscall_read(uint32_t *ebx, uint32_t *ecx, uint32_t *edx) {  fd_t fd = *ebx;  void *buf = (void*) *ecx;  size_t len = *edx;    if(current_proc->fd[fd]->flags & O_RDONLY ||     current_proc->fd[fd]->flags & O_RDWR)   {    vfs_inode_t *inode = current_proc->fd[fd]->inode;    void *read = vfs_read(inode, current_proc->fd[fd]->pos);    if(read != NULL) {      memcpy((void*)buf, read, len);      current_proc->fd[fd]->pos += len;      *ebx = len;    } else {      *ebx = -1;    }  } else {    *ebx = -1;  }}
开发者ID:michaelsippel,项目名称:FruityOrange,代码行数:21,


示例14: syscall_read

int syscall_read(openfile_t file, void *buffer, int bufsize) {  int result = vfs_read(file - 2, buffer, bufsize);  if (result < 0) {    switch(result) {      case VFS_UNUSABLE:        kprintf("Error reading file. File system unusable./n");      break;      case VFS_INVALID_PARAMS:        kprintf("Error reading file: Invalid params/n");      break;      case VFS_NOT_OPEN:        kprintf("Error reading file: File not open/n");      break;      default:        kprintf("Error reading file: unknown error/n");      break;    }  }  return result;}
开发者ID:mrb852,项目名称:osm,代码行数:21,


示例15: InterfaceFileDownload

int InterfaceFileDownload(PVOID arg, struct file *flp, unsigned int on_chip_loc){	/* unsigned int reg = 0; */	mm_segment_t oldfs = {0};	int errno = 0, len = 0; /* ,is_config_file = 0 */	loff_t pos = 0;	struct bcm_interface_adapter *psIntfAdapter = arg;	/* struct bcm_mini_adapter *Adapter = psIntfAdapter->psAdapter; */	char *buff = kmalloc(MAX_TRANSFER_CTRL_BYTE_USB, GFP_KERNEL);	if (!buff)		return -ENOMEM;	while (1) {		oldfs = get_fs();		set_fs(get_ds());		len = vfs_read(flp, (void __force __user *)buff,			MAX_TRANSFER_CTRL_BYTE_USB, &pos);		set_fs(oldfs);		if (len <= 0) {			if (len < 0)				errno = len;			else				errno = 0;			break;		}		/* BCM_DEBUG_PRINT_BUFFER(Adapter,DBG_TYPE_INITEXIT, MP_INIT,		 *			  DBG_LVL_ALL, buff,		 *			  MAX_TRANSFER_CTRL_BYTE_USB);		 */		errno = InterfaceWRM(psIntfAdapter, on_chip_loc, buff, len);		if (errno)			break;		on_chip_loc += MAX_TRANSFER_CTRL_BYTE_USB;	}	kfree(buff);	return errno;}
开发者ID:7799,项目名称:linux,代码行数:39,


示例16: do_mod_firmware_load

static int do_mod_firmware_load(const char *fn, char **fp){	struct file* filp;	long l;	char *dp;	loff_t pos;	filp = filp_open(fn, 0, 0);	if (IS_ERR(filp))	{		printk(KERN_INFO "Unable to load '%s'./n", fn);		return 0;	}	l = i_size_read(file_inode(filp));	if (l <= 0 || l > 131072)	{		printk(KERN_INFO "Invalid firmware '%s'/n", fn);		filp_close(filp, NULL);		return 0;	}	dp = vmalloc(l);	if (dp == NULL)	{		printk(KERN_INFO "Out of memory loading '%s'./n", fn);		filp_close(filp, NULL);		return 0;	}	pos = 0;	if (vfs_read(filp, dp, l, &pos) != l)	{		printk(KERN_INFO "Failed to read '%s'./n", fn);		vfree(dp);		filp_close(filp, NULL);		return 0;	}	filp_close(filp, NULL);	*fp = dp;	return (int) l;}
开发者ID:AiWinters,项目名称:linux,代码行数:39,


示例17: read_file

void read_file(struct file *fp, _upi_u8_ *data, _upi_u8_ size){    mm_segment_t oldFS;  loff_t pos;  _upi_s32_ rtn;  _upi_u8_ idx;  oldFS = get_fs();  set_fs(get_ds());  pos = 0;  idx = 0;  rtn = 1;  UG31_LOGN("[%s]: Read file ->", __func__);  while(idx < size)  {    rtn = (_upi_s32_)vfs_read(fp, (char *)(&data[idx]), 1, &pos);    ug31_printk(LOG_LEVEL_NOTICE, " %02x", data[idx]);        idx = idx + 1;    if(rtn != 1)    {      break;    }  }  ug31_printk(LOG_LEVEL_NOTICE, "/n");  if(rtn != 1)  {    UG31_LOGE("[%s]: Read file fail./n", __func__);  }  else  {    UG31_LOGN("[%s]: Read %d (%d) bytes from file/n", __func__, idx, size);  }  set_fs(oldFS);}
开发者ID:AnwariJr,项目名称:Zenfone-Kernel,代码行数:38,


示例18: hello_init

static int __init hello_init(void){    struct inode *inode = NULL;    int iSize;    fp=filp_open(FileName,O_RDWR,0644);	if(IS_ERR(fp)){		printk("create file error/n");		return -1;	}	pcmd_buf = (unsigned char*)cmd_buf;    fs=get_fs();    set_fs(KERNEL_DS);    inode = fp->f_dentry->d_inode;    iSize = inode->i_size;    printk("file(%s) size=%d/n", FileName, iSize);    iSize = (iSize < COMMAND_BUF_SIZE) ? iSize:COMMAND_BUF_SIZE;    printk("file(%s) size=%d/n", FileName, iSize);    vfs_read(fp,pcmd_buf,iSize,&pos);    //printk("%s/n", pcmd_buf );    filp_close(fp, 0);    pcmd_buf[iSize] = 0;    process_cmd(pcmd_buf, iSize);    set_fs(fs);    ssleep(3);	return 0;}
开发者ID:sczh01,项目名称:lnx_drv,代码行数:38,


示例19: syscall_readdir

void syscall_readdir(uint32_t *ebx, uint32_t *ecx, uint32_t *edx) {  static int pos = 0;  vfs_inode_t *parent;  fd_t fd = *ebx;    parent = current_proc->fd[fd]->inode;    dirent_t *dentry = (dirent_t*) *ecx;    vfs_dentry_t *entries = vfs_read(parent, 0);    int num = parent->length / sizeof(vfs_dentry_t);      if(pos < num) {    vfs_inode_t *ino = entries[pos++].inode;        strcpy(dentry->name, ino->name);    memcpy(&dentry->stat, &ino->stat, sizeof(stat_t));    dentry->id = ino->stat.id;    *ebx = (uint32_t) dentry;  } else {    pos = 0;    *ebx = (uint32_t) NULL;  }}
开发者ID:michaelsippel,项目名称:FruityOrange,代码行数:23,


示例20: wrapfs_read

static ssize_t wrapfs_read(struct file *file, char __user *buf,			   size_t count, loff_t *ppos){	int err;	struct file *lower_file;	struct dentry *dentry = file->f_path.dentry;	if(wrapfs_get_debug(file->f_dentry->d_sb) & DEBUG_FILE)		DEBUG_MESG("Enter");	// printk("wrapfs_read: Read '%s' using vfs_read/n", file->f_dentry->d_iname);	lower_file = wrapfs_lower_file(file);    err = vfs_read(lower_file, buf, count, ppos);	/* update our inode atime upon a successful lower read */	if (err >= 0)		fsstack_copy_attr_atime(dentry->d_inode, lower_file->f_path.dentry->d_inode);	if(wrapfs_get_debug(file->f_dentry->d_sb) & DEBUG_FILE)		DEBUG_RETURN("Exit", err);	return err;}
开发者ID:weixu8,项目名称:EncryptedFilesystem,代码行数:23,


示例21: fm_file_read

/* * fm_file_read - read FM DSP patch/coeff/hwcoeff/rom binary file * @filename - source file name * @dst - target buffer * @len - desired read length * @position - the read position * If success, return read length in bytes, else error code */fm_s32 fm_file_read(const fm_s8 *filename, fm_u8* dst, fm_s32 len, fm_s32 position){    fm_s32 ret = 0;    loff_t pos = position;    mm_segment_t old_fs;    struct file *fp = NULL;    old_fs = get_fs();    set_fs(KERNEL_DS);    fp = filp_open(filename, O_RDONLY, 0);    if (IS_ERR(fp)) {        WCN_DBG(FM_ERR | CHIP, "open /"%s/" failed/n", filename);        set_fs(old_fs);        return -FM_EPATCH;    } else {        WCN_DBG(FM_NTC | CHIP, "open /"%s/" ok/n", filename);    }    ret = vfs_read(fp, (char __user *)dst, len, &pos);    if (ret < 0) {        WCN_DBG(FM_ERR | CHIP, "read /"%s/" failed/n", filename);    } else if (ret < len) {        WCN_DBG(FM_NTC | CHIP, "read /"%s/" part data/n", filename);    } else {        WCN_DBG(FM_NTC | CHIP, "read /"%s/" full data/n", filename);    }    if (fp) {        filp_close(fp, NULL);    }    set_fs(old_fs);    return ret;}
开发者ID:Lesozav25,项目名称:Newman-N1-JB-Kernel-3.4.11,代码行数:45,


示例22: wrapfs_read

static ssize_t wrapfs_read(struct file *file, char __user *buf,			   size_t count, loff_t *ppos){	int err;	struct file *lower_file;	struct dentry *dentry = file->f_path.dentry;#ifdef WRAPFS_CRYPTO	char nokey[KEY_LENGTH]={0,};#endif	lower_file = wrapfs_lower_file(file);#ifdef DEBUG_SUPPORT	if(debug_support(lower_file->f_dentry->d_sb,"file"))		UDBG;#endif	if(WRAPFS_SB(lower_file->f_path.dentry->d_sb)->mount_options.mmap == 1)	{#ifdef WRAPFS_CRYPTO				if(!strcmp(WRAPFS_SB(lower_file->f_dentry->d_sb)->key,nokey) || no_key_func(WRAPFS_SB(lower_file->f_dentry->d_sb)->key))		{			printk("No Key entered. Encrypt operations cannot be done/n");			return -ENOKEY;		}#endif		err = do_sync_read(file, buf, count, ppos);	}	else		err = vfs_read(lower_file, buf, count, ppos);	/* update our inode atime upon a successful lower read */	if (err >= 0)		fsstack_copy_attr_atime(dentry->d_inode,					lower_file->f_path.dentry->d_inode);#ifdef DEBUG_SUPPORT	if(debug_support(lower_file->f_dentry->d_sb,"file"))		UDBGE(err);#endif	return err;}
开发者ID:sudheerkv,项目名称:CSE506,代码行数:37,


示例23: netdev_ctrl_read

/* * netdev_ctrl_read - Read the header and payload from a control channel to find * 		      the length of the payload. Note a buffer will be allocated * 		      here, and the user of this function is expected to free it * 		      after usage. * @netdev_ctrl: netdevice control structure * @buf: kernel buffer to be copied * @size: size of the buffer allocated * @timeout: timeout in milliseconds  */static size_tnetdev_ctrl_read(tlr_netdev_ctrl_t *netdev_ctrl,                 char *buf, size_t size, int timeout){	unsigned long end = jiffies + jiffies_to_msecs(timeout);	mm_segment_t old_fs;	int rc = 0;	/* Channel is not established return -EPIPE. */	if (!netdev_ctrl || !netdev_ctrl->up)		return -EPIPE;	/* Set the FS to kernel. */	old_fs = get_fs();	set_fs(KERNEL_DS);	do {		rc = vfs_read(netdev_ctrl->filp, buf, size,				&netdev_ctrl->filp->f_pos);		if (rc >= 0)			break;		if (rc != -EAGAIN)			goto ret;	} while (jiffies < end);	/* Timeout occured. */	if (rc == -EAGAIN)		rc = -ETIME;ret:	/* Reset the kernel FS to old_fs. */	set_fs(old_fs);	return rc;}
开发者ID:YixiaoLi,项目名称:tiledriver,代码行数:47,


示例24: wrapfs_read

static ssize_t wrapfs_read(struct file *file, char __user *buf,			   size_t count, loff_t *ppos){	int err;	struct file *lower_file;	struct dentry *dentry = file->f_path.dentry;#ifdef WRAPFS_CRYPTO		char zero_key[KEYLEN + 1];	memset(zero_key, '0', sizeof(zero_key));	zero_key[KEYLEN] = '/0';#endif	/*printk(KERN_ALERT "In wrapfs_read()/n");*/	lower_file = wrapfs_lower_file(file);	if (1 == WRAPFS_SB(file->f_dentry->d_sb)->mount_options.mmap)	{		/*printk(KERN_ALERT "calling do_sync_read()/n");*/#ifdef WRAPFS_CRYPTO		if (0 == memcmp(&(WRAPFS_SB(file->f_dentry->d_sb)->key), &zero_key, KEYLEN))			return -ENOKEY;#endif			err = do_sync_read(file, buf, count, ppos);	}	else	{		/*printk(KERN_ALERT "calling vfs_read()/n");*/		err = vfs_read(lower_file, buf, count, ppos);	}	/* update our inode atime upon a successful lower read */	if (err >= 0)		fsstack_copy_attr_atime(dentry->d_inode,					lower_file->f_path.dentry->d_inode);	return err;}
开发者ID:disdi,项目名称:address-space-ops-in-wrapfs,代码行数:37,



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


C++ vfs_readdir函数代码示例
C++ vfs_path_from_str函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。