aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h130
1 files changed, 15 insertions, 115 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4f0b3bf5983c..58ce336d4a6b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -44,7 +44,7 @@ extern int get_max_files(void);
44struct inodes_stat_t { 44struct inodes_stat_t {
45 int nr_inodes; 45 int nr_inodes;
46 int nr_unused; 46 int nr_unused;
47 int dummy[5]; 47 int dummy[5]; /* padding for sysctl ABI compatibility */
48}; 48};
49extern struct inodes_stat_t inodes_stat; 49extern struct inodes_stat_t inodes_stat;
50 50
@@ -283,11 +283,13 @@ extern int dir_notify_enable;
283#include <linux/init.h> 283#include <linux/init.h>
284#include <linux/pid.h> 284#include <linux/pid.h>
285#include <linux/mutex.h> 285#include <linux/mutex.h>
286#include <linux/sysctl.h>
286 287
287#include <asm/atomic.h> 288#include <asm/atomic.h>
288#include <asm/semaphore.h> 289#include <asm/semaphore.h>
289#include <asm/byteorder.h> 290#include <asm/byteorder.h>
290 291
292struct export_operations;
291struct hd_geometry; 293struct hd_geometry;
292struct iovec; 294struct iovec;
293struct nameidata; 295struct nameidata;
@@ -820,6 +822,10 @@ struct file_lock {
820 union { 822 union {
821 struct nfs_lock_info nfs_fl; 823 struct nfs_lock_info nfs_fl;
822 struct nfs4_lock_info nfs4_fl; 824 struct nfs4_lock_info nfs4_fl;
825 struct {
826 struct list_head link; /* link in AFS vnode's pending_locks list */
827 int state; /* state of grant or error if -ve */
828 } afs;
823 } fl_u; 829 } fl_u;
824}; 830};
825 831
@@ -1273,119 +1279,6 @@ static inline void file_accessed(struct file *file)
1273 1279
1274int sync_inode(struct inode *inode, struct writeback_control *wbc); 1280int sync_inode(struct inode *inode, struct writeback_control *wbc);
1275 1281
1276/**
1277 * struct export_operations - for nfsd to communicate with file systems
1278 * @decode_fh: decode a file handle fragment and return a &struct dentry
1279 * @encode_fh: encode a file handle fragment from a dentry
1280 * @get_name: find the name for a given inode in a given directory
1281 * @get_parent: find the parent of a given directory
1282 * @get_dentry: find a dentry for the inode given a file handle sub-fragment
1283 * @find_exported_dentry:
1284 * set by the exporting module to a standard helper function.
1285 *
1286 * Description:
1287 * The export_operations structure provides a means for nfsd to communicate
1288 * with a particular exported file system - particularly enabling nfsd and
1289 * the filesystem to co-operate when dealing with file handles.
1290 *
1291 * export_operations contains two basic operation for dealing with file
1292 * handles, decode_fh() and encode_fh(), and allows for some other
1293 * operations to be defined which standard helper routines use to get
1294 * specific information from the filesystem.
1295 *
1296 * nfsd encodes information use to determine which filesystem a filehandle
1297 * applies to in the initial part of the file handle. The remainder, termed
1298 * a file handle fragment, is controlled completely by the filesystem. The
1299 * standard helper routines assume that this fragment will contain one or
1300 * two sub-fragments, one which identifies the file, and one which may be
1301 * used to identify the (a) directory containing the file.
1302 *
1303 * In some situations, nfsd needs to get a dentry which is connected into a
1304 * specific part of the file tree. To allow for this, it passes the
1305 * function acceptable() together with a @context which can be used to see
1306 * if the dentry is acceptable. As there can be multiple dentrys for a
1307 * given file, the filesystem should check each one for acceptability before
1308 * looking for the next. As soon as an acceptable one is found, it should
1309 * be returned.
1310 *
1311 * decode_fh:
1312 * @decode_fh is given a &struct super_block (@sb), a file handle fragment
1313 * (@fh, @fh_len) and an acceptability testing function (@acceptable,
1314 * @context). It should return a &struct dentry which refers to the same
1315 * file that the file handle fragment refers to, and which passes the
1316 * acceptability test. If it cannot, it should return a %NULL pointer if
1317 * the file was found but no acceptable &dentries were available, or a
1318 * %ERR_PTR error code indicating why it couldn't be found (e.g. %ENOENT or
1319 * %ENOMEM).
1320 *
1321 * encode_fh:
1322 * @encode_fh should store in the file handle fragment @fh (using at most
1323 * @max_len bytes) information that can be used by @decode_fh to recover the
1324 * file refered to by the &struct dentry @de. If the @connectable flag is
1325 * set, the encode_fh() should store sufficient information so that a good
1326 * attempt can be made to find not only the file but also it's place in the
1327 * filesystem. This typically means storing a reference to de->d_parent in
1328 * the filehandle fragment. encode_fh() should return the number of bytes
1329 * stored or a negative error code such as %-ENOSPC
1330 *
1331 * get_name:
1332 * @get_name should find a name for the given @child in the given @parent
1333 * directory. The name should be stored in the @name (with the
1334 * understanding that it is already pointing to a a %NAME_MAX+1 sized
1335 * buffer. get_name() should return %0 on success, a negative error code
1336 * or error. @get_name will be called without @parent->i_mutex held.
1337 *
1338 * get_parent:
1339 * @get_parent should find the parent directory for the given @child which
1340 * is also a directory. In the event that it cannot be found, or storage
1341 * space cannot be allocated, a %ERR_PTR should be returned.
1342 *
1343 * get_dentry:
1344 * Given a &super_block (@sb) and a pointer to a file-system specific inode
1345 * identifier, possibly an inode number, (@inump) get_dentry() should find
1346 * the identified inode and return a dentry for that inode. Any suitable
1347 * dentry can be returned including, if necessary, a new dentry created with
1348 * d_alloc_root. The caller can then find any other extant dentrys by
1349 * following the d_alias links. If a new dentry was created using
1350 * d_alloc_root, DCACHE_NFSD_DISCONNECTED should be set, and the dentry
1351 * should be d_rehash()ed.
1352 *
1353 * If the inode cannot be found, either a %NULL pointer or an %ERR_PTR code
1354 * can be returned. The @inump will be whatever was passed to
1355 * nfsd_find_fh_dentry() in either the @obj or @parent parameters.
1356 *
1357 * Locking rules:
1358 * get_parent is called with child->d_inode->i_mutex down
1359 * get_name is not (which is possibly inconsistent)
1360 */
1361
1362struct export_operations {
1363 struct dentry *(*decode_fh)(struct super_block *sb, __u32 *fh, int fh_len, int fh_type,
1364 int (*acceptable)(void *context, struct dentry *de),
1365 void *context);
1366 int (*encode_fh)(struct dentry *de, __u32 *fh, int *max_len,
1367 int connectable);
1368
1369 /* the following are only called from the filesystem itself */
1370 int (*get_name)(struct dentry *parent, char *name,
1371 struct dentry *child);
1372 struct dentry * (*get_parent)(struct dentry *child);
1373 struct dentry * (*get_dentry)(struct super_block *sb, void *inump);
1374
1375 /* This is set by the exporting module to a standard helper */
1376 struct dentry * (*find_exported_dentry)(
1377 struct super_block *sb, void *obj, void *parent,
1378 int (*acceptable)(void *context, struct dentry *de),
1379 void *context);
1380
1381
1382};
1383
1384extern struct dentry *
1385find_exported_dentry(struct super_block *sb, void *obj, void *parent,
1386 int (*acceptable)(void *context, struct dentry *de),
1387 void *context);
1388
1389struct file_system_type { 1282struct file_system_type {
1390 const char *name; 1283 const char *name;
1391 int fs_flags; 1284 int fs_flags;
@@ -1522,7 +1415,7 @@ extern void putname(const char *name);
1522 1415
1523#ifdef CONFIG_BLOCK 1416#ifdef CONFIG_BLOCK
1524extern int register_blkdev(unsigned int, const char *); 1417extern int register_blkdev(unsigned int, const char *);
1525extern int unregister_blkdev(unsigned int, const char *); 1418extern void unregister_blkdev(unsigned int, const char *);
1526extern struct block_device *bdget(dev_t); 1419extern struct block_device *bdget(dev_t);
1527extern void bd_set_size(struct block_device *, loff_t size); 1420extern void bd_set_size(struct block_device *, loff_t size);
1528extern void bd_forget(struct inode *inode); 1421extern void bd_forget(struct inode *inode);
@@ -1610,6 +1503,9 @@ extern int __invalidate_device(struct block_device *);
1610extern int invalidate_partition(struct gendisk *, int); 1503extern int invalidate_partition(struct gendisk *, int);
1611#endif 1504#endif
1612extern int invalidate_inodes(struct super_block *); 1505extern int invalidate_inodes(struct super_block *);
1506unsigned long __invalidate_mapping_pages(struct address_space *mapping,
1507 pgoff_t start, pgoff_t end,
1508 bool be_atomic);
1613unsigned long invalidate_mapping_pages(struct address_space *mapping, 1509unsigned long invalidate_mapping_pages(struct address_space *mapping,
1614 pgoff_t start, pgoff_t end); 1510 pgoff_t start, pgoff_t end);
1615 1511
@@ -2043,5 +1939,9 @@ static inline void free_secdata(void *secdata)
2043{ } 1939{ }
2044#endif /* CONFIG_SECURITY */ 1940#endif /* CONFIG_SECURITY */
2045 1941
1942int proc_nr_files(ctl_table *table, int write, struct file *filp,
1943 void __user *buffer, size_t *lenp, loff_t *ppos);
1944
1945
2046#endif /* __KERNEL__ */ 1946#endif /* __KERNEL__ */
2047#endif /* _LINUX_FS_H */ 1947#endif /* _LINUX_FS_H */