这篇教程C++ unsigned_offsets函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中unsigned_offsets函数的典型用法代码示例。如果您正苦于以下问题:C++ unsigned_offsets函数的具体用法?C++ unsigned_offsets怎么用?C++ unsigned_offsets使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了unsigned_offsets函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: rw_verify_areaint rw_verify_area(int read_write, struct file *file, const loff_t *ppos, size_t count){ struct inode *inode; loff_t pos; int retval = -EINVAL; inode = file_inode(file); if (unlikely((ssize_t) count < 0)) return retval; pos = *ppos; if (unlikely(pos < 0)) { if (!unsigned_offsets(file)) return retval; if (count >= -pos) /* both values are in 0..LLONG_MAX */ return -EOVERFLOW; } else if (unlikely((loff_t) (pos + count) < 0)) { if (!unsigned_offsets(file)) return retval; } if (unlikely(inode->i_flctx && mandatory_lock(inode))) { retval = locks_mandatory_area(inode, file, pos, pos + count - 1, read_write == READ ? F_RDLCK : F_WRLCK); if (retval < 0) return retval; } return security_file_permission(file, read_write == READ ? MAY_READ : MAY_WRITE);}
开发者ID:Anjali05,项目名称:linux,代码行数:29,
示例2: generic_file_llseek_unlocked/** * generic_file_llseek_unlocked - lockless generic llseek implementation * @file: file structure to seek on * @offset: file offset to seek to * @origin: type of seek * * Updates the file offset to the value specified by @offset and @origin. * Locking must be provided by the caller. */loff_tgeneric_file_llseek_unlocked(struct file *file, loff_t offset, int origin){ struct inode *inode = file->f_mapping->host; switch (origin) { case SEEK_END: offset += inode->i_size; break; case SEEK_CUR: /* * Here we special-case the lseek(fd, 0, SEEK_CUR) * position-querying operation. Avoid rewriting the "same" * f_pos value back to the file because a concurrent read(), * write() or lseek() might have altered it */ if (offset == 0) return file->f_pos; offset += file->f_pos; break; } if (offset < 0 && !unsigned_offsets(file)) return -EINVAL; if (offset > inode->i_sb->s_maxbytes) return -EINVAL; /* Special lock needed here? */ if (offset != file->f_pos) { file->f_pos = offset; file->f_version = 0; } return offset;}
开发者ID:Arusar,项目名称:android_kernel_samsung_golden,代码行数:44,
示例3: default_llseekloff_t default_llseek(struct file *file, loff_t offset, int origin){ loff_t retval; mutex_lock(&file->f_dentry->d_inode->i_mutex); switch (origin) { case SEEK_END: offset += i_size_read(file->f_path.dentry->d_inode); break; case SEEK_CUR: if (offset == 0) { retval = file->f_pos; goto out; } offset += file->f_pos; } retval = -EINVAL; if (offset >= 0 || unsigned_offsets(file)) { if (offset != file->f_pos) { file->f_pos = offset; file->f_version = 0; } retval = offset; }out: mutex_unlock(&file->f_dentry->d_inode->i_mutex); return retval;}
开发者ID:Arusar,项目名称:android_kernel_samsung_golden,代码行数:28,
示例4: default_llseekloff_t default_llseek(struct file *file, loff_t offset, int whence){ struct inode *inode = file_inode(file); loff_t retval; mutex_lock(&inode->i_mutex); switch (whence) { case SEEK_END: offset += i_size_read(inode); break; case SEEK_CUR: if (offset == 0) { retval = file->f_pos; goto out; } offset += file->f_pos; break; case SEEK_DATA: /* * In the generic case the entire file is data, so as * long as offset isn't at the end of the file then the * offset is data. */ if (offset >= inode->i_size) { retval = -ENXIO; goto out; } break; case SEEK_HOLE: /* * There is a virtual hole at the end of the file, so * as long as offset isn't i_size or larger, return * i_size. */ if (offset >= inode->i_size) { retval = -ENXIO; goto out; } offset = inode->i_size; break; } retval = -EINVAL; if (offset >= 0 || unsigned_offsets(file)) { if (offset != file->f_pos) { file->f_pos = offset; file->f_version = 0;#ifdef CONFIG_DCACHE_COMPLETENESS /* if any lseek has happen, the directory cannot be * complete */ file->f_dir_gen--;#endif } retval = offset; }out: mutex_unlock(&inode->i_mutex); return retval;}
开发者ID:xpsair,项目名称:dcache,代码行数:58,
示例5: default_llseekloff_t default_llseek(struct file *file, loff_t offset, int origin){ struct inode *inode = file->f_path.dentry->d_inode; loff_t retval; mutex_lock(&inode->i_mutex); switch (origin) { case SEEK_END: offset += i_size_read(inode); break; case SEEK_CUR: if (offset == 0) { retval = file->f_pos; goto out; } offset += file->f_pos; break; case SEEK_DATA: /* * In the generic case the entire file is data, so as * long as offset isn't at the end of the file then the * offset is data. */ if (offset >= inode->i_size) { retval = -ENXIO; goto out; } break; case SEEK_HOLE: /* * There is a virtual hole at the end of the file, so * as long as offset isn't i_size or larger, return * i_size. */ if (offset >= inode->i_size) { retval = -ENXIO; goto out; } offset = inode->i_size; break; } retval = -EINVAL; if (offset >= 0 || unsigned_offsets(file)) { if (offset != file->f_pos) { file->f_pos = offset; file->f_version = 0; } retval = offset; }out: mutex_unlock(&inode->i_mutex); return retval;}
开发者ID:kuailexs,项目名称:A820_kernel,代码行数:53,
示例6: vfs_setpos/** * vfs_setpos - update the file offset for lseek * @file: file structure in question * @offset: file offset to seek to * @maxsize: maximum file size * * This is a low-level filesystem helper for updating the file offset to * the value specified by @offset if the given offset is valid and it is * not equal to the current file offset. * * Return the specified offset on success and -EINVAL on invalid offset. */loff_t vfs_setpos(struct file *file, loff_t offset, loff_t maxsize){ if (offset < 0 && !unsigned_offsets(file)) return -EINVAL; if (offset > maxsize) return -EINVAL; if (offset != file->f_pos) { file->f_pos = offset; file->f_version = 0; } return offset;}
开发者ID:a2hojsjsjs,项目名称:linux,代码行数:25,
示例7: lseek_executestatic loff_t lseek_execute(struct file *file, struct inode *inode, loff_t offset, loff_t maxsize){ if (offset < 0 && !unsigned_offsets(file)) return -EINVAL; if (offset > maxsize) return -EINVAL; if (offset != file->f_pos) { file->f_pos = offset; file->f_version = 0; } return offset;}
开发者ID:dkati,项目名称:Hulk-Kernel-V2,代码行数:14,
示例8: vfs_setpos/** * vfs_setpos - update the file offset for lseek * @file: file structure in question * @offset: file offset to seek to * @maxsize: maximum file size * * This is a low-level filesystem helper for updating the file offset to * the value specified by @offset if the given offset is valid and it is * not equal to the current file offset. * * Return the specified offset on success and -EINVAL on invalid offset. */loff_t vfs_setpos(struct file *file, loff_t offset, loff_t maxsize){ if (offset < 0 && !unsigned_offsets(file)) return -EINVAL; if (offset > maxsize) return -EINVAL; if (offset != file->f_pos) { file->f_pos = offset; file->f_version = 0;#ifdef CONFIG_DCACHE_COMPLETENESS /* if any lseek has happen, the directory cannot be * complete */ file->f_dir_gen--;#endif } return offset;}
开发者ID:xpsair,项目名称:dcache,代码行数:30,
示例9: vfs_setpos/** * vfs_setpos - update the file offset for lseek * @file: file structure in question * @offset: file offset to seek to * @maxsize: maximum file size * * This is a low-level filesystem helper for updating the file offset to * the value specified by @offset if the given offset is valid and it is * not equal to the current file offset. * * Return the specified offset on success and -EINVAL on invalid offset. */loff_t vfs_setpos(struct file *file, loff_t offset, loff_t maxsize){ if (offset < 0 && !unsigned_offsets(file)) return -EINVAL; if (offset > maxsize) return -EINVAL; if (offset != file->f_pos) { file->f_pos = offset; //~ Tesina if(file->f_flags & O_SESSION) { down_write(file->sess_so->sem); file->sess_so->offset = file->f_pos; printk("[VFS_SET_POS]Just fixed our file position in the session to %lld!/n", file->f_pos); up_write(file->sess_so->sem); } file->f_version = 0; } return offset;}
开发者ID:umberto-sonnino,项目名称:linux_kernel,代码行数:34,
示例10: f2fs_sync_file//.........这里部分代码省略.........{ struct pagevec pvec; int nr_pages; if (whence != SEEK_DATA) return 0; /* find first dirty page index */ pagevec_init(&pvec, 0); nr_pages = pagevec_lookup_tag(&pvec, mapping, &pgofs, PAGECACHE_TAG_DIRTY, 1); pgofs = nr_pages ? pvec.pages[0]->index : LONG_MAX; pagevec_release(&pvec); return pgofs;}static bool __found_offset(block_t blkaddr, pgoff_t dirty, pgoff_t pgofs, int whence){ switch (whence) { case SEEK_DATA: if ((blkaddr == NEW_ADDR && dirty == pgofs) || (blkaddr != NEW_ADDR && blkaddr != NULL_ADDR)) return true; break; case SEEK_HOLE: if (blkaddr == NULL_ADDR) return true; break; } return false;}static inline int unsigned_offsets(struct file *file){ return file->f_mode & FMODE_UNSIGNED_OFFSET;}static loff_t vfs_setpos(struct file *file, loff_t offset, loff_t maxsize){ if (offset < 0 && !unsigned_offsets(file)) return -EINVAL; if (offset > maxsize) return -EINVAL; if (offset != file->f_pos) { file->f_pos = offset; file->f_version = 0; } return offset;}static loff_t f2fs_seek_block(struct file *file, loff_t offset, int whence){ struct inode *inode = file->f_mapping->host; loff_t maxbytes = inode->i_sb->s_maxbytes; struct dnode_of_data dn; pgoff_t pgofs, end_offset, dirty; loff_t data_ofs = offset; loff_t isize; int err = 0; mutex_lock(&inode->i_mutex); isize = i_size_read(inode); if (offset >= isize)
开发者ID:handelxh,项目名称:ONEPLUS2RAZOR,代码行数:67,
注:本文中的unsigned_offsets函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ unsubscribe函数代码示例 C++ unshare_fs函数代码示例 |