Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v2.6.12-rc6 767 lines 23 kB view raw
1/* 2 * linux/include/linux/nfs_fs.h 3 * 4 * Copyright (C) 1992 Rick Sladkey 5 * 6 * OS-specific nfs filesystem definitions and declarations 7 */ 8 9#ifndef _LINUX_NFS_FS_H 10#define _LINUX_NFS_FS_H 11 12#include <linux/config.h> 13#include <linux/in.h> 14#include <linux/mm.h> 15#include <linux/pagemap.h> 16#include <linux/rwsem.h> 17#include <linux/wait.h> 18#include <linux/uio.h> 19 20#include <linux/nfs_fs_sb.h> 21 22#include <linux/sunrpc/debug.h> 23#include <linux/sunrpc/auth.h> 24#include <linux/sunrpc/clnt.h> 25 26#include <linux/nfs.h> 27#include <linux/nfs2.h> 28#include <linux/nfs3.h> 29#include <linux/nfs4.h> 30#include <linux/nfs_xdr.h> 31#include <linux/rwsem.h> 32#include <linux/workqueue.h> 33#include <linux/mempool.h> 34 35/* 36 * Enable debugging support for nfs client. 37 * Requires RPC_DEBUG. 38 */ 39#ifdef RPC_DEBUG 40# define NFS_DEBUG 41#endif 42 43#define NFS_MAX_FILE_IO_BUFFER_SIZE 32768 44#define NFS_DEF_FILE_IO_BUFFER_SIZE 4096 45 46/* 47 * The upper limit on timeouts for the exponential backoff algorithm. 48 */ 49#define NFS_WRITEBACK_DELAY (5*HZ) 50#define NFS_WRITEBACK_LOCKDELAY (60*HZ) 51#define NFS_COMMIT_DELAY (5*HZ) 52 53/* 54 * superblock magic number for NFS 55 */ 56#define NFS_SUPER_MAGIC 0x6969 57 58/* 59 * These are the default flags for swap requests 60 */ 61#define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS) 62 63#define NFS_RW_SYNC 0x0001 /* O_SYNC handling */ 64#define NFS_RW_SWAP 0x0002 /* This is a swap request */ 65 66/* 67 * When flushing a cluster of dirty pages, there can be different 68 * strategies: 69 */ 70#define FLUSH_AGING 0 /* only flush old buffers */ 71#define FLUSH_SYNC 1 /* file being synced, or contention */ 72#define FLUSH_WAIT 2 /* wait for completion */ 73#define FLUSH_STABLE 4 /* commit to stable storage */ 74#define FLUSH_LOWPRI 8 /* low priority background flush */ 75#define FLUSH_HIGHPRI 16 /* high priority memory reclaim flush */ 76 77#ifdef __KERNEL__ 78 79/* 80 * NFSv3/v4 Access mode cache entry 81 */ 82struct nfs_access_entry { 83 unsigned long jiffies; 84 struct rpc_cred * cred; 85 int mask; 86}; 87 88struct nfs4_state; 89struct nfs_open_context { 90 atomic_t count; 91 struct dentry *dentry; 92 struct rpc_cred *cred; 93 struct nfs4_state *state; 94 fl_owner_t lockowner; 95 int mode; 96 int error; 97 98 struct list_head list; 99 wait_queue_head_t waitq; 100}; 101 102/* 103 * NFSv4 delegation 104 */ 105struct nfs_delegation; 106 107/* 108 * nfs fs inode data in memory 109 */ 110struct nfs_inode { 111 /* 112 * The 64bit 'inode number' 113 */ 114 __u64 fileid; 115 116 /* 117 * NFS file handle 118 */ 119 struct nfs_fh fh; 120 121 /* 122 * Various flags 123 */ 124 unsigned int flags; 125 126 /* 127 * read_cache_jiffies is when we started read-caching this inode, 128 * and read_cache_mtime is the mtime of the inode at that time. 129 * attrtimeo is for how long the cached information is assumed 130 * to be valid. A successful attribute revalidation doubles 131 * attrtimeo (up to acregmax/acdirmax), a failure resets it to 132 * acregmin/acdirmin. 133 * 134 * We need to revalidate the cached attrs for this inode if 135 * 136 * jiffies - read_cache_jiffies > attrtimeo 137 * 138 * and invalidate any cached data/flush out any dirty pages if 139 * we find that 140 * 141 * mtime != read_cache_mtime 142 */ 143 unsigned long readdir_timestamp; 144 unsigned long read_cache_jiffies; 145 unsigned long attrtimeo; 146 unsigned long attrtimeo_timestamp; 147 __u64 change_attr; /* v4 only */ 148 149 /* "Generation counter" for the attribute cache. This is 150 * bumped whenever we update the metadata on the 151 * server. 152 */ 153 unsigned long cache_change_attribute; 154 /* 155 * Counter indicating the number of outstanding requests that 156 * will cause a file data update. 157 */ 158 atomic_t data_updates; 159 160 struct nfs_access_entry cache_access; 161 162 /* 163 * This is the cookie verifier used for NFSv3 readdir 164 * operations 165 */ 166 __u32 cookieverf[2]; 167 168 /* 169 * This is the list of dirty unwritten pages. 170 */ 171 spinlock_t req_lock; 172 struct list_head dirty; 173 struct list_head commit; 174 struct radix_tree_root nfs_page_tree; 175 176 unsigned int ndirty, 177 ncommit, 178 npages; 179 180 /* Open contexts for shared mmap writes */ 181 struct list_head open_files; 182 183 wait_queue_head_t nfs_i_wait; 184 185#ifdef CONFIG_NFS_V4 186 /* NFSv4 state */ 187 struct list_head open_states; 188 struct nfs_delegation *delegation; 189 int delegation_state; 190 struct rw_semaphore rwsem; 191#endif /* CONFIG_NFS_V4*/ 192 193 struct inode vfs_inode; 194}; 195 196/* 197 * Legal inode flag values 198 */ 199#define NFS_INO_STALE 0x0001 /* possible stale inode */ 200#define NFS_INO_ADVISE_RDPLUS 0x0002 /* advise readdirplus */ 201#define NFS_INO_REVALIDATING 0x0004 /* revalidating attrs */ 202#define NFS_INO_INVALID_ATTR 0x0008 /* cached attrs are invalid */ 203#define NFS_INO_INVALID_DATA 0x0010 /* cached data is invalid */ 204#define NFS_INO_INVALID_ATIME 0x0020 /* cached atime is invalid */ 205#define NFS_INO_INVALID_ACCESS 0x0040 /* cached access cred invalid */ 206 207static inline struct nfs_inode *NFS_I(struct inode *inode) 208{ 209 return container_of(inode, struct nfs_inode, vfs_inode); 210} 211#define NFS_SB(s) ((struct nfs_server *)(s->s_fs_info)) 212 213#define NFS_FH(inode) (&NFS_I(inode)->fh) 214#define NFS_SERVER(inode) (NFS_SB(inode->i_sb)) 215#define NFS_CLIENT(inode) (NFS_SERVER(inode)->client) 216#define NFS_PROTO(inode) (NFS_SERVER(inode)->rpc_ops) 217#define NFS_ADDR(inode) (RPC_PEERADDR(NFS_CLIENT(inode))) 218#define NFS_COOKIEVERF(inode) (NFS_I(inode)->cookieverf) 219#define NFS_READTIME(inode) (NFS_I(inode)->read_cache_jiffies) 220#define NFS_CHANGE_ATTR(inode) (NFS_I(inode)->change_attr) 221#define NFS_ATTRTIMEO(inode) (NFS_I(inode)->attrtimeo) 222#define NFS_MINATTRTIMEO(inode) \ 223 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmin \ 224 : NFS_SERVER(inode)->acregmin) 225#define NFS_MAXATTRTIMEO(inode) \ 226 (S_ISDIR(inode->i_mode)? NFS_SERVER(inode)->acdirmax \ 227 : NFS_SERVER(inode)->acregmax) 228#define NFS_ATTRTIMEO_UPDATE(inode) (NFS_I(inode)->attrtimeo_timestamp) 229 230#define NFS_FLAGS(inode) (NFS_I(inode)->flags) 231#define NFS_REVALIDATING(inode) (NFS_FLAGS(inode) & NFS_INO_REVALIDATING) 232#define NFS_STALE(inode) (NFS_FLAGS(inode) & NFS_INO_STALE) 233 234#define NFS_FILEID(inode) (NFS_I(inode)->fileid) 235 236static inline int nfs_caches_unstable(struct inode *inode) 237{ 238 return atomic_read(&NFS_I(inode)->data_updates) != 0; 239} 240 241static inline void NFS_CACHEINV(struct inode *inode) 242{ 243 if (!nfs_caches_unstable(inode)) 244 NFS_FLAGS(inode) |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS; 245} 246 247static inline int nfs_server_capable(struct inode *inode, int cap) 248{ 249 return NFS_SERVER(inode)->caps & cap; 250} 251 252static inline int NFS_USE_READDIRPLUS(struct inode *inode) 253{ 254 return NFS_FLAGS(inode) & NFS_INO_ADVISE_RDPLUS; 255} 256 257/** 258 * nfs_save_change_attribute - Returns the inode attribute change cookie 259 * @inode - pointer to inode 260 * The "change attribute" is updated every time we finish an operation 261 * that will result in a metadata change on the server. 262 */ 263static inline long nfs_save_change_attribute(struct inode *inode) 264{ 265 return NFS_I(inode)->cache_change_attribute; 266} 267 268/** 269 * nfs_verify_change_attribute - Detects NFS inode cache updates 270 * @inode - pointer to inode 271 * @chattr - previously saved change attribute 272 * Return "false" if metadata has been updated (or is in the process of 273 * being updated) since the change attribute was saved. 274 */ 275static inline int nfs_verify_change_attribute(struct inode *inode, unsigned long chattr) 276{ 277 return !nfs_caches_unstable(inode) 278 && chattr == NFS_I(inode)->cache_change_attribute; 279} 280 281/* 282 * linux/fs/nfs/inode.c 283 */ 284extern void nfs_zap_caches(struct inode *); 285extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, 286 struct nfs_fattr *); 287extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); 288extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 289extern int nfs_permission(struct inode *, int, struct nameidata *); 290extern int nfs_access_get_cached(struct inode *, struct rpc_cred *, struct nfs_access_entry *); 291extern void nfs_access_add_cache(struct inode *, struct nfs_access_entry *); 292extern int nfs_open(struct inode *, struct file *); 293extern int nfs_release(struct inode *, struct file *); 294extern int nfs_attribute_timeout(struct inode *inode); 295extern int nfs_revalidate_inode(struct nfs_server *server, struct inode *inode); 296extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *); 297extern int nfs_setattr(struct dentry *, struct iattr *); 298extern void nfs_begin_attr_update(struct inode *); 299extern void nfs_end_attr_update(struct inode *); 300extern void nfs_begin_data_update(struct inode *); 301extern void nfs_end_data_update(struct inode *); 302extern void nfs_end_data_update_defer(struct inode *); 303extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, struct rpc_cred *cred); 304extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 305extern void put_nfs_open_context(struct nfs_open_context *ctx); 306extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx); 307extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, int mode); 308extern void nfs_file_clear_open_context(struct file *filp); 309 310/* linux/net/ipv4/ipconfig.c: trims ip addr off front of name, too. */ 311extern u32 root_nfs_parse_addr(char *name); /*__init*/ 312 313/* 314 * linux/fs/nfs/file.c 315 */ 316extern struct inode_operations nfs_file_inode_operations; 317extern struct file_operations nfs_file_operations; 318extern struct address_space_operations nfs_file_aops; 319 320static inline struct rpc_cred *nfs_file_cred(struct file *file) 321{ 322 if (file != NULL) { 323 struct nfs_open_context *ctx; 324 325 ctx = (struct nfs_open_context*)file->private_data; 326 return ctx->cred; 327 } 328 return NULL; 329} 330 331/* 332 * linux/fs/nfs/direct.c 333 */ 334extern ssize_t nfs_direct_IO(int, struct kiocb *, const struct iovec *, loff_t, 335 unsigned long); 336extern ssize_t nfs_file_direct_read(struct kiocb *iocb, char __user *buf, 337 size_t count, loff_t pos); 338extern ssize_t nfs_file_direct_write(struct kiocb *iocb, const char __user *buf, 339 size_t count, loff_t pos); 340 341/* 342 * linux/fs/nfs/dir.c 343 */ 344extern struct inode_operations nfs_dir_inode_operations; 345extern struct file_operations nfs_dir_operations; 346extern struct dentry_operations nfs_dentry_operations; 347 348extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); 349 350/* 351 * linux/fs/nfs/symlink.c 352 */ 353extern struct inode_operations nfs_symlink_inode_operations; 354 355/* 356 * linux/fs/nfs/unlink.c 357 */ 358extern int nfs_async_unlink(struct dentry *); 359extern void nfs_complete_unlink(struct dentry *); 360 361/* 362 * linux/fs/nfs/write.c 363 */ 364extern int nfs_writepage(struct page *page, struct writeback_control *wbc); 365extern int nfs_writepages(struct address_space *, struct writeback_control *); 366extern int nfs_flush_incompatible(struct file *file, struct page *page); 367extern int nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int); 368extern void nfs_writeback_done(struct rpc_task *task); 369 370#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 371extern void nfs_commit_done(struct rpc_task *); 372#endif 373 374/* 375 * Try to write back everything synchronously (but check the 376 * return value!) 377 */ 378extern int nfs_sync_inode(struct inode *, unsigned long, unsigned int, int); 379#if defined(CONFIG_NFS_V3) || defined(CONFIG_NFS_V4) 380extern int nfs_commit_inode(struct inode *, unsigned long, unsigned int, int); 381#else 382static inline int 383nfs_commit_inode(struct inode *inode, unsigned long idx_start, unsigned int npages, int how) 384{ 385 return 0; 386} 387#endif 388 389static inline int 390nfs_have_writebacks(struct inode *inode) 391{ 392 return NFS_I(inode)->npages != 0; 393} 394 395static inline int 396nfs_wb_all(struct inode *inode) 397{ 398 int error = nfs_sync_inode(inode, 0, 0, FLUSH_WAIT); 399 return (error < 0) ? error : 0; 400} 401 402/* 403 * Write back all requests on one page - we do this before reading it. 404 */ 405static inline int nfs_wb_page_priority(struct inode *inode, struct page* page, int how) 406{ 407 int error = nfs_sync_inode(inode, page->index, 1, 408 how | FLUSH_WAIT | FLUSH_STABLE); 409 return (error < 0) ? error : 0; 410} 411 412static inline int nfs_wb_page(struct inode *inode, struct page* page) 413{ 414 return nfs_wb_page_priority(inode, page, 0); 415} 416 417/* 418 * Allocate and free nfs_write_data structures 419 */ 420extern mempool_t *nfs_wdata_mempool; 421 422static inline struct nfs_write_data *nfs_writedata_alloc(void) 423{ 424 struct nfs_write_data *p = mempool_alloc(nfs_wdata_mempool, SLAB_NOFS); 425 if (p) { 426 memset(p, 0, sizeof(*p)); 427 INIT_LIST_HEAD(&p->pages); 428 } 429 return p; 430} 431 432static inline void nfs_writedata_free(struct nfs_write_data *p) 433{ 434 mempool_free(p, nfs_wdata_mempool); 435} 436 437/* Hack for future NFS swap support */ 438#ifndef IS_SWAPFILE 439# define IS_SWAPFILE(inode) (0) 440#endif 441 442/* 443 * linux/fs/nfs/read.c 444 */ 445extern int nfs_readpage(struct file *, struct page *); 446extern int nfs_readpages(struct file *, struct address_space *, 447 struct list_head *, unsigned); 448extern void nfs_readpage_result(struct rpc_task *); 449 450/* 451 * Allocate and free nfs_read_data structures 452 */ 453extern mempool_t *nfs_rdata_mempool; 454 455static inline struct nfs_read_data *nfs_readdata_alloc(void) 456{ 457 struct nfs_read_data *p = mempool_alloc(nfs_rdata_mempool, SLAB_NOFS); 458 if (p) 459 memset(p, 0, sizeof(*p)); 460 return p; 461} 462 463static inline void nfs_readdata_free(struct nfs_read_data *p) 464{ 465 mempool_free(p, nfs_rdata_mempool); 466} 467 468extern void nfs_readdata_release(struct rpc_task *task); 469 470/* 471 * linux/fs/mount_clnt.c 472 * (Used only by nfsroot module) 473 */ 474extern int nfsroot_mount(struct sockaddr_in *, char *, struct nfs_fh *, 475 int, int); 476 477/* 478 * inline functions 479 */ 480 481static inline loff_t 482nfs_size_to_loff_t(__u64 size) 483{ 484 loff_t maxsz = (((loff_t) ULONG_MAX) << PAGE_CACHE_SHIFT) + PAGE_CACHE_SIZE - 1; 485 if (size > maxsz) 486 return maxsz; 487 return (loff_t) size; 488} 489 490static inline ino_t 491nfs_fileid_to_ino_t(u64 fileid) 492{ 493 ino_t ino = (ino_t) fileid; 494 if (sizeof(ino_t) < sizeof(u64)) 495 ino ^= fileid >> (sizeof(u64)-sizeof(ino_t)) * 8; 496 return ino; 497} 498 499/* NFS root */ 500 501extern void * nfs_root_data(void); 502 503#define nfs_wait_event(clnt, wq, condition) \ 504({ \ 505 int __retval = 0; \ 506 if (clnt->cl_intr) { \ 507 sigset_t oldmask; \ 508 rpc_clnt_sigmask(clnt, &oldmask); \ 509 __retval = wait_event_interruptible(wq, condition); \ 510 rpc_clnt_sigunmask(clnt, &oldmask); \ 511 } else \ 512 wait_event(wq, condition); \ 513 __retval; \ 514}) 515 516#define NFS_JUKEBOX_RETRY_TIME (5 * HZ) 517 518#ifdef CONFIG_NFS_V4 519 520struct idmap; 521 522/* 523 * In a seqid-mutating op, this macro controls which error return 524 * values trigger incrementation of the seqid. 525 * 526 * from rfc 3010: 527 * The client MUST monotonically increment the sequence number for the 528 * CLOSE, LOCK, LOCKU, OPEN, OPEN_CONFIRM, and OPEN_DOWNGRADE 529 * operations. This is true even in the event that the previous 530 * operation that used the sequence number received an error. The only 531 * exception to this rule is if the previous operation received one of 532 * the following errors: NFSERR_STALE_CLIENTID, NFSERR_STALE_STATEID, 533 * NFSERR_BAD_STATEID, NFSERR_BAD_SEQID, NFSERR_BADXDR, 534 * NFSERR_RESOURCE, NFSERR_NOFILEHANDLE. 535 * 536 */ 537#define seqid_mutating_err(err) \ 538(((err) != NFSERR_STALE_CLIENTID) && \ 539 ((err) != NFSERR_STALE_STATEID) && \ 540 ((err) != NFSERR_BAD_STATEID) && \ 541 ((err) != NFSERR_BAD_SEQID) && \ 542 ((err) != NFSERR_BAD_XDR) && \ 543 ((err) != NFSERR_RESOURCE) && \ 544 ((err) != NFSERR_NOFILEHANDLE)) 545 546enum nfs4_client_state { 547 NFS4CLNT_OK = 0, 548}; 549 550/* 551 * The nfs4_client identifies our client state to the server. 552 */ 553struct nfs4_client { 554 struct list_head cl_servers; /* Global list of servers */ 555 struct in_addr cl_addr; /* Server identifier */ 556 u64 cl_clientid; /* constant */ 557 nfs4_verifier cl_confirm; 558 unsigned long cl_state; 559 560 u32 cl_lockowner_id; 561 562 /* 563 * The following rwsem ensures exclusive access to the server 564 * while we recover the state following a lease expiration. 565 */ 566 struct rw_semaphore cl_sem; 567 568 struct list_head cl_delegations; 569 struct list_head cl_state_owners; 570 struct list_head cl_unused; 571 int cl_nunused; 572 spinlock_t cl_lock; 573 atomic_t cl_count; 574 575 struct rpc_clnt * cl_rpcclient; 576 struct rpc_cred * cl_cred; 577 578 struct list_head cl_superblocks; /* List of nfs_server structs */ 579 580 unsigned long cl_lease_time; 581 unsigned long cl_last_renewal; 582 struct work_struct cl_renewd; 583 struct work_struct cl_recoverd; 584 585 wait_queue_head_t cl_waitq; 586 struct rpc_wait_queue cl_rpcwaitq; 587 588 /* used for the setclientid verifier */ 589 struct timespec cl_boot_time; 590 591 /* idmapper */ 592 struct idmap * cl_idmap; 593 594 /* Our own IP address, as a null-terminated string. 595 * This is used to generate the clientid, and the callback address. 596 */ 597 char cl_ipaddr[16]; 598 unsigned char cl_id_uniquifier; 599}; 600 601/* 602 * NFS4 state_owners and lock_owners are simply labels for ordered 603 * sequences of RPC calls. Their sole purpose is to provide once-only 604 * semantics by allowing the server to identify replayed requests. 605 * 606 * The ->so_sema is held during all state_owner seqid-mutating operations: 607 * OPEN, OPEN_DOWNGRADE, and CLOSE. Its purpose is to properly serialize 608 * so_seqid. 609 */ 610struct nfs4_state_owner { 611 struct list_head so_list; /* per-clientid list of state_owners */ 612 struct nfs4_client *so_client; 613 u32 so_id; /* 32-bit identifier, unique */ 614 struct semaphore so_sema; 615 u32 so_seqid; /* protected by so_sema */ 616 atomic_t so_count; 617 618 struct rpc_cred *so_cred; /* Associated cred */ 619 struct list_head so_states; 620 struct list_head so_delegations; 621}; 622 623/* 624 * struct nfs4_state maintains the client-side state for a given 625 * (state_owner,inode) tuple (OPEN) or state_owner (LOCK). 626 * 627 * OPEN: 628 * In order to know when to OPEN_DOWNGRADE or CLOSE the state on the server, 629 * we need to know how many files are open for reading or writing on a 630 * given inode. This information too is stored here. 631 * 632 * LOCK: one nfs4_state (LOCK) to hold the lock stateid nfs4_state(OPEN) 633 */ 634 635struct nfs4_lock_state { 636 struct list_head ls_locks; /* Other lock stateids */ 637 fl_owner_t ls_owner; /* POSIX lock owner */ 638#define NFS_LOCK_INITIALIZED 1 639 int ls_flags; 640 u32 ls_seqid; 641 u32 ls_id; 642 nfs4_stateid ls_stateid; 643 atomic_t ls_count; 644}; 645 646/* bits for nfs4_state->flags */ 647enum { 648 LK_STATE_IN_USE, 649 NFS_DELEGATED_STATE, 650}; 651 652struct nfs4_state { 653 struct list_head open_states; /* List of states for the same state_owner */ 654 struct list_head inode_states; /* List of states for the same inode */ 655 struct list_head lock_states; /* List of subservient lock stateids */ 656 657 struct nfs4_state_owner *owner; /* Pointer to the open owner */ 658 struct inode *inode; /* Pointer to the inode */ 659 660 unsigned long flags; /* Do we hold any locks? */ 661 struct semaphore lock_sema; /* Serializes file locking operations */ 662 rwlock_t state_lock; /* Protects the lock_states list */ 663 664 nfs4_stateid stateid; 665 666 unsigned int nreaders; 667 unsigned int nwriters; 668 int state; /* State on the server (R,W, or RW) */ 669 atomic_t count; 670}; 671 672 673struct nfs4_exception { 674 long timeout; 675 int retry; 676}; 677 678struct nfs4_state_recovery_ops { 679 int (*recover_open)(struct nfs4_state_owner *, struct nfs4_state *); 680 int (*recover_lock)(struct nfs4_state *, struct file_lock *); 681}; 682 683extern struct dentry_operations nfs4_dentry_operations; 684extern struct inode_operations nfs4_dir_inode_operations; 685 686/* nfs4proc.c */ 687extern int nfs4_map_errors(int err); 688extern int nfs4_proc_setclientid(struct nfs4_client *, u32, unsigned short); 689extern int nfs4_proc_setclientid_confirm(struct nfs4_client *); 690extern int nfs4_proc_async_renew(struct nfs4_client *); 691extern int nfs4_proc_renew(struct nfs4_client *); 692extern int nfs4_do_close(struct inode *inode, struct nfs4_state *state, mode_t mode); 693extern struct inode *nfs4_atomic_open(struct inode *, struct dentry *, struct nameidata *); 694extern int nfs4_open_revalidate(struct inode *, struct dentry *, int); 695 696extern struct nfs4_state_recovery_ops nfs4_reboot_recovery_ops; 697extern struct nfs4_state_recovery_ops nfs4_network_partition_recovery_ops; 698 699/* nfs4renewd.c */ 700extern void nfs4_schedule_state_renewal(struct nfs4_client *); 701extern void nfs4_renewd_prepare_shutdown(struct nfs_server *); 702extern void nfs4_kill_renewd(struct nfs4_client *); 703 704/* nfs4state.c */ 705extern void init_nfsv4_state(struct nfs_server *); 706extern void destroy_nfsv4_state(struct nfs_server *); 707extern struct nfs4_client *nfs4_get_client(struct in_addr *); 708extern void nfs4_put_client(struct nfs4_client *clp); 709extern int nfs4_init_client(struct nfs4_client *clp); 710extern struct nfs4_client *nfs4_find_client(struct in_addr *); 711extern u32 nfs4_alloc_lockowner_id(struct nfs4_client *); 712 713extern struct nfs4_state_owner * nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *); 714extern void nfs4_put_state_owner(struct nfs4_state_owner *); 715extern void nfs4_drop_state_owner(struct nfs4_state_owner *); 716extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *); 717extern void nfs4_put_open_state(struct nfs4_state *); 718extern void nfs4_close_state(struct nfs4_state *, mode_t); 719extern struct nfs4_state *nfs4_find_state(struct inode *, struct rpc_cred *, mode_t mode); 720extern void nfs4_increment_seqid(int status, struct nfs4_state_owner *sp); 721extern void nfs4_schedule_state_recovery(struct nfs4_client *); 722extern struct nfs4_lock_state *nfs4_find_lock_state(struct nfs4_state *state, fl_owner_t); 723extern struct nfs4_lock_state *nfs4_get_lock_state(struct nfs4_state *state, fl_owner_t); 724extern void nfs4_put_lock_state(struct nfs4_lock_state *state); 725extern void nfs4_increment_lock_seqid(int status, struct nfs4_lock_state *ls); 726extern void nfs4_notify_setlk(struct nfs4_state *, struct file_lock *, struct nfs4_lock_state *); 727extern void nfs4_notify_unlck(struct nfs4_state *, struct file_lock *, struct nfs4_lock_state *); 728extern void nfs4_copy_stateid(nfs4_stateid *, struct nfs4_state *, fl_owner_t); 729 730 731 732struct nfs4_mount_data; 733#else 734#define init_nfsv4_state(server) do { } while (0) 735#define destroy_nfsv4_state(server) do { } while (0) 736#define nfs4_put_state_owner(inode, owner) do { } while (0) 737#define nfs4_put_open_state(state) do { } while (0) 738#define nfs4_close_state(a, b) do { } while (0) 739#define nfs4_renewd_prepare_shutdown(server) do { } while (0) 740#endif 741 742#endif /* __KERNEL__ */ 743 744/* 745 * NFS debug flags 746 */ 747#define NFSDBG_VFS 0x0001 748#define NFSDBG_DIRCACHE 0x0002 749#define NFSDBG_LOOKUPCACHE 0x0004 750#define NFSDBG_PAGECACHE 0x0008 751#define NFSDBG_PROC 0x0010 752#define NFSDBG_XDR 0x0020 753#define NFSDBG_FILE 0x0040 754#define NFSDBG_ROOT 0x0080 755#define NFSDBG_CALLBACK 0x0100 756#define NFSDBG_ALL 0xFFFF 757 758#ifdef __KERNEL__ 759# undef ifdebug 760# ifdef NFS_DEBUG 761# define ifdebug(fac) if (unlikely(nfs_debug & NFSDBG_##fac)) 762# else 763# define ifdebug(fac) if (0) 764# endif 765#endif /* __KERNEL */ 766 767#endif