Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Typedefs | Functions
inode.c File Reference
#include <linux/buffer_head.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/mount.h>
#include <linux/mutex.h>
#include <linux/pagemap.h>
#include <linux/quotaops.h>
#include <linux/slab.h>
#include <linux/log2.h>
#include "aops.h"
#include "attrib.h"
#include "bitmap.h"
#include "dir.h"
#include "debug.h"
#include "inode.h"
#include "lcnalloc.h"
#include "malloc.h"
#include "mft.h"
#include "time.h"
#include "ntfs.h"

Go to the source code of this file.

Typedefs

typedef int(* set_t )(struct inode *, void *)
 

Functions

int ntfs_test_inode (struct inode *vi, ntfs_attr *na)
 
struct inodentfs_iget (struct super_block *sb, unsigned long mft_no)
 
, and @name_len, which is present in the base mft record

specified by the vfs inode .

If the attribute inode is in the cache, it is just returned with an increased reference count. Otherwise, a new struct inode is allocated and initialized, and finally ntfs_read_locked_attr_inode() is called to read the attribute and fill in the inode structure.

Note, for index allocation attributes, you need to use ntfs_index_iget() instead of ntfs_attr_iget() as working with indices is a lot more complex.

Return the struct inode of the attribute inode on success. Check the return value with IS_ERR() and if true, the function failed and the error code is obtained from PTR_ERR().

struct inodentfs_attr_iget (struct inode *base_vi, ATTR_TYPE type, ntfschar *name, u32 name_len)
 

and , which is present in the base mft record specified by the vfs inode .

If the index inode is in the cache, it is just returned with an increased reference count. Otherwise, a new struct inode is allocated and initialized, and finally ntfs_read_locked_index_inode() is called to read the index related attributes and fill in the inode structure.

Return the struct inode of the index inode on success. Check the return value with IS_ERR() and if true, the function failed and the error code is obtained from PTR_ERR().

struct inodentfs_index_iget (struct inode *base_vi, ntfschar *name, u32 name_len)
 
struct inodentfs_alloc_big_inode (struct super_block *sb)
 
void ntfs_destroy_big_inode (struct inode *inode)
 
void __ntfs_init_inode (struct super_block *sb, ntfs_inode *ni)
 
ntfs_inodentfs_new_extent_inode (struct super_block *sb, unsigned long mft_no)
 
int ntfs_read_inode_mount (struct inode *vi)
 
void ntfs_clear_extent_inode (ntfs_inode *ni)
 
void ntfs_evict_big_inode (struct inode *vi)
 
int ntfs_show_options (struct seq_file *sf, struct dentry *root)
 

Typedef Documentation

typedef int(* set_t)(struct inode *, void *)

Definition at line 148 of file inode.c.

Function Documentation

void __ntfs_init_inode ( struct super_block sb,
ntfs_inode ni 
)

__ntfs_init_inode - initialize ntfs specific part of an inode : super block of mounted volume : freshly allocated ntfs inode which to initialize

Initialize an ntfs inode to defaults.

NOTE: ni->mft_no, ni->state, ni->type, ni->name, and ni->name_len are left untouched. Make sure to initialize them elsewhere.

Return zero on success and -ENOMEM on error.

Definition at line 393 of file inode.c.

struct inode* ntfs_alloc_big_inode ( struct super_block sb)
read

Definition at line 321 of file inode.c.

struct inode* ntfs_attr_iget ( struct inode base_vi,
ATTR_TYPE  type,
ntfschar name,
u32  name_len 
)
read

Definition at line 227 of file inode.c.

void ntfs_clear_extent_inode ( ntfs_inode ni)

Definition at line 2225 of file inode.c.

void ntfs_destroy_big_inode ( struct inode inode)

Definition at line 341 of file inode.c.

void ntfs_evict_big_inode ( struct inode vi)

ntfs_evict_big_inode - clean up the ntfs specific part of an inode : vfs inode pending annihilation

When the VFS is going to remove an inode from memory, ntfs_clear_big_inode() is called, which deallocates all memory belonging to the NTFS specific part of the inode and returns.

If the MFT record is dirty, we commit it before doing anything else.

Definition at line 2257 of file inode.c.

struct inode* ntfs_iget ( struct super_block sb,
unsigned long  mft_no 
)
read

ntfs_iget - obtain a struct inode corresponding to a specific normal inode : super block of mounted volume : mft record number / inode number to obtain

Obtain the struct inode corresponding to a specific normal inode (i.e. a file or directory).

If the inode is in the cache, it is just returned with an increased reference count. Otherwise, a new struct inode is allocated and initialized, and finally ntfs_read_locked_inode() is called to read in the inode and fill in the remainder of the inode structure.

Return the struct inode on success. Check the return value with IS_ERR() and if true, the function failed and the error code is obtained from PTR_ERR().

Definition at line 170 of file inode.c.

struct inode* ntfs_index_iget ( struct inode base_vi,
ntfschar name,
u32  name_len 
)
read

Definition at line 285 of file inode.c.

ntfs_inode* ntfs_new_extent_inode ( struct super_block sb,
unsigned long  mft_no 
)
inline

Definition at line 427 of file inode.c.

int ntfs_read_inode_mount ( struct inode vi)

ntfs_read_inode_mount - special read_inode for mount time use only : inode to read

Read inode FILE_MFT at mount time, only called with super_block lock held from within the read_super() code path.

This function exists because when it is called the page cache for $MFT/$DATA is not initialized and hence we cannot get at the contents of mft records by calling map_mft_record*().

Further it needs to cope with the circular references problem, i.e. cannot load any attributes other than $ATTRIBUTE_LIST until $DATA is loaded, because we do not know where the other extent mft records are yet and again, because we cannot call map_mft_record*() yet. Obviously this applies only when an attribute list is actually present in $MFT inode.

We solve these problems by starting with the $DATA attribute before anything else and iterating using ntfs_attr_lookup($DATA) over all extents. As each extent is found, we ntfs_mapping_pairs_decompress() including the implied ntfs_runlists_merge(). Each step of the iteration necessarily provides sufficient information for the next step to complete.

This should work but there are two possible pit falls (see inline comments below), but only time will tell if they are real pits or just smoke...

Definition at line 1774 of file inode.c.

int ntfs_show_options ( struct seq_file sf,
struct dentry root 
)

ntfs_show_options - show mount options in /proc/mounts : seq_file in which to write our mount options : root of the mounted tree whose mount options to display

Called by the VFS once for each mounted ntfs volume when someone reads /proc/mounts in order to display the NTFS specific mount options of each mount. The mount options of fs specified by are written to the seq file and success is returned.

Definition at line 2311 of file inode.c.

int ntfs_test_inode ( struct inode vi,
ntfs_attr na 
)

inode.c - NTFS kernel inode handling. Part of the Linux-NTFS project.

Copyright (c) 2001-2007 Anton Altaparmakov

This program/include file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program/include file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program (in the main directory of the Linux-NTFS distribution in the file COPYING); if not, write to the Free Software Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ntfs_test_inode - compare two (possibly fake) inodes for equality : vfs inode which to test : ntfs attribute which is being tested with

Compare the ntfs attribute embedded in the ntfs specific part of the vfs inode for equality with the ntfs attribute .

If searching for the normal file/directory inode, set ->type to AT_UNUSED. ->name and ->name_len are then ignored.

Return 1 if the attributes match and 0 if not.

NOTE: This function runs with the inode->i_lock spin lock held so it is not allowed to sleep.

Definition at line 60 of file inode.c.