file.c (d5abfb1b7b26086db19ee430dea7282f01d4ef44) | file.c (60b99a1b9fa731453e1b69a3e0b3e4dcab7a6ea5) |
---|---|
1/* 2 * file.c 3 * 4 * PURPOSE 5 * File handling routines for the OSTA-UDF(tm) filesystem. 6 * 7 * COPYRIGHT 8 * This file is distributed under the terms of the GNU General Public --- 43 unchanged lines hidden (view full) --- 52 kaddr = kmap_atomic(page); 53 memcpy(kaddr, iinfo->i_data + iinfo->i_lenEAttr, isize); 54 memset(kaddr + isize, 0, PAGE_SIZE - isize); 55 flush_dcache_page(page); 56 SetPageUptodate(page); 57 kunmap_atomic(kaddr); 58} 59 | 1/* 2 * file.c 3 * 4 * PURPOSE 5 * File handling routines for the OSTA-UDF(tm) filesystem. 6 * 7 * COPYRIGHT 8 * This file is distributed under the terms of the GNU General Public --- 43 unchanged lines hidden (view full) --- 52 kaddr = kmap_atomic(page); 53 memcpy(kaddr, iinfo->i_data + iinfo->i_lenEAttr, isize); 54 memset(kaddr + isize, 0, PAGE_SIZE - isize); 55 flush_dcache_page(page); 56 SetPageUptodate(page); 57 kunmap_atomic(kaddr); 58} 59 |
60static int udf_adinicb_write_begin(struct file *file, 61 struct address_space *mapping, loff_t pos, 62 unsigned len, struct page **pagep, 63 void **fsdata) 64{ 65 struct page *page; 66 67 if (WARN_ON_ONCE(pos >= PAGE_SIZE)) 68 return -EIO; 69 page = grab_cache_page_write_begin(mapping, 0); 70 if (!page) 71 return -ENOMEM; 72 *pagep = page; 73 74 if (!PageUptodate(page)) 75 udf_adinicb_readpage(page); 76 return 0; 77} 78 | |
79static int udf_adinicb_write_end(struct file *file, struct address_space *mapping, 80 loff_t pos, unsigned len, unsigned copied, 81 struct page *page, void *fsdata) 82{ 83 struct inode *inode = page->mapping->host; 84 loff_t last_pos = pos + copied; 85 if (last_pos > inode->i_size) 86 i_size_write(inode, last_pos); 87 set_page_dirty(page); 88 unlock_page(page); 89 put_page(page); 90 return copied; 91} 92 93const struct address_space_operations udf_adinicb_aops = { 94 .dirty_folio = block_dirty_folio, 95 .invalidate_folio = block_invalidate_folio, 96 .read_folio = udf_read_folio, 97 .writepages = udf_writepages, | 60static int udf_adinicb_write_end(struct file *file, struct address_space *mapping, 61 loff_t pos, unsigned len, unsigned copied, 62 struct page *page, void *fsdata) 63{ 64 struct inode *inode = page->mapping->host; 65 loff_t last_pos = pos + copied; 66 if (last_pos > inode->i_size) 67 i_size_write(inode, last_pos); 68 set_page_dirty(page); 69 unlock_page(page); 70 put_page(page); 71 return copied; 72} 73 74const struct address_space_operations udf_adinicb_aops = { 75 .dirty_folio = block_dirty_folio, 76 .invalidate_folio = block_invalidate_folio, 77 .read_folio = udf_read_folio, 78 .writepages = udf_writepages, |
98 .write_begin = udf_adinicb_write_begin, | 79 .write_begin = udf_write_begin, |
99 .write_end = udf_adinicb_write_end, 100 .direct_IO = udf_direct_IO, 101}; 102 103static vm_fault_t udf_page_mkwrite(struct vm_fault *vmf) 104{ 105 struct vm_area_struct *vma = vmf->vma; 106 struct inode *inode = file_inode(vma->vm_file); --- 210 unchanged lines hidden --- | 80 .write_end = udf_adinicb_write_end, 81 .direct_IO = udf_direct_IO, 82}; 83 84static vm_fault_t udf_page_mkwrite(struct vm_fault *vmf) 85{ 86 struct vm_area_struct *vma = vmf->vma; 87 struct inode *inode = file_inode(vma->vm_file); --- 210 unchanged lines hidden --- |