EXT2 file system file.c with my comments
来源:互联网 发布:mac打开appstore好慢 编辑:程序博客网 时间:2024/06/12 01:40
/* * linux/fs/ext2/file.c * * Copyright (C) 1992, 1993, 1994, 1995 * Remy Card (card@masi.ibp.fr) * Laboratoire MASI - Institut Blaise Pascal * Universite Pierre et Marie Curie (Paris VI) * * from * * linux/fs/minix/file.c * * Copyright (C) 1991, 1992 Linus Torvalds * * ext2 fs regular file handling primitives * * 64-bit file support on 64-bit platforms by Jakub Jelinek * (jj@sunsite.ms.mff.cuni.cz) */#include <linux/time.h>#include <linux/pagemap.h>#include <linux/quotaops.h>#include "ext2.h"#include "xattr.h"#include "acl.h"/* * Called when filp is released. This happens when all file descriptors * for a single struct file are closed. Note that different open() calls * for the same file yield different struct file structures. */static int ext2_release_file (struct inode * inode, struct file * filp){if (filp->f_mode & FMODE_WRITE) {mutex_lock(&EXT2_I(inode)->truncate_mutex);/*discard(free) block reservation window on last file close, or truncate* or at last iput().*/ext2_discard_reservation(inode);mutex_unlock(&EXT2_I(inode)->truncate_mutex);}return 0;}/*synchnorinize the file inode data to disk, now the data is already write to disk*/int ext2_fsync(struct file *file, loff_t start, loff_t end, int datasync){int ret;struct super_block *sb = file->f_mapping->host->i_sb;struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping;ret = generic_file_fsync(file, start, end, datasync); /*call the general method, it is very complex*/if (ret == -EIO || test_and_clear_bit(AS_EIO, &mapping->flags)) {/* We don't really know where the IO error happened... */ext2_error(sb, __func__, "detected IO error when writing metadata buffers");ret = -EIO;}return ret;}/* * We have mostly NULL's here: the current defaults are ok for * the ext2 filesystem. * most of the methods are in the linux/fs, they are the general methods */const struct file_operations ext2_file_operations = {.llseek= generic_file_llseek,.read= do_sync_read,.write= do_sync_write,.aio_read= generic_file_aio_read,.aio_write= generic_file_aio_write,.unlocked_ioctl = ext2_ioctl,#ifdef CONFIG_COMPAT.compat_ioctl= ext2_compat_ioctl,#endif.mmap= generic_file_mmap,.open= dquot_file_open,.release= ext2_release_file,.fsync= ext2_fsync,.splice_read= generic_file_splice_read,.splice_write= generic_file_splice_write,};#ifdef CONFIG_EXT2_FS_XIPconst struct file_operations ext2_xip_file_operations = {.llseek= generic_file_llseek,.read= xip_file_read,.write= xip_file_write,.unlocked_ioctl = ext2_ioctl,#ifdef CONFIG_COMPAT.compat_ioctl= ext2_compat_ioctl,#endif.mmap= xip_file_mmap,.open= dquot_file_open,.release= ext2_release_file,.fsync= ext2_fsync,};#endifconst struct inode_operations ext2_file_inode_operations = {#ifdef CONFIG_EXT2_FS_XATTR.setxattr= generic_setxattr,.getxattr= generic_getxattr,.listxattr= ext2_listxattr,.removexattr= generic_removexattr,#endif.setattr= ext2_setattr,.get_acl= ext2_get_acl,.fiemap= ext2_fiemap,};
0 0
- EXT2 file system file.c with my comments
- EXT2 file system dir.c with my comments
- EXT2 file system namei.c with my comments
- EXT2 file system super.c with my comments
- EXT2 file system ioctl.c with my comments
- EXT2 file system ialloc.c with my comments
- EXT2 file system balloc.c with my comments
- EXT2 file system inode.c with my comments
- 剖析 linux file system-Ext2
- ext2文件系统源代码之file.c
- Linux file system events with C, Python and Ruby
- Create file under /proc -- Manage it with standard file system
- Find your Root File System with MTD
- Working With The File System & Streams (1)
- Working With The File System & Streams (2)
- Working With The File System & Streams (3)
- Working With The File System & Streams (4)
- Find your Root File System with MTD
- wampservice怎么连接到自己安装的数据库(mysql)
- Unity3D下修改Polygon Collider 2D
- 09-语言入门-09-蛇形填数
- 数据类型和表达式(c++)
- C语言函数返回类型为指针时的一些问题
- EXT2 file system file.c with my comments
- Linux显示所有输出域自动缩小到最短三数字单元和显示单元的打印
- 网页设计:html布局学习1
- 深入理解java异常处理机制
- css 让div垂直水平居中,兼容ie6+
- error MSB8013: 此项目不包含配置和平台组合 Debug|Win32
- file not found: /Users/hx/Library/Developer/Xcode/DerivedData/Build/Products/...
- 今年的第一款量产产品
- [C++杂记] char *str会默认为const char *str