Skip to content
Snippets Groups Projects
Select Git revision
  • 9717a91b01feda644f45fd63624a641385ef8f2d
  • master default
  • android-container
  • nanopc-t4
  • for-kernelci
  • WIP-syscall
  • v4.16-rc5
  • v4.16-rc4
  • v4.16-rc3
  • v4.16-rc2
  • v4.16-rc1
  • v4.15
  • v4.15-rc9
  • v4.15-rc8
  • v4.15-rc7
  • v4.15-rc6
  • v4.15-rc5
  • v4.15-rc4
  • v4.15-rc3
  • v4.15-rc2
  • v4.15-rc1
  • v4.14
  • v4.14-rc8
  • v4.14-rc7
  • v4.14-rc6
  • v4.14-rc5
26 results

inode.c

Blame
  • inode.c 18.33 KiB
    /*
     *  linux/fs/hfs/inode.c
     *
     * Copyright (C) 1995-1997  Paul H. Hargrove
     * (C) 2003 Ardis Technologies <roman@ardistech.com>
     * This file may be distributed under the terms of the GNU General Public License.
     *
     * This file contains inode-related functions which do not depend on
     * which scheme is being used to represent forks.
     *
     * Based on the minix file system code, (C) 1991, 1992 by Linus Torvalds
     */
    
    #include <linux/pagemap.h>
    #include <linux/mpage.h>
    #include <linux/sched.h>
    #include <linux/uio.h>
    
    #include "hfs_fs.h"
    #include "btree.h"
    
    static const struct file_operations hfs_file_operations;
    static const struct inode_operations hfs_file_inode_operations;
    
    /*================ Variable-like macros ================*/
    
    #define HFS_VALID_MODE_BITS  (S_IFREG | S_IFDIR | S_IRWXUGO)
    
    static int hfs_writepage(struct page *page, struct writeback_control *wbc)
    {
    	return block_write_full_page(page, hfs_get_block, wbc);
    }
    
    static int hfs_readpage(struct file *file, struct page *page)
    {
    	return block_read_full_page(page, hfs_get_block);
    }
    
    static void hfs_write_failed(struct address_space *mapping, loff_t to)
    {
    	struct inode *inode = mapping->host;
    
    	if (to > inode->i_size) {
    		truncate_pagecache(inode, inode->i_size);
    		hfs_file_truncate(inode);
    	}
    }
    
    static int hfs_write_begin(struct file *file, struct address_space *mapping,
    			loff_t pos, unsigned len, unsigned flags,
    			struct page **pagep, void **fsdata)
    {
    	int ret;
    
    	*pagep = NULL;
    	ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
    				hfs_get_block,
    				&HFS_I(mapping->host)->phys_size);
    	if (unlikely(ret))
    		hfs_write_failed(mapping, pos + len);
    
    	return ret;
    }
    
    static sector_t hfs_bmap(struct address_space *mapping, sector_t block)
    {
    	return generic_block_bmap(mapping, block, hfs_get_block);
    }
    
    static int hfs_releasepage(struct page *page, gfp_t mask)