Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations
inode.h File Reference
#include <linux/atomic.h>
#include <linux/fs.h>
#include <linux/list.h>
#include <linux/mm.h>
#include <linux/mutex.h>
#include <linux/seq_file.h>
#include "layout.h"
#include "volume.h"
#include "types.h"
#include "runlist.h"
#include "debug.h"

Go to the source code of this file.

Data Structures

struct  _ntfs_inode
 
struct  big_ntfs_inode
 
struct  ntfs_attr
 

Macros

#define NINO_FNS(flag)
 
#define TAS_NINO_FNS(flag)
 

Typedefs

typedef struct _ntfs_inode ntfs_inode
 

Enumerations

enum  ntfs_inode_state_bits {
  NI_Dirty, NI_AttrList, NI_AttrListNonResident, NI_Attr,
  NI_MstProtected, NI_NonResident, NI_IndexAllocPresent = NI_NonResident, NI_Compressed,
  NI_Encrypted, NI_Sparse, NI_SparseDisabled, NI_TruncateFailed
}
 

in Unicode characters (0 if unnamed)

: attribute type (see layout.h)

This structure exists only to provide a small structure for the ntfs_{attr_}iget()/ntfs_test_inode()/ntfs_init_locked_inode() mechanism.

NOTE: Elements are ordered by size to make the structure as compact as possible on all architectures.

typedef int(* test_t )(struct inode *, void *)
 
int ntfs_test_inode (struct inode *vi, ntfs_attr *na)
 
struct inodentfs_iget (struct super_block *sb, unsigned long mft_no)
 
struct inodentfs_attr_iget (struct inode *base_vi, ATTR_TYPE type, ntfschar *name, u32 name_len)
 
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_evict_big_inode (struct inode *vi)
 
void __ntfs_init_inode (struct super_block *sb, ntfs_inode *ni)
 
ntfs_inodentfs_new_extent_inode (struct super_block *sb, unsigned long mft_no)
 
void ntfs_clear_extent_inode (ntfs_inode *ni)
 
int ntfs_read_inode_mount (struct inode *vi)
 
int ntfs_show_options (struct seq_file *sf, struct dentry *root)
 

Macro Definition Documentation

#define NINO_FNS (   flag)
Value:
static inline int NIno##flag(ntfs_inode *ni) \
{ \
return test_bit(NI_##flag, &(ni)->state); \
} \
static inline void NInoSet##flag(ntfs_inode *ni) \
{ \
set_bit(NI_##flag, &(ni)->state); \
} \
static inline void NInoClear##flag(ntfs_inode *ni) \
{ \
clear_bit(NI_##flag, &(ni)->state); \
}

Definition at line 182 of file inode.h.

#define TAS_NINO_FNS (   flag)
Value:
static inline int NInoTestSet##flag(ntfs_inode *ni) \
{ \
return test_and_set_bit(NI_##flag, &(ni)->state); \
} \
static inline int NInoTestClear##flag(ntfs_inode *ni) \
{ \
return test_and_clear_bit(NI_##flag, &(ni)->state); \
}

Definition at line 199 of file inode.h.

Typedef Documentation

Definition at line 41 of file inode.h.

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

Definition at line 270 of file inode.h.

Enumeration Type Documentation

Enumerator:
NI_Dirty 
NI_AttrList 
NI_AttrListNonResident 
NI_Attr 
NI_MstProtected 
NI_NonResident 
NI_IndexAllocPresent 
NI_Compressed 
NI_Encrypted 
NI_Sparse 
NI_SparseDisabled 
NI_TruncateFailed 

Definition at line 144 of file inode.h.

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.