Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
attr.c File Reference
#include <linux/export.h>
#include <linux/time.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/capability.h>
#include <linux/fsnotify.h>
#include <linux/fcntl.h>
#include <linux/security.h>
#include <linux/evm.h>
#include <linux/ima.h>

Go to the source code of this file.

Functions

int inode_change_ok (const struct inode *inode, struct iattr *attr)
 
 EXPORT_SYMBOL (inode_change_ok)
 
int inode_newsize_ok (const struct inode *inode, loff_t offset)
 
 EXPORT_SYMBOL (inode_newsize_ok)
 
void setattr_copy (struct inode *inode, const struct iattr *attr)
 
 EXPORT_SYMBOL (setattr_copy)
 
int notify_change (struct dentry *dentry, struct iattr *attr)
 
 EXPORT_SYMBOL (notify_change)
 

Function Documentation

EXPORT_SYMBOL ( inode_change_ok  )
EXPORT_SYMBOL ( inode_newsize_ok  )
EXPORT_SYMBOL ( setattr_copy  )
EXPORT_SYMBOL ( notify_change  )
int inode_change_ok ( const struct inode inode,
struct iattr attr 
)

inode_change_ok - check if attribute changes to an inode are allowed : inode to check : attributes to change

Check if we are allowed to change the attributes contained in in the given inode. This includes the normal unix access permission checks, as well as checks for rlimits and others.

Should be called as the first thing in ->setattr implementations, possibly after taking additional locks.

Definition at line 31 of file attr.c.

int inode_newsize_ok ( const struct inode inode,
loff_t  offset 
)

inode_newsize_ok - may this inode be truncated to a given size : the inode to be truncated : the new size to assign to the inode : 0 on success, -ve errno on failure

inode_newsize_ok must be called with i_mutex held.

inode_newsize_ok will check filesystem limits and ulimits to check that the new inode size is within limits. inode_newsize_ok will also send SIGXFSZ when necessary. Caller must not proceed with inode size change if failure is returned. must be a file (not directory), with appropriate permissions to allow truncate (inode_newsize_ok does NOT check these conditions).

Definition at line 97 of file attr.c.

int notify_change ( struct dentry dentry,
struct iattr attr 
)

Definition at line 167 of file attr.c.

void setattr_copy ( struct inode inode,
const struct iattr attr 
)

setattr_copy - copy simple metadata updates into the generic inode : the inode to be updated : the new attributes

setattr_copy must be called with i_mutex held.

setattr_copy updates the inode's metadata with that specified in attr. Noticeably missing is inode size update, which is more complex as it requires pagecache updates.

The inode is not marked as dirty after this operation. The rationale is that for "simple" filesystems, the struct inode is the inode storage. The caller is free to mark the inode dirty afterwards if needed.

Definition at line 140 of file attr.c.