aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/dcache.h8
-rw-r--r--include/linux/fs.h31
-rw-r--r--include/linux/namei.h1
3 files changed, 33 insertions, 7 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
index 62157c03caf7..4df926199369 100644
--- a/include/linux/dcache.h
+++ b/include/linux/dcache.h
@@ -165,6 +165,7 @@ struct dentry_operations {
165 unsigned int, const char *, const struct qstr *); 165 unsigned int, const char *, const struct qstr *);
166 int (*d_delete)(const struct dentry *); 166 int (*d_delete)(const struct dentry *);
167 void (*d_release)(struct dentry *); 167 void (*d_release)(struct dentry *);
168 void (*d_prune)(struct dentry *);
168 void (*d_iput)(struct dentry *, struct inode *); 169 void (*d_iput)(struct dentry *, struct inode *);
169 char *(*d_dname)(struct dentry *, char *, int); 170 char *(*d_dname)(struct dentry *, char *, int);
170 struct vfsmount *(*d_automount)(struct path *); 171 struct vfsmount *(*d_automount)(struct path *);
@@ -184,8 +185,9 @@ struct dentry_operations {
184#define DCACHE_OP_COMPARE 0x0002 185#define DCACHE_OP_COMPARE 0x0002
185#define DCACHE_OP_REVALIDATE 0x0004 186#define DCACHE_OP_REVALIDATE 0x0004
186#define DCACHE_OP_DELETE 0x0008 187#define DCACHE_OP_DELETE 0x0008
188#define DCACHE_OP_PRUNE 0x0010
187 189
188#define DCACHE_DISCONNECTED 0x0010 190#define DCACHE_DISCONNECTED 0x0020
189 /* This dentry is possibly not currently connected to the dcache tree, in 191 /* This dentry is possibly not currently connected to the dcache tree, in
190 * which case its parent will either be itself, or will have this flag as 192 * which case its parent will either be itself, or will have this flag as
191 * well. nfsd will not use a dentry with this bit set, but will first 193 * well. nfsd will not use a dentry with this bit set, but will first
@@ -196,8 +198,8 @@ struct dentry_operations {
196 * dentry into place and return that dentry rather than the passed one, 198 * dentry into place and return that dentry rather than the passed one,
197 * typically using d_splice_alias. */ 199 * typically using d_splice_alias. */
198 200
199#define DCACHE_REFERENCED 0x0020 /* Recently used, don't discard. */ 201#define DCACHE_REFERENCED 0x0040 /* Recently used, don't discard. */
200#define DCACHE_RCUACCESS 0x0040 /* Entry has ever been RCU-visible */ 202#define DCACHE_RCUACCESS 0x0080 /* Entry has ever been RCU-visible */
201 203
202#define DCACHE_CANT_MOUNT 0x0100 204#define DCACHE_CANT_MOUNT 0x0100
203#define DCACHE_GENOCIDE 0x0200 205#define DCACHE_GENOCIDE 0x0200
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 78af9385f415..0c4df261af7e 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -768,7 +768,17 @@ struct inode {
768 768
769 /* Stat data, not accessed from path walking */ 769 /* Stat data, not accessed from path walking */
770 unsigned long i_ino; 770 unsigned long i_ino;
771 unsigned int i_nlink; 771 /*
772 * Filesystems may only read i_nlink directly. They shall use the
773 * following functions for modification:
774 *
775 * (set|clear|inc|drop)_nlink
776 * inode_(inc|dec)_link_count
777 */
778 union {
779 const unsigned int i_nlink;
780 unsigned int __i_nlink;
781 };
772 dev_t i_rdev; 782 dev_t i_rdev;
773 struct timespec i_atime; 783 struct timespec i_atime;
774 struct timespec i_mtime; 784 struct timespec i_mtime;
@@ -1755,6 +1765,19 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
1755} 1765}
1756 1766
1757/** 1767/**
1768 * set_nlink - directly set an inode's link count
1769 * @inode: inode
1770 * @nlink: new nlink (should be non-zero)
1771 *
1772 * This is a low-level filesystem helper to replace any
1773 * direct filesystem manipulation of i_nlink.
1774 */
1775static inline void set_nlink(struct inode *inode, unsigned int nlink)
1776{
1777 inode->__i_nlink = nlink;
1778}
1779
1780/**
1758 * inc_nlink - directly increment an inode's link count 1781 * inc_nlink - directly increment an inode's link count
1759 * @inode: inode 1782 * @inode: inode
1760 * 1783 *
@@ -1764,7 +1787,7 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
1764 */ 1787 */
1765static inline void inc_nlink(struct inode *inode) 1788static inline void inc_nlink(struct inode *inode)
1766{ 1789{
1767 inode->i_nlink++; 1790 inode->__i_nlink++;
1768} 1791}
1769 1792
1770static inline void inode_inc_link_count(struct inode *inode) 1793static inline void inode_inc_link_count(struct inode *inode)
@@ -1786,7 +1809,7 @@ static inline void inode_inc_link_count(struct inode *inode)
1786 */ 1809 */
1787static inline void drop_nlink(struct inode *inode) 1810static inline void drop_nlink(struct inode *inode)
1788{ 1811{
1789 inode->i_nlink--; 1812 inode->__i_nlink--;
1790} 1813}
1791 1814
1792/** 1815/**
@@ -1799,7 +1822,7 @@ static inline void drop_nlink(struct inode *inode)
1799 */ 1822 */
1800static inline void clear_nlink(struct inode *inode) 1823static inline void clear_nlink(struct inode *inode)
1801{ 1824{
1802 inode->i_nlink = 0; 1825 inode->__i_nlink = 0;
1803} 1826}
1804 1827
1805static inline void inode_dec_link_count(struct inode *inode) 1828static inline void inode_dec_link_count(struct inode *inode)
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 409328d1cbbb..ffc02135c483 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -67,6 +67,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
67#define LOOKUP_EMPTY 0x4000 67#define LOOKUP_EMPTY 0x4000
68 68
69extern int user_path_at(int, const char __user *, unsigned, struct path *); 69extern int user_path_at(int, const char __user *, unsigned, struct path *);
70extern int user_path_at_empty(int, const char __user *, unsigned, struct path *, int *empty);
70 71
71#define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path) 72#define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path)
72#define user_lpath(name, path) user_path_at(AT_FDCWD, name, 0, path) 73#define user_lpath(name, path) user_path_at(AT_FDCWD, name, 0, path)