Linux 4.18.10
[linux/fpc-iii.git] / fs / afs / internal.h
blob9778df1357179d14238cfa52e7394886206a1f1d
1 /* internal AFS stuff
3 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
12 #include <linux/compiler.h>
13 #include <linux/kernel.h>
14 #include <linux/ktime.h>
15 #include <linux/fs.h>
16 #include <linux/pagemap.h>
17 #include <linux/rxrpc.h>
18 #include <linux/key.h>
19 #include <linux/workqueue.h>
20 #include <linux/sched.h>
21 #include <linux/fscache.h>
22 #include <linux/backing-dev.h>
23 #include <linux/uuid.h>
24 #include <net/net_namespace.h>
25 #include <net/netns/generic.h>
26 #include <net/sock.h>
27 #include <net/af_rxrpc.h>
29 #include "afs.h"
30 #include "afs_vl.h"
32 #define AFS_CELL_MAX_ADDRS 15
34 struct pagevec;
35 struct afs_call;
37 struct afs_mount_params {
38 bool rwpath; /* T if the parent should be considered R/W */
39 bool force; /* T to force cell type */
40 bool autocell; /* T if set auto mount operation */
41 bool dyn_root; /* T if dynamic root */
42 afs_voltype_t type; /* type of volume requested */
43 int volnamesz; /* size of volume name */
44 const char *volname; /* name of volume to mount */
45 struct net *net_ns; /* Network namespace in effect */
46 struct afs_net *net; /* the AFS net namespace stuff */
47 struct afs_cell *cell; /* cell in which to find volume */
48 struct afs_volume *volume; /* volume record */
49 struct key *key; /* key to use for secure mounting */
52 struct afs_iget_data {
53 struct afs_fid fid;
54 struct afs_volume *volume; /* volume on which resides */
57 enum afs_call_state {
58 AFS_CALL_CL_REQUESTING, /* Client: Request is being sent */
59 AFS_CALL_CL_AWAIT_REPLY, /* Client: Awaiting reply */
60 AFS_CALL_CL_PROC_REPLY, /* Client: rxrpc call complete; processing reply */
61 AFS_CALL_SV_AWAIT_OP_ID, /* Server: Awaiting op ID */
62 AFS_CALL_SV_AWAIT_REQUEST, /* Server: Awaiting request data */
63 AFS_CALL_SV_REPLYING, /* Server: Replying */
64 AFS_CALL_SV_AWAIT_ACK, /* Server: Awaiting final ACK */
65 AFS_CALL_COMPLETE, /* Completed or failed */
69 * List of server addresses.
71 struct afs_addr_list {
72 struct rcu_head rcu; /* Must be first */
73 refcount_t usage;
74 u32 version; /* Version */
75 unsigned short nr_addrs;
76 unsigned short index; /* Address currently in use */
77 unsigned short nr_ipv4; /* Number of IPv4 addresses */
78 unsigned long probed; /* Mask of servers that have been probed */
79 unsigned long yfs; /* Mask of servers that are YFS */
80 struct sockaddr_rxrpc addrs[];
84 * a record of an in-progress RxRPC call
86 struct afs_call {
87 const struct afs_call_type *type; /* type of call */
88 wait_queue_head_t waitq; /* processes awaiting completion */
89 struct work_struct async_work; /* async I/O processor */
90 struct work_struct work; /* actual work processor */
91 struct rxrpc_call *rxcall; /* RxRPC call handle */
92 struct key *key; /* security for this call */
93 struct afs_net *net; /* The network namespace */
94 struct afs_server *cm_server; /* Server affected by incoming CM call */
95 struct afs_cb_interest *cbi; /* Callback interest for server used */
96 void *request; /* request data (first part) */
97 struct address_space *mapping; /* Pages being written from */
98 void *buffer; /* reply receive buffer */
99 void *reply[4]; /* Where to put the reply */
100 pgoff_t first; /* first page in mapping to deal with */
101 pgoff_t last; /* last page in mapping to deal with */
102 size_t offset; /* offset into received data store */
103 atomic_t usage;
104 enum afs_call_state state;
105 spinlock_t state_lock;
106 int error; /* error code */
107 u32 abort_code; /* Remote abort ID or 0 */
108 unsigned request_size; /* size of request data */
109 unsigned reply_max; /* maximum size of reply */
110 unsigned first_offset; /* offset into mapping[first] */
111 unsigned int cb_break; /* cb_break + cb_s_break before the call */
112 union {
113 unsigned last_to; /* amount of mapping[last] */
114 unsigned count2; /* count used in unmarshalling */
116 unsigned char unmarshall; /* unmarshalling phase */
117 bool incoming; /* T if incoming call */
118 bool send_pages; /* T if data from mapping should be sent */
119 bool need_attention; /* T if RxRPC poked us */
120 bool async; /* T if asynchronous */
121 bool ret_reply0; /* T if should return reply[0] on success */
122 bool upgrade; /* T to request service upgrade */
123 u16 service_id; /* Actual service ID (after upgrade) */
124 unsigned int debug_id; /* Trace ID */
125 u32 operation_ID; /* operation ID for an incoming call */
126 u32 count; /* count for use in unmarshalling */
127 __be32 tmp; /* place to extract temporary data */
128 afs_dataversion_t expected_version; /* Updated version expected from store */
129 afs_dataversion_t expected_version_2; /* 2nd updated version expected from store */
132 struct afs_call_type {
133 const char *name;
134 unsigned int op; /* Really enum afs_fs_operation */
136 /* deliver request or reply data to an call
137 * - returning an error will cause the call to be aborted
139 int (*deliver)(struct afs_call *call);
141 /* clean up a call */
142 void (*destructor)(struct afs_call *call);
144 /* Work function */
145 void (*work)(struct work_struct *work);
149 * Key available for writeback on a file.
151 struct afs_wb_key {
152 refcount_t usage;
153 struct key *key;
154 struct list_head vnode_link; /* Link in vnode->wb_keys */
158 * AFS open file information record. Pointed to by file->private_data.
160 struct afs_file {
161 struct key *key; /* The key this file was opened with */
162 struct afs_wb_key *wb; /* Writeback key record for this file */
165 static inline struct key *afs_file_key(struct file *file)
167 struct afs_file *af = file->private_data;
169 return af->key;
173 * Record of an outstanding read operation on a vnode.
175 struct afs_read {
176 loff_t pos; /* Where to start reading */
177 loff_t len; /* How much we're asking for */
178 loff_t actual_len; /* How much we're actually getting */
179 loff_t remain; /* Amount remaining */
180 loff_t file_size; /* File size returned by server */
181 afs_dataversion_t data_version; /* Version number returned by server */
182 refcount_t usage;
183 unsigned int index; /* Which page we're reading into */
184 unsigned int nr_pages;
185 void (*page_done)(struct afs_call *, struct afs_read *);
186 struct page **pages;
187 struct page *array[];
191 * AFS superblock private data
192 * - there's one superblock per volume
194 struct afs_super_info {
195 struct net *net_ns; /* Network namespace */
196 struct afs_cell *cell; /* The cell in which the volume resides */
197 struct afs_volume *volume; /* volume record */
198 bool dyn_root; /* True if dynamic root */
201 static inline struct afs_super_info *AFS_FS_S(struct super_block *sb)
203 return sb->s_fs_info;
206 extern struct file_system_type afs_fs_type;
209 * Set of substitutes for @sys.
211 struct afs_sysnames {
212 #define AFS_NR_SYSNAME 16
213 char *subs[AFS_NR_SYSNAME];
214 refcount_t usage;
215 unsigned short nr;
216 char blank[1];
220 * AFS network namespace record.
222 struct afs_net {
223 struct net *net; /* Backpointer to the owning net namespace */
224 struct afs_uuid uuid;
225 bool live; /* F if this namespace is being removed */
227 /* AF_RXRPC I/O stuff */
228 struct socket *socket;
229 struct afs_call *spare_incoming_call;
230 struct work_struct charge_preallocation_work;
231 struct mutex socket_mutex;
232 atomic_t nr_outstanding_calls;
233 atomic_t nr_superblocks;
235 /* Cell database */
236 struct rb_root cells;
237 struct afs_cell __rcu *ws_cell;
238 struct work_struct cells_manager;
239 struct timer_list cells_timer;
240 atomic_t cells_outstanding;
241 seqlock_t cells_lock;
243 struct mutex proc_cells_lock;
244 struct list_head proc_cells;
246 /* Known servers. Theoretically each fileserver can only be in one
247 * cell, but in practice, people create aliases and subsets and there's
248 * no easy way to distinguish them.
250 seqlock_t fs_lock; /* For fs_servers */
251 struct rb_root fs_servers; /* afs_server (by server UUID or address) */
252 struct list_head fs_updates; /* afs_server (by update_at) */
253 struct hlist_head fs_proc; /* procfs servers list */
255 struct hlist_head fs_addresses4; /* afs_server (by lowest IPv4 addr) */
256 struct hlist_head fs_addresses6; /* afs_server (by lowest IPv6 addr) */
257 seqlock_t fs_addr_lock; /* For fs_addresses[46] */
259 struct work_struct fs_manager;
260 struct timer_list fs_timer;
261 atomic_t servers_outstanding;
263 /* File locking renewal management */
264 struct mutex lock_manager_mutex;
266 /* Misc */
267 struct super_block *dynroot_sb; /* Dynamic root mount superblock */
268 struct proc_dir_entry *proc_afs; /* /proc/net/afs directory */
269 struct afs_sysnames *sysnames;
270 rwlock_t sysnames_lock;
272 /* Statistics counters */
273 atomic_t n_lookup; /* Number of lookups done */
274 atomic_t n_reval; /* Number of dentries needing revalidation */
275 atomic_t n_inval; /* Number of invalidations by the server */
276 atomic_t n_relpg; /* Number of invalidations by releasepage */
277 atomic_t n_read_dir; /* Number of directory pages read */
278 atomic_t n_dir_cr; /* Number of directory entry creation edits */
279 atomic_t n_dir_rm; /* Number of directory entry removal edits */
280 atomic_t n_stores; /* Number of store ops */
281 atomic_long_t n_store_bytes; /* Number of bytes stored */
282 atomic_long_t n_fetch_bytes; /* Number of bytes fetched */
283 atomic_t n_fetches; /* Number of data fetch ops */
286 extern const char afs_init_sysname[];
288 enum afs_cell_state {
289 AFS_CELL_UNSET,
290 AFS_CELL_ACTIVATING,
291 AFS_CELL_ACTIVE,
292 AFS_CELL_DEACTIVATING,
293 AFS_CELL_INACTIVE,
294 AFS_CELL_FAILED,
298 * AFS cell record.
300 * This is a tricky concept to get right as it is possible to create aliases
301 * simply by pointing AFSDB/SRV records for two names at the same set of VL
302 * servers; it is also possible to do things like setting up two sets of VL
303 * servers, one of which provides a superset of the volumes provided by the
304 * other (for internal/external division, for example).
306 * Cells only exist in the sense that (a) a cell's name maps to a set of VL
307 * servers and (b) a cell's name is used by the client to select the key to use
308 * for authentication and encryption. The cell name is not typically used in
309 * the protocol.
311 * There is no easy way to determine if two cells are aliases or one is a
312 * subset of another.
314 struct afs_cell {
315 union {
316 struct rcu_head rcu;
317 struct rb_node net_node; /* Node in net->cells */
319 struct afs_net *net;
320 struct key *anonymous_key; /* anonymous user key for this cell */
321 struct work_struct manager; /* Manager for init/deinit/dns */
322 struct list_head proc_link; /* /proc cell list link */
323 #ifdef CONFIG_AFS_FSCACHE
324 struct fscache_cookie *cache; /* caching cookie */
325 #endif
326 time64_t dns_expiry; /* Time AFSDB/SRV record expires */
327 time64_t last_inactive; /* Time of last drop of usage count */
328 atomic_t usage;
329 unsigned long flags;
330 #define AFS_CELL_FL_NOT_READY 0 /* The cell record is not ready for use */
331 #define AFS_CELL_FL_NO_GC 1 /* The cell was added manually, don't auto-gc */
332 #define AFS_CELL_FL_NOT_FOUND 2 /* Permanent DNS error */
333 #define AFS_CELL_FL_DNS_FAIL 3 /* Failed to access DNS */
334 #define AFS_CELL_FL_NO_LOOKUP_YET 4 /* Not completed first DNS lookup yet */
335 enum afs_cell_state state;
336 short error;
338 /* Active fileserver interaction state. */
339 struct list_head proc_volumes; /* procfs volume list */
340 rwlock_t proc_lock;
342 /* VL server list. */
343 rwlock_t vl_addrs_lock; /* Lock on vl_addrs */
344 struct afs_addr_list __rcu *vl_addrs; /* List of VL servers */
345 u8 name_len; /* Length of name */
346 char name[64 + 1]; /* Cell name, case-flattened and NUL-padded */
350 * Cached VLDB entry.
352 * This is pointed to by cell->vldb_entries, indexed by name.
354 struct afs_vldb_entry {
355 afs_volid_t vid[3]; /* Volume IDs for R/W, R/O and Bak volumes */
357 unsigned long flags;
358 #define AFS_VLDB_HAS_RW 0 /* - R/W volume exists */
359 #define AFS_VLDB_HAS_RO 1 /* - R/O volume exists */
360 #define AFS_VLDB_HAS_BAK 2 /* - Backup volume exists */
361 #define AFS_VLDB_QUERY_VALID 3 /* - Record is valid */
362 #define AFS_VLDB_QUERY_ERROR 4 /* - VL server returned error */
364 uuid_t fs_server[AFS_NMAXNSERVERS];
365 u8 fs_mask[AFS_NMAXNSERVERS];
366 #define AFS_VOL_VTM_RW 0x01 /* R/W version of the volume is available (on this server) */
367 #define AFS_VOL_VTM_RO 0x02 /* R/O version of the volume is available (on this server) */
368 #define AFS_VOL_VTM_BAK 0x04 /* backup version of the volume is available (on this server) */
369 short error;
370 u8 nr_servers; /* Number of server records */
371 u8 name_len;
372 u8 name[AFS_MAXVOLNAME + 1]; /* NUL-padded volume name */
376 * Record of fileserver with which we're actively communicating.
378 struct afs_server {
379 struct rcu_head rcu;
380 union {
381 uuid_t uuid; /* Server ID */
382 struct afs_uuid _uuid;
385 struct afs_addr_list __rcu *addresses;
386 struct rb_node uuid_rb; /* Link in net->servers */
387 struct hlist_node addr4_link; /* Link in net->fs_addresses4 */
388 struct hlist_node addr6_link; /* Link in net->fs_addresses6 */
389 struct hlist_node proc_link; /* Link in net->fs_proc */
390 struct afs_server *gc_next; /* Next server in manager's list */
391 time64_t put_time; /* Time at which last put */
392 time64_t update_at; /* Time at which to next update the record */
393 unsigned long flags;
394 #define AFS_SERVER_FL_NEW 0 /* New server, don't inc cb_s_break */
395 #define AFS_SERVER_FL_NOT_READY 1 /* The record is not ready for use */
396 #define AFS_SERVER_FL_NOT_FOUND 2 /* VL server says no such server */
397 #define AFS_SERVER_FL_VL_FAIL 3 /* Failed to access VL server */
398 #define AFS_SERVER_FL_UPDATING 4
399 #define AFS_SERVER_FL_PROBED 5 /* The fileserver has been probed */
400 #define AFS_SERVER_FL_PROBING 6 /* Fileserver is being probed */
401 #define AFS_SERVER_FL_NO_IBULK 7 /* Fileserver doesn't support FS.InlineBulkStatus */
402 #define AFS_SERVER_FL_MAY_HAVE_CB 8 /* May have callbacks on this fileserver */
403 atomic_t usage;
404 u32 addr_version; /* Address list version */
406 /* file service access */
407 rwlock_t fs_lock; /* access lock */
409 /* callback promise management */
410 struct hlist_head cb_volumes; /* List of volume interests on this server */
411 unsigned cb_s_break; /* Break-everything counter. */
412 rwlock_t cb_break_lock; /* Volume finding lock */
416 * Volume collation in the server's callback interest list.
418 struct afs_vol_interest {
419 struct hlist_node srv_link; /* Link in server->cb_volumes */
420 struct hlist_head cb_interests; /* List of callback interests on the server */
421 afs_volid_t vid; /* Volume ID to match */
422 unsigned int usage;
426 * Interest by a superblock on a server.
428 struct afs_cb_interest {
429 struct hlist_node cb_vlink; /* Link in vol_interest->cb_interests */
430 struct afs_vol_interest *vol_interest;
431 struct afs_server *server; /* Server on which this interest resides */
432 struct super_block *sb; /* Superblock on which inodes reside */
433 afs_volid_t vid; /* Volume ID to match */
434 refcount_t usage;
438 * Replaceable server list.
440 struct afs_server_entry {
441 struct afs_server *server;
442 struct afs_cb_interest *cb_interest;
445 struct afs_server_list {
446 refcount_t usage;
447 unsigned short nr_servers;
448 unsigned short index; /* Server currently in use */
449 unsigned short vnovol_mask; /* Servers to be skipped due to VNOVOL */
450 unsigned int seq; /* Set to ->servers_seq when installed */
451 rwlock_t lock;
452 struct afs_server_entry servers[];
456 * Live AFS volume management.
458 struct afs_volume {
459 afs_volid_t vid; /* volume ID */
460 atomic_t usage;
461 time64_t update_at; /* Time at which to next update */
462 struct afs_cell *cell; /* Cell to which belongs (pins ref) */
463 struct list_head proc_link; /* Link in cell->vl_proc */
464 unsigned long flags;
465 #define AFS_VOLUME_NEEDS_UPDATE 0 /* - T if an update needs performing */
466 #define AFS_VOLUME_UPDATING 1 /* - T if an update is in progress */
467 #define AFS_VOLUME_WAIT 2 /* - T if users must wait for update */
468 #define AFS_VOLUME_DELETED 3 /* - T if volume appears deleted */
469 #define AFS_VOLUME_OFFLINE 4 /* - T if volume offline notice given */
470 #define AFS_VOLUME_BUSY 5 /* - T if volume busy notice given */
471 #ifdef CONFIG_AFS_FSCACHE
472 struct fscache_cookie *cache; /* caching cookie */
473 #endif
474 struct afs_server_list *servers; /* List of servers on which volume resides */
475 rwlock_t servers_lock; /* Lock for ->servers */
476 unsigned int servers_seq; /* Incremented each time ->servers changes */
478 unsigned cb_v_break; /* Break-everything counter. */
479 rwlock_t cb_break_lock;
481 afs_voltype_t type; /* type of volume */
482 short error;
483 char type_force; /* force volume type (suppress R/O -> R/W) */
484 u8 name_len;
485 u8 name[AFS_MAXVOLNAME + 1]; /* NUL-padded volume name */
488 enum afs_lock_state {
489 AFS_VNODE_LOCK_NONE, /* The vnode has no lock on the server */
490 AFS_VNODE_LOCK_WAITING_FOR_CB, /* We're waiting for the server to break the callback */
491 AFS_VNODE_LOCK_SETTING, /* We're asking the server for a lock */
492 AFS_VNODE_LOCK_GRANTED, /* We have a lock on the server */
493 AFS_VNODE_LOCK_EXTENDING, /* We're extending a lock on the server */
494 AFS_VNODE_LOCK_NEED_UNLOCK, /* We need to unlock on the server */
495 AFS_VNODE_LOCK_UNLOCKING, /* We're telling the server to unlock */
499 * AFS inode private data.
501 * Note that afs_alloc_inode() *must* reset anything that could incorrectly
502 * leak from one inode to another.
504 struct afs_vnode {
505 struct inode vfs_inode; /* the VFS's inode record */
507 struct afs_volume *volume; /* volume on which vnode resides */
508 struct afs_fid fid; /* the file identifier for this inode */
509 struct afs_file_status status; /* AFS status info for this file */
510 afs_dataversion_t invalid_before; /* Child dentries are invalid before this */
511 #ifdef CONFIG_AFS_FSCACHE
512 struct fscache_cookie *cache; /* caching cookie */
513 #endif
514 struct afs_permits __rcu *permit_cache; /* cache of permits so far obtained */
515 struct mutex io_lock; /* Lock for serialising I/O on this mutex */
516 struct rw_semaphore validate_lock; /* lock for validating this vnode */
517 spinlock_t wb_lock; /* lock for wb_keys */
518 spinlock_t lock; /* waitqueue/flags lock */
519 unsigned long flags;
520 #define AFS_VNODE_CB_PROMISED 0 /* Set if vnode has a callback promise */
521 #define AFS_VNODE_UNSET 1 /* set if vnode attributes not yet set */
522 #define AFS_VNODE_DIR_VALID 2 /* Set if dir contents are valid */
523 #define AFS_VNODE_ZAP_DATA 3 /* set if vnode's data should be invalidated */
524 #define AFS_VNODE_DELETED 4 /* set if vnode deleted on server */
525 #define AFS_VNODE_MOUNTPOINT 5 /* set if vnode is a mountpoint symlink */
526 #define AFS_VNODE_AUTOCELL 6 /* set if Vnode is an auto mount point */
527 #define AFS_VNODE_PSEUDODIR 7 /* set if Vnode is a pseudo directory */
528 #define AFS_VNODE_NEW_CONTENT 8 /* Set if file has new content (create/trunc-0) */
530 struct list_head wb_keys; /* List of keys available for writeback */
531 struct list_head pending_locks; /* locks waiting to be granted */
532 struct list_head granted_locks; /* locks granted on this file */
533 struct delayed_work lock_work; /* work to be done in locking */
534 struct key *lock_key; /* Key to be used in lock ops */
535 enum afs_lock_state lock_state : 8;
536 afs_lock_type_t lock_type : 8;
538 /* outstanding callback notification on this file */
539 struct afs_cb_interest *cb_interest; /* Server on which this resides */
540 unsigned int cb_s_break; /* Mass break counter on ->server */
541 unsigned int cb_v_break; /* Mass break counter on ->volume */
542 unsigned int cb_break; /* Break counter on vnode */
543 seqlock_t cb_lock; /* Lock for ->cb_interest, ->status, ->cb_*break */
545 time64_t cb_expires_at; /* time at which callback expires */
546 unsigned cb_version; /* callback version */
547 afs_callback_type_t cb_type; /* type of callback */
551 * cached security record for one user's attempt to access a vnode
553 struct afs_permit {
554 struct key *key; /* RxRPC ticket holding a security context */
555 afs_access_t access; /* CallerAccess value for this key */
559 * Immutable cache of CallerAccess records from attempts to access vnodes.
560 * These may be shared between multiple vnodes.
562 struct afs_permits {
563 struct rcu_head rcu;
564 struct hlist_node hash_node; /* Link in hash */
565 unsigned long h; /* Hash value for this permit list */
566 refcount_t usage;
567 unsigned short nr_permits; /* Number of records */
568 bool invalidated; /* Invalidated due to key change */
569 struct afs_permit permits[]; /* List of permits sorted by key pointer */
573 * record of one of a system's set of network interfaces
575 struct afs_interface {
576 struct in_addr address; /* IPv4 address bound to interface */
577 struct in_addr netmask; /* netmask applied to address */
578 unsigned mtu; /* MTU of interface */
582 * Cursor for iterating over a server's address list.
584 struct afs_addr_cursor {
585 struct afs_addr_list *alist; /* Current address list (pins ref) */
586 struct sockaddr_rxrpc *addr;
587 u32 abort_code;
588 unsigned short start; /* Starting point in alist->addrs[] */
589 unsigned short index; /* Wrapping offset from start to current addr */
590 short error;
591 bool begun; /* T if we've begun iteration */
592 bool responded; /* T if the current address responded */
596 * Cursor for iterating over a set of fileservers.
598 struct afs_fs_cursor {
599 struct afs_addr_cursor ac;
600 struct afs_vnode *vnode;
601 struct afs_server_list *server_list; /* Current server list (pins ref) */
602 struct afs_cb_interest *cbi; /* Server on which this resides (pins ref) */
603 struct key *key; /* Key for the server */
604 unsigned int cb_break; /* cb_break + cb_s_break before the call */
605 unsigned int cb_break_2; /* cb_break + cb_s_break (2nd vnode) */
606 unsigned char start; /* Initial index in server list */
607 unsigned char index; /* Number of servers tried beyond start */
608 unsigned short flags;
609 #define AFS_FS_CURSOR_STOP 0x0001 /* Set to cease iteration */
610 #define AFS_FS_CURSOR_VBUSY 0x0002 /* Set if seen VBUSY */
611 #define AFS_FS_CURSOR_VMOVED 0x0004 /* Set if seen VMOVED */
612 #define AFS_FS_CURSOR_VNOVOL 0x0008 /* Set if seen VNOVOL */
613 #define AFS_FS_CURSOR_CUR_ONLY 0x0010 /* Set if current server only (file lock held) */
614 #define AFS_FS_CURSOR_NO_VSLEEP 0x0020 /* Set to prevent sleep on VBUSY, VOFFLINE, ... */
618 * Cache auxiliary data.
620 struct afs_vnode_cache_aux {
621 u64 data_version;
622 } __packed;
624 #include <trace/events/afs.h>
626 /*****************************************************************************/
628 * addr_list.c
630 static inline struct afs_addr_list *afs_get_addrlist(struct afs_addr_list *alist)
632 if (alist)
633 refcount_inc(&alist->usage);
634 return alist;
636 extern struct afs_addr_list *afs_alloc_addrlist(unsigned int,
637 unsigned short,
638 unsigned short);
639 extern void afs_put_addrlist(struct afs_addr_list *);
640 extern struct afs_addr_list *afs_parse_text_addrs(const char *, size_t, char,
641 unsigned short, unsigned short);
642 extern struct afs_addr_list *afs_dns_query(struct afs_cell *, time64_t *);
643 extern bool afs_iterate_addresses(struct afs_addr_cursor *);
644 extern int afs_end_cursor(struct afs_addr_cursor *);
645 extern int afs_set_vl_cursor(struct afs_addr_cursor *, struct afs_cell *);
647 extern void afs_merge_fs_addr4(struct afs_addr_list *, __be32, u16);
648 extern void afs_merge_fs_addr6(struct afs_addr_list *, __be32 *, u16);
651 * cache.c
653 #ifdef CONFIG_AFS_FSCACHE
654 extern struct fscache_netfs afs_cache_netfs;
655 extern struct fscache_cookie_def afs_cell_cache_index_def;
656 extern struct fscache_cookie_def afs_volume_cache_index_def;
657 extern struct fscache_cookie_def afs_vnode_cache_index_def;
658 #else
659 #define afs_cell_cache_index_def (*(struct fscache_cookie_def *) NULL)
660 #define afs_volume_cache_index_def (*(struct fscache_cookie_def *) NULL)
661 #define afs_vnode_cache_index_def (*(struct fscache_cookie_def *) NULL)
662 #endif
665 * callback.c
667 extern void afs_init_callback_state(struct afs_server *);
668 extern void afs_break_callback(struct afs_vnode *);
669 extern void afs_break_callbacks(struct afs_server *, size_t, struct afs_callback_break*);
671 extern int afs_register_server_cb_interest(struct afs_vnode *,
672 struct afs_server_list *, unsigned int);
673 extern void afs_put_cb_interest(struct afs_net *, struct afs_cb_interest *);
674 extern void afs_clear_callback_interests(struct afs_net *, struct afs_server_list *);
676 static inline struct afs_cb_interest *afs_get_cb_interest(struct afs_cb_interest *cbi)
678 if (cbi)
679 refcount_inc(&cbi->usage);
680 return cbi;
683 static inline unsigned int afs_calc_vnode_cb_break(struct afs_vnode *vnode)
685 return vnode->cb_break + vnode->cb_s_break + vnode->cb_v_break;
688 static inline unsigned int afs_cb_break_sum(struct afs_vnode *vnode,
689 struct afs_cb_interest *cbi)
691 return vnode->cb_break + cbi->server->cb_s_break + vnode->volume->cb_v_break;
695 * cell.c
697 extern int afs_cell_init(struct afs_net *, const char *);
698 extern struct afs_cell *afs_lookup_cell_rcu(struct afs_net *, const char *, unsigned);
699 extern struct afs_cell *afs_lookup_cell(struct afs_net *, const char *, unsigned,
700 const char *, bool);
701 extern struct afs_cell *afs_get_cell(struct afs_cell *);
702 extern void afs_put_cell(struct afs_net *, struct afs_cell *);
703 extern void afs_manage_cells(struct work_struct *);
704 extern void afs_cells_timer(struct timer_list *);
705 extern void __net_exit afs_cell_purge(struct afs_net *);
708 * cmservice.c
710 extern bool afs_cm_incoming_call(struct afs_call *);
713 * dir.c
715 extern const struct file_operations afs_dir_file_operations;
716 extern const struct inode_operations afs_dir_inode_operations;
717 extern const struct address_space_operations afs_dir_aops;
718 extern const struct dentry_operations afs_fs_dentry_operations;
720 extern void afs_d_release(struct dentry *);
723 * dir_edit.c
725 extern void afs_edit_dir_add(struct afs_vnode *, struct qstr *, struct afs_fid *,
726 enum afs_edit_dir_reason);
727 extern void afs_edit_dir_remove(struct afs_vnode *, struct qstr *, enum afs_edit_dir_reason);
730 * dynroot.c
732 extern const struct file_operations afs_dynroot_file_operations;
733 extern const struct inode_operations afs_dynroot_inode_operations;
734 extern const struct dentry_operations afs_dynroot_dentry_operations;
736 extern struct inode *afs_try_auto_mntpt(struct dentry *, struct inode *);
737 extern int afs_dynroot_mkdir(struct afs_net *, struct afs_cell *);
738 extern void afs_dynroot_rmdir(struct afs_net *, struct afs_cell *);
739 extern int afs_dynroot_populate(struct super_block *);
740 extern void afs_dynroot_depopulate(struct super_block *);
743 * file.c
745 extern const struct address_space_operations afs_fs_aops;
746 extern const struct inode_operations afs_file_inode_operations;
747 extern const struct file_operations afs_file_operations;
749 extern int afs_cache_wb_key(struct afs_vnode *, struct afs_file *);
750 extern void afs_put_wb_key(struct afs_wb_key *);
751 extern int afs_open(struct inode *, struct file *);
752 extern int afs_release(struct inode *, struct file *);
753 extern int afs_fetch_data(struct afs_vnode *, struct key *, struct afs_read *);
754 extern int afs_page_filler(void *, struct page *);
755 extern void afs_put_read(struct afs_read *);
758 * flock.c
760 extern struct workqueue_struct *afs_lock_manager;
762 extern void afs_lock_work(struct work_struct *);
763 extern void afs_lock_may_be_available(struct afs_vnode *);
764 extern int afs_lock(struct file *, int, struct file_lock *);
765 extern int afs_flock(struct file *, int, struct file_lock *);
768 * fsclient.c
770 #define AFS_VNODE_NOT_YET_SET 0x01
771 #define AFS_VNODE_META_CHANGED 0x02
772 #define AFS_VNODE_DATA_CHANGED 0x04
773 extern void afs_update_inode_from_status(struct afs_vnode *, struct afs_file_status *,
774 const afs_dataversion_t *, u8);
776 extern int afs_fs_fetch_file_status(struct afs_fs_cursor *, struct afs_volsync *, bool);
777 extern int afs_fs_give_up_callbacks(struct afs_net *, struct afs_server *);
778 extern int afs_fs_fetch_data(struct afs_fs_cursor *, struct afs_read *);
779 extern int afs_fs_create(struct afs_fs_cursor *, const char *, umode_t, u64,
780 struct afs_fid *, struct afs_file_status *, struct afs_callback *);
781 extern int afs_fs_remove(struct afs_fs_cursor *, const char *, bool, u64);
782 extern int afs_fs_link(struct afs_fs_cursor *, struct afs_vnode *, const char *, u64);
783 extern int afs_fs_symlink(struct afs_fs_cursor *, const char *, const char *, u64,
784 struct afs_fid *, struct afs_file_status *);
785 extern int afs_fs_rename(struct afs_fs_cursor *, const char *,
786 struct afs_vnode *, const char *, u64, u64);
787 extern int afs_fs_store_data(struct afs_fs_cursor *, struct address_space *,
788 pgoff_t, pgoff_t, unsigned, unsigned);
789 extern int afs_fs_setattr(struct afs_fs_cursor *, struct iattr *);
790 extern int afs_fs_get_volume_status(struct afs_fs_cursor *, struct afs_volume_status *);
791 extern int afs_fs_set_lock(struct afs_fs_cursor *, afs_lock_type_t);
792 extern int afs_fs_extend_lock(struct afs_fs_cursor *);
793 extern int afs_fs_release_lock(struct afs_fs_cursor *);
794 extern int afs_fs_give_up_all_callbacks(struct afs_net *, struct afs_server *,
795 struct afs_addr_cursor *, struct key *);
796 extern int afs_fs_get_capabilities(struct afs_net *, struct afs_server *,
797 struct afs_addr_cursor *, struct key *);
798 extern int afs_fs_inline_bulk_status(struct afs_fs_cursor *, struct afs_net *,
799 struct afs_fid *, struct afs_file_status *,
800 struct afs_callback *, unsigned int,
801 struct afs_volsync *);
802 extern int afs_fs_fetch_status(struct afs_fs_cursor *, struct afs_net *,
803 struct afs_fid *, struct afs_file_status *,
804 struct afs_callback *, struct afs_volsync *);
807 * inode.c
809 extern int afs_fetch_status(struct afs_vnode *, struct key *, bool);
810 extern int afs_iget5_test(struct inode *, void *);
811 extern struct inode *afs_iget_pseudo_dir(struct super_block *, bool);
812 extern struct inode *afs_iget(struct super_block *, struct key *,
813 struct afs_fid *, struct afs_file_status *,
814 struct afs_callback *,
815 struct afs_cb_interest *);
816 extern void afs_zap_data(struct afs_vnode *);
817 extern int afs_validate(struct afs_vnode *, struct key *);
818 extern int afs_getattr(const struct path *, struct kstat *, u32, unsigned int);
819 extern int afs_setattr(struct dentry *, struct iattr *);
820 extern void afs_evict_inode(struct inode *);
821 extern int afs_drop_inode(struct inode *);
824 * main.c
826 extern struct workqueue_struct *afs_wq;
827 extern int afs_net_id;
829 static inline struct afs_net *afs_net(struct net *net)
831 return net_generic(net, afs_net_id);
834 static inline struct afs_net *afs_sb2net(struct super_block *sb)
836 return afs_net(AFS_FS_S(sb)->net_ns);
839 static inline struct afs_net *afs_d2net(struct dentry *dentry)
841 return afs_sb2net(dentry->d_sb);
844 static inline struct afs_net *afs_i2net(struct inode *inode)
846 return afs_sb2net(inode->i_sb);
849 static inline struct afs_net *afs_v2net(struct afs_vnode *vnode)
851 return afs_i2net(&vnode->vfs_inode);
854 static inline struct afs_net *afs_sock2net(struct sock *sk)
856 return net_generic(sock_net(sk), afs_net_id);
859 static inline void __afs_stat(atomic_t *s)
861 atomic_inc(s);
864 #define afs_stat_v(vnode, n) __afs_stat(&afs_v2net(vnode)->n)
867 * misc.c
869 extern int afs_abort_to_error(u32);
872 * mntpt.c
874 extern const struct inode_operations afs_mntpt_inode_operations;
875 extern const struct inode_operations afs_autocell_inode_operations;
876 extern const struct file_operations afs_mntpt_file_operations;
878 extern struct vfsmount *afs_d_automount(struct path *);
879 extern void afs_mntpt_kill_timer(void);
882 * netdevices.c
884 extern int afs_get_ipv4_interfaces(struct afs_net *, struct afs_interface *,
885 size_t, bool);
888 * proc.c
890 #ifdef CONFIG_PROC_FS
891 extern int __net_init afs_proc_init(struct afs_net *);
892 extern void __net_exit afs_proc_cleanup(struct afs_net *);
893 extern int afs_proc_cell_setup(struct afs_cell *);
894 extern void afs_proc_cell_remove(struct afs_cell *);
895 extern void afs_put_sysnames(struct afs_sysnames *);
896 #else
897 static inline int afs_proc_init(struct afs_net *net) { return 0; }
898 static inline void afs_proc_cleanup(struct afs_net *net) {}
899 static inline int afs_proc_cell_setup(struct afs_cell *cell) { return 0; }
900 static inline void afs_proc_cell_remove(struct afs_cell *cell) {}
901 static inline void afs_put_sysnames(struct afs_sysnames *sysnames) {}
902 #endif
905 * rotate.c
907 extern bool afs_begin_vnode_operation(struct afs_fs_cursor *, struct afs_vnode *,
908 struct key *);
909 extern bool afs_select_fileserver(struct afs_fs_cursor *);
910 extern bool afs_select_current_fileserver(struct afs_fs_cursor *);
911 extern int afs_end_vnode_operation(struct afs_fs_cursor *);
914 * rxrpc.c
916 extern struct workqueue_struct *afs_async_calls;
918 extern int __net_init afs_open_socket(struct afs_net *);
919 extern void __net_exit afs_close_socket(struct afs_net *);
920 extern void afs_charge_preallocation(struct work_struct *);
921 extern void afs_put_call(struct afs_call *);
922 extern int afs_queue_call_work(struct afs_call *);
923 extern long afs_make_call(struct afs_addr_cursor *, struct afs_call *, gfp_t, bool);
924 extern struct afs_call *afs_alloc_flat_call(struct afs_net *,
925 const struct afs_call_type *,
926 size_t, size_t);
927 extern void afs_flat_call_destructor(struct afs_call *);
928 extern void afs_send_empty_reply(struct afs_call *);
929 extern void afs_send_simple_reply(struct afs_call *, const void *, size_t);
930 extern int afs_extract_data(struct afs_call *, void *, size_t, bool);
931 extern int afs_protocol_error(struct afs_call *, int);
933 static inline int afs_transfer_reply(struct afs_call *call)
935 return afs_extract_data(call, call->buffer, call->reply_max, false);
938 static inline bool afs_check_call_state(struct afs_call *call,
939 enum afs_call_state state)
941 return READ_ONCE(call->state) == state;
944 static inline bool afs_set_call_state(struct afs_call *call,
945 enum afs_call_state from,
946 enum afs_call_state to)
948 bool ok = false;
950 spin_lock_bh(&call->state_lock);
951 if (call->state == from) {
952 call->state = to;
953 trace_afs_call_state(call, from, to, 0, 0);
954 ok = true;
956 spin_unlock_bh(&call->state_lock);
957 return ok;
960 static inline void afs_set_call_complete(struct afs_call *call,
961 int error, u32 remote_abort)
963 enum afs_call_state state;
964 bool ok = false;
966 spin_lock_bh(&call->state_lock);
967 state = call->state;
968 if (state != AFS_CALL_COMPLETE) {
969 call->abort_code = remote_abort;
970 call->error = error;
971 call->state = AFS_CALL_COMPLETE;
972 trace_afs_call_state(call, state, AFS_CALL_COMPLETE,
973 error, remote_abort);
974 ok = true;
976 spin_unlock_bh(&call->state_lock);
977 if (ok)
978 trace_afs_call_done(call);
982 * security.c
984 extern void afs_put_permits(struct afs_permits *);
985 extern void afs_clear_permits(struct afs_vnode *);
986 extern void afs_cache_permit(struct afs_vnode *, struct key *, unsigned int);
987 extern void afs_zap_permits(struct rcu_head *);
988 extern struct key *afs_request_key(struct afs_cell *);
989 extern int afs_check_permit(struct afs_vnode *, struct key *, afs_access_t *);
990 extern int afs_permission(struct inode *, int);
991 extern void __exit afs_clean_up_permit_cache(void);
994 * server.c
996 extern spinlock_t afs_server_peer_lock;
998 static inline struct afs_server *afs_get_server(struct afs_server *server)
1000 atomic_inc(&server->usage);
1001 return server;
1004 extern struct afs_server *afs_find_server(struct afs_net *,
1005 const struct sockaddr_rxrpc *);
1006 extern struct afs_server *afs_find_server_by_uuid(struct afs_net *, const uuid_t *);
1007 extern struct afs_server *afs_lookup_server(struct afs_cell *, struct key *, const uuid_t *);
1008 extern void afs_put_server(struct afs_net *, struct afs_server *);
1009 extern void afs_manage_servers(struct work_struct *);
1010 extern void afs_servers_timer(struct timer_list *);
1011 extern void __net_exit afs_purge_servers(struct afs_net *);
1012 extern bool afs_probe_fileserver(struct afs_fs_cursor *);
1013 extern bool afs_check_server_record(struct afs_fs_cursor *, struct afs_server *);
1016 * server_list.c
1018 static inline struct afs_server_list *afs_get_serverlist(struct afs_server_list *slist)
1020 refcount_inc(&slist->usage);
1021 return slist;
1024 extern void afs_put_serverlist(struct afs_net *, struct afs_server_list *);
1025 extern struct afs_server_list *afs_alloc_server_list(struct afs_cell *, struct key *,
1026 struct afs_vldb_entry *,
1027 u8);
1028 extern bool afs_annotate_server_list(struct afs_server_list *, struct afs_server_list *);
1031 * super.c
1033 extern int __init afs_fs_init(void);
1034 extern void afs_fs_exit(void);
1037 * vlclient.c
1039 extern struct afs_vldb_entry *afs_vl_get_entry_by_name_u(struct afs_net *,
1040 struct afs_addr_cursor *,
1041 struct key *, const char *, int);
1042 extern struct afs_addr_list *afs_vl_get_addrs_u(struct afs_net *, struct afs_addr_cursor *,
1043 struct key *, const uuid_t *);
1044 extern int afs_vl_get_capabilities(struct afs_net *, struct afs_addr_cursor *, struct key *);
1045 extern struct afs_addr_list *afs_yfsvl_get_endpoints(struct afs_net *, struct afs_addr_cursor *,
1046 struct key *, const uuid_t *);
1049 * volume.c
1051 static inline struct afs_volume *__afs_get_volume(struct afs_volume *volume)
1053 if (volume)
1054 atomic_inc(&volume->usage);
1055 return volume;
1058 extern struct afs_volume *afs_create_volume(struct afs_mount_params *);
1059 extern void afs_activate_volume(struct afs_volume *);
1060 extern void afs_deactivate_volume(struct afs_volume *);
1061 extern void afs_put_volume(struct afs_cell *, struct afs_volume *);
1062 extern int afs_check_volume_status(struct afs_volume *, struct key *);
1065 * write.c
1067 extern int afs_set_page_dirty(struct page *);
1068 extern int afs_write_begin(struct file *file, struct address_space *mapping,
1069 loff_t pos, unsigned len, unsigned flags,
1070 struct page **pagep, void **fsdata);
1071 extern int afs_write_end(struct file *file, struct address_space *mapping,
1072 loff_t pos, unsigned len, unsigned copied,
1073 struct page *page, void *fsdata);
1074 extern int afs_writepage(struct page *, struct writeback_control *);
1075 extern int afs_writepages(struct address_space *, struct writeback_control *);
1076 extern void afs_pages_written_back(struct afs_vnode *, struct afs_call *);
1077 extern ssize_t afs_file_write(struct kiocb *, struct iov_iter *);
1078 extern int afs_fsync(struct file *, loff_t, loff_t, int);
1079 extern int afs_page_mkwrite(struct vm_fault *);
1080 extern void afs_prune_wb_keys(struct afs_vnode *);
1081 extern int afs_launder_page(struct page *);
1084 * xattr.c
1086 extern const struct xattr_handler *afs_xattr_handlers[];
1087 extern ssize_t afs_listxattr(struct dentry *, char *, size_t);
1091 * Miscellaneous inline functions.
1093 static inline struct afs_vnode *AFS_FS_I(struct inode *inode)
1095 return container_of(inode, struct afs_vnode, vfs_inode);
1098 static inline struct inode *AFS_VNODE_TO_I(struct afs_vnode *vnode)
1100 return &vnode->vfs_inode;
1103 static inline void afs_vnode_commit_status(struct afs_fs_cursor *fc,
1104 struct afs_vnode *vnode,
1105 unsigned int cb_break)
1107 if (fc->ac.error == 0)
1108 afs_cache_permit(vnode, fc->key, cb_break);
1111 static inline void afs_check_for_remote_deletion(struct afs_fs_cursor *fc,
1112 struct afs_vnode *vnode)
1114 if (fc->ac.error == -ENOENT) {
1115 set_bit(AFS_VNODE_DELETED, &vnode->flags);
1116 afs_break_callback(vnode);
1121 /*****************************************************************************/
1123 * debug tracing
1125 extern unsigned afs_debug;
1127 #define dbgprintk(FMT,...) \
1128 printk("[%-6.6s] "FMT"\n", current->comm ,##__VA_ARGS__)
1130 #define kenter(FMT,...) dbgprintk("==> %s("FMT")",__func__ ,##__VA_ARGS__)
1131 #define kleave(FMT,...) dbgprintk("<== %s()"FMT"",__func__ ,##__VA_ARGS__)
1132 #define kdebug(FMT,...) dbgprintk(" "FMT ,##__VA_ARGS__)
1135 #if defined(__KDEBUG)
1136 #define _enter(FMT,...) kenter(FMT,##__VA_ARGS__)
1137 #define _leave(FMT,...) kleave(FMT,##__VA_ARGS__)
1138 #define _debug(FMT,...) kdebug(FMT,##__VA_ARGS__)
1140 #elif defined(CONFIG_AFS_DEBUG)
1141 #define AFS_DEBUG_KENTER 0x01
1142 #define AFS_DEBUG_KLEAVE 0x02
1143 #define AFS_DEBUG_KDEBUG 0x04
1145 #define _enter(FMT,...) \
1146 do { \
1147 if (unlikely(afs_debug & AFS_DEBUG_KENTER)) \
1148 kenter(FMT,##__VA_ARGS__); \
1149 } while (0)
1151 #define _leave(FMT,...) \
1152 do { \
1153 if (unlikely(afs_debug & AFS_DEBUG_KLEAVE)) \
1154 kleave(FMT,##__VA_ARGS__); \
1155 } while (0)
1157 #define _debug(FMT,...) \
1158 do { \
1159 if (unlikely(afs_debug & AFS_DEBUG_KDEBUG)) \
1160 kdebug(FMT,##__VA_ARGS__); \
1161 } while (0)
1163 #else
1164 #define _enter(FMT,...) no_printk("==> %s("FMT")",__func__ ,##__VA_ARGS__)
1165 #define _leave(FMT,...) no_printk("<== %s()"FMT"",__func__ ,##__VA_ARGS__)
1166 #define _debug(FMT,...) no_printk(" "FMT ,##__VA_ARGS__)
1167 #endif
1170 * debug assertion checking
1172 #if 1 // defined(__KDEBUGALL)
1174 #define ASSERT(X) \
1175 do { \
1176 if (unlikely(!(X))) { \
1177 printk(KERN_ERR "\n"); \
1178 printk(KERN_ERR "AFS: Assertion failed\n"); \
1179 BUG(); \
1181 } while(0)
1183 #define ASSERTCMP(X, OP, Y) \
1184 do { \
1185 if (unlikely(!((X) OP (Y)))) { \
1186 printk(KERN_ERR "\n"); \
1187 printk(KERN_ERR "AFS: Assertion failed\n"); \
1188 printk(KERN_ERR "%lu " #OP " %lu is false\n", \
1189 (unsigned long)(X), (unsigned long)(Y)); \
1190 printk(KERN_ERR "0x%lx " #OP " 0x%lx is false\n", \
1191 (unsigned long)(X), (unsigned long)(Y)); \
1192 BUG(); \
1194 } while(0)
1196 #define ASSERTRANGE(L, OP1, N, OP2, H) \
1197 do { \
1198 if (unlikely(!((L) OP1 (N)) || !((N) OP2 (H)))) { \
1199 printk(KERN_ERR "\n"); \
1200 printk(KERN_ERR "AFS: Assertion failed\n"); \
1201 printk(KERN_ERR "%lu "#OP1" %lu "#OP2" %lu is false\n", \
1202 (unsigned long)(L), (unsigned long)(N), \
1203 (unsigned long)(H)); \
1204 printk(KERN_ERR "0x%lx "#OP1" 0x%lx "#OP2" 0x%lx is false\n", \
1205 (unsigned long)(L), (unsigned long)(N), \
1206 (unsigned long)(H)); \
1207 BUG(); \
1209 } while(0)
1211 #define ASSERTIF(C, X) \
1212 do { \
1213 if (unlikely((C) && !(X))) { \
1214 printk(KERN_ERR "\n"); \
1215 printk(KERN_ERR "AFS: Assertion failed\n"); \
1216 BUG(); \
1218 } while(0)
1220 #define ASSERTIFCMP(C, X, OP, Y) \
1221 do { \
1222 if (unlikely((C) && !((X) OP (Y)))) { \
1223 printk(KERN_ERR "\n"); \
1224 printk(KERN_ERR "AFS: Assertion failed\n"); \
1225 printk(KERN_ERR "%lu " #OP " %lu is false\n", \
1226 (unsigned long)(X), (unsigned long)(Y)); \
1227 printk(KERN_ERR "0x%lx " #OP " 0x%lx is false\n", \
1228 (unsigned long)(X), (unsigned long)(Y)); \
1229 BUG(); \
1231 } while(0)
1233 #else
1235 #define ASSERT(X) \
1236 do { \
1237 } while(0)
1239 #define ASSERTCMP(X, OP, Y) \
1240 do { \
1241 } while(0)
1243 #define ASSERTRANGE(L, OP1, N, OP2, H) \
1244 do { \
1245 } while(0)
1247 #define ASSERTIF(C, X) \
1248 do { \
1249 } while(0)
1251 #define ASSERTIFCMP(C, X, OP, Y) \
1252 do { \
1253 } while(0)
1255 #endif /* __KDEBUGALL */