internal.h (d81645510ce2a140816c4cb37c45b78d810ca63f) internal.h (b134d687dd9369bb2407a23c6ecc9e0a15d8bb20)
1/* internal AFS stuff
2 *
3 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
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

--- 22 unchanged lines hidden (view full) ---

31#include "afs.h"
32#include "afs_vl.h"
33
34#define AFS_CELL_MAX_ADDRS 15
35
36struct pagevec;
37struct afs_call;
38
1/* internal AFS stuff
2 *
3 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
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

--- 22 unchanged lines hidden (view full) ---

31#include "afs.h"
32#include "afs_vl.h"
33
34#define AFS_CELL_MAX_ADDRS 15
35
36struct pagevec;
37struct afs_call;
38
39/*
40 * Partial file-locking emulation mode. (The problem being that AFS3 only
41 * allows whole-file locks and no upgrading/downgrading).
42 */
43enum afs_flock_mode {
44 afs_flock_mode_unset,
45 afs_flock_mode_local, /* Local locking only */
46 afs_flock_mode_openafs, /* Don't get server lock for a partial lock */
47 afs_flock_mode_strict, /* Always get a server lock for a partial lock */
48 afs_flock_mode_write, /* Get an exclusive server lock for a partial lock */
49};
50
39struct afs_fs_context {
40 bool force; /* T to force cell type */
41 bool autocell; /* T if set auto mount operation */
42 bool dyn_root; /* T if dynamic root */
43 bool no_cell; /* T if the source is "none" (for dynroot) */
51struct afs_fs_context {
52 bool force; /* T to force cell type */
53 bool autocell; /* T if set auto mount operation */
54 bool dyn_root; /* T if dynamic root */
55 bool no_cell; /* T if the source is "none" (for dynroot) */
56 enum afs_flock_mode flock_mode; /* Partial file-locking emulation mode */
44 afs_voltype_t type; /* type of volume requested */
45 unsigned int volnamesz; /* size of volume name */
46 const char *volname; /* name of volume to mount */
47 struct afs_net *net; /* the AFS net namespace stuff */
48 struct afs_cell *cell; /* cell in which to find volume */
49 struct afs_volume *volume; /* volume record */
50 struct key *key; /* key to use for secure mounting */
51};

--- 164 unchanged lines hidden (view full) ---

216/*
217 * AFS superblock private data
218 * - there's one superblock per volume
219 */
220struct afs_super_info {
221 struct net *net_ns; /* Network namespace */
222 struct afs_cell *cell; /* The cell in which the volume resides */
223 struct afs_volume *volume; /* volume record */
57 afs_voltype_t type; /* type of volume requested */
58 unsigned int volnamesz; /* size of volume name */
59 const char *volname; /* name of volume to mount */
60 struct afs_net *net; /* the AFS net namespace stuff */
61 struct afs_cell *cell; /* cell in which to find volume */
62 struct afs_volume *volume; /* volume record */
63 struct key *key; /* key to use for secure mounting */
64};

--- 164 unchanged lines hidden (view full) ---

229/*
230 * AFS superblock private data
231 * - there's one superblock per volume
232 */
233struct afs_super_info {
234 struct net *net_ns; /* Network namespace */
235 struct afs_cell *cell; /* The cell in which the volume resides */
236 struct afs_volume *volume; /* volume record */
237 enum afs_flock_mode flock_mode:8; /* File locking emulation mode */
224 bool dyn_root; /* True if dynamic root */
225};
226
227static inline struct afs_super_info *AFS_FS_S(struct super_block *sb)
228{
229 return sb->s_fs_info;
230}
231

--- 362 unchanged lines hidden (view full) ---

594enum afs_lock_state {
595 AFS_VNODE_LOCK_NONE, /* The vnode has no lock on the server */
596 AFS_VNODE_LOCK_WAITING_FOR_CB, /* We're waiting for the server to break the callback */
597 AFS_VNODE_LOCK_SETTING, /* We're asking the server for a lock */
598 AFS_VNODE_LOCK_GRANTED, /* We have a lock on the server */
599 AFS_VNODE_LOCK_EXTENDING, /* We're extending a lock on the server */
600 AFS_VNODE_LOCK_NEED_UNLOCK, /* We need to unlock on the server */
601 AFS_VNODE_LOCK_UNLOCKING, /* We're telling the server to unlock */
238 bool dyn_root; /* True if dynamic root */
239};
240
241static inline struct afs_super_info *AFS_FS_S(struct super_block *sb)
242{
243 return sb->s_fs_info;
244}
245

--- 362 unchanged lines hidden (view full) ---

608enum afs_lock_state {
609 AFS_VNODE_LOCK_NONE, /* The vnode has no lock on the server */
610 AFS_VNODE_LOCK_WAITING_FOR_CB, /* We're waiting for the server to break the callback */
611 AFS_VNODE_LOCK_SETTING, /* We're asking the server for a lock */
612 AFS_VNODE_LOCK_GRANTED, /* We have a lock on the server */
613 AFS_VNODE_LOCK_EXTENDING, /* We're extending a lock on the server */
614 AFS_VNODE_LOCK_NEED_UNLOCK, /* We need to unlock on the server */
615 AFS_VNODE_LOCK_UNLOCKING, /* We're telling the server to unlock */
616 AFS_VNODE_LOCK_DELETED, /* The vnode has been deleted whilst we have a lock */
602};
603
604/*
605 * AFS inode private data.
606 *
607 * Note that afs_alloc_inode() *must* reset anything that could incorrectly
608 * leak from one inode to another.
609 */

--- 5 unchanged lines hidden (view full) ---

615 struct afs_file_status status; /* AFS status info for this file */
616 afs_dataversion_t invalid_before; /* Child dentries are invalid before this */
617#ifdef CONFIG_AFS_FSCACHE
618 struct fscache_cookie *cache; /* caching cookie */
619#endif
620 struct afs_permits __rcu *permit_cache; /* cache of permits so far obtained */
621 struct mutex io_lock; /* Lock for serialising I/O on this mutex */
622 struct rw_semaphore validate_lock; /* lock for validating this vnode */
617};
618
619/*
620 * AFS inode private data.
621 *
622 * Note that afs_alloc_inode() *must* reset anything that could incorrectly
623 * leak from one inode to another.
624 */

--- 5 unchanged lines hidden (view full) ---

630 struct afs_file_status status; /* AFS status info for this file */
631 afs_dataversion_t invalid_before; /* Child dentries are invalid before this */
632#ifdef CONFIG_AFS_FSCACHE
633 struct fscache_cookie *cache; /* caching cookie */
634#endif
635 struct afs_permits __rcu *permit_cache; /* cache of permits so far obtained */
636 struct mutex io_lock; /* Lock for serialising I/O on this mutex */
637 struct rw_semaphore validate_lock; /* lock for validating this vnode */
638 struct rw_semaphore rmdir_lock; /* Lock for rmdir vs sillyrename */
639 struct key *silly_key; /* Silly rename key */
623 spinlock_t wb_lock; /* lock for wb_keys */
624 spinlock_t lock; /* waitqueue/flags lock */
625 unsigned long flags;
626#define AFS_VNODE_CB_PROMISED 0 /* Set if vnode has a callback promise */
627#define AFS_VNODE_UNSET 1 /* set if vnode attributes not yet set */
628#define AFS_VNODE_DIR_VALID 2 /* Set if dir contents are valid */
629#define AFS_VNODE_ZAP_DATA 3 /* set if vnode's data should be invalidated */
630#define AFS_VNODE_DELETED 4 /* set if vnode deleted on server */
631#define AFS_VNODE_MOUNTPOINT 5 /* set if vnode is a mountpoint symlink */
632#define AFS_VNODE_AUTOCELL 6 /* set if Vnode is an auto mount point */
633#define AFS_VNODE_PSEUDODIR 7 /* set if Vnode is a pseudo directory */
634#define AFS_VNODE_NEW_CONTENT 8 /* Set if file has new content (create/trunc-0) */
635
636 struct list_head wb_keys; /* List of keys available for writeback */
637 struct list_head pending_locks; /* locks waiting to be granted */
638 struct list_head granted_locks; /* locks granted on this file */
639 struct delayed_work lock_work; /* work to be done in locking */
640 struct key *lock_key; /* Key to be used in lock ops */
640 spinlock_t wb_lock; /* lock for wb_keys */
641 spinlock_t lock; /* waitqueue/flags lock */
642 unsigned long flags;
643#define AFS_VNODE_CB_PROMISED 0 /* Set if vnode has a callback promise */
644#define AFS_VNODE_UNSET 1 /* set if vnode attributes not yet set */
645#define AFS_VNODE_DIR_VALID 2 /* Set if dir contents are valid */
646#define AFS_VNODE_ZAP_DATA 3 /* set if vnode's data should be invalidated */
647#define AFS_VNODE_DELETED 4 /* set if vnode deleted on server */
648#define AFS_VNODE_MOUNTPOINT 5 /* set if vnode is a mountpoint symlink */
649#define AFS_VNODE_AUTOCELL 6 /* set if Vnode is an auto mount point */
650#define AFS_VNODE_PSEUDODIR 7 /* set if Vnode is a pseudo directory */
651#define AFS_VNODE_NEW_CONTENT 8 /* Set if file has new content (create/trunc-0) */
652
653 struct list_head wb_keys; /* List of keys available for writeback */
654 struct list_head pending_locks; /* locks waiting to be granted */
655 struct list_head granted_locks; /* locks granted on this file */
656 struct delayed_work lock_work; /* work to be done in locking */
657 struct key *lock_key; /* Key to be used in lock ops */
658 ktime_t locked_at; /* Time at which lock obtained */
641 enum afs_lock_state lock_state : 8;
642 afs_lock_type_t lock_type : 8;
643
644 /* outstanding callback notification on this file */
645 struct afs_cb_interest *cb_interest; /* Server on which this resides */
646 unsigned int cb_s_break; /* Mass break counter on ->server */
647 unsigned int cb_v_break; /* Mass break counter on ->volume */
648 unsigned int cb_break; /* Break counter on vnode */

--- 210 unchanged lines hidden (view full) ---

859 * dir.c
860 */
861extern const struct file_operations afs_dir_file_operations;
862extern const struct inode_operations afs_dir_inode_operations;
863extern const struct address_space_operations afs_dir_aops;
864extern const struct dentry_operations afs_fs_dentry_operations;
865
866extern void afs_d_release(struct dentry *);
659 enum afs_lock_state lock_state : 8;
660 afs_lock_type_t lock_type : 8;
661
662 /* outstanding callback notification on this file */
663 struct afs_cb_interest *cb_interest; /* Server on which this resides */
664 unsigned int cb_s_break; /* Mass break counter on ->server */
665 unsigned int cb_v_break; /* Mass break counter on ->volume */
666 unsigned int cb_break; /* Break counter on vnode */

--- 210 unchanged lines hidden (view full) ---

877 * dir.c
878 */
879extern const struct file_operations afs_dir_file_operations;
880extern const struct inode_operations afs_dir_inode_operations;
881extern const struct address_space_operations afs_dir_aops;
882extern const struct dentry_operations afs_fs_dentry_operations;
883
884extern void afs_d_release(struct dentry *);
885extern int afs_dir_remove_link(struct dentry *, struct key *, unsigned long, unsigned long);
867
868/*
869 * dir_edit.c
870 */
871extern void afs_edit_dir_add(struct afs_vnode *, struct qstr *, struct afs_fid *,
872 enum afs_edit_dir_reason);
873extern void afs_edit_dir_remove(struct afs_vnode *, struct qstr *, enum afs_edit_dir_reason);
874
875/*
886
887/*
888 * dir_edit.c
889 */
890extern void afs_edit_dir_add(struct afs_vnode *, struct qstr *, struct afs_fid *,
891 enum afs_edit_dir_reason);
892extern void afs_edit_dir_remove(struct afs_vnode *, struct qstr *, enum afs_edit_dir_reason);
893
894/*
895 * dir_silly.c
896 */
897extern int afs_sillyrename(struct afs_vnode *, struct afs_vnode *,
898 struct dentry *, struct key *);
899extern int afs_silly_iput(struct dentry *, struct inode *);
900
901/*
876 * dynroot.c
877 */
878extern const struct file_operations afs_dynroot_file_operations;
879extern const struct inode_operations afs_dynroot_inode_operations;
880extern const struct dentry_operations afs_dynroot_dentry_operations;
881
882extern struct inode *afs_try_auto_mntpt(struct dentry *, struct inode *);
883extern int afs_dynroot_mkdir(struct afs_net *, struct afs_cell *);

--- 16 unchanged lines hidden (view full) ---

900extern int afs_page_filler(void *, struct page *);
901extern void afs_put_read(struct afs_read *);
902
903/*
904 * flock.c
905 */
906extern struct workqueue_struct *afs_lock_manager;
907
902 * dynroot.c
903 */
904extern const struct file_operations afs_dynroot_file_operations;
905extern const struct inode_operations afs_dynroot_inode_operations;
906extern const struct dentry_operations afs_dynroot_dentry_operations;
907
908extern struct inode *afs_try_auto_mntpt(struct dentry *, struct inode *);
909extern int afs_dynroot_mkdir(struct afs_net *, struct afs_cell *);

--- 16 unchanged lines hidden (view full) ---

926extern int afs_page_filler(void *, struct page *);
927extern void afs_put_read(struct afs_read *);
928
929/*
930 * flock.c
931 */
932extern struct workqueue_struct *afs_lock_manager;
933
934extern void afs_lock_op_done(struct afs_call *);
908extern void afs_lock_work(struct work_struct *);
909extern void afs_lock_may_be_available(struct afs_vnode *);
910extern int afs_lock(struct file *, int, struct file_lock *);
911extern int afs_flock(struct file *, int, struct file_lock *);
912
913/*
914 * fsclient.c
915 */

--- 18 unchanged lines hidden (view full) ---

934 pgoff_t, pgoff_t, unsigned, unsigned);
935extern int afs_fs_setattr(struct afs_fs_cursor *, struct iattr *);
936extern int afs_fs_get_volume_status(struct afs_fs_cursor *, struct afs_volume_status *);
937extern int afs_fs_set_lock(struct afs_fs_cursor *, afs_lock_type_t);
938extern int afs_fs_extend_lock(struct afs_fs_cursor *);
939extern int afs_fs_release_lock(struct afs_fs_cursor *);
940extern int afs_fs_give_up_all_callbacks(struct afs_net *, struct afs_server *,
941 struct afs_addr_cursor *, struct key *);
935extern void afs_lock_work(struct work_struct *);
936extern void afs_lock_may_be_available(struct afs_vnode *);
937extern int afs_lock(struct file *, int, struct file_lock *);
938extern int afs_flock(struct file *, int, struct file_lock *);
939
940/*
941 * fsclient.c
942 */

--- 18 unchanged lines hidden (view full) ---

961 pgoff_t, pgoff_t, unsigned, unsigned);
962extern int afs_fs_setattr(struct afs_fs_cursor *, struct iattr *);
963extern int afs_fs_get_volume_status(struct afs_fs_cursor *, struct afs_volume_status *);
964extern int afs_fs_set_lock(struct afs_fs_cursor *, afs_lock_type_t);
965extern int afs_fs_extend_lock(struct afs_fs_cursor *);
966extern int afs_fs_release_lock(struct afs_fs_cursor *);
967extern int afs_fs_give_up_all_callbacks(struct afs_net *, struct afs_server *,
968 struct afs_addr_cursor *, struct key *);
942extern int afs_fs_get_capabilities(struct afs_net *, struct afs_server *,
943 struct afs_addr_cursor *, struct key *, unsigned int, bool);
969extern struct afs_call *afs_fs_get_capabilities(struct afs_net *, struct afs_server *,
970 struct afs_addr_cursor *, struct key *,
971 unsigned int);
944extern int afs_fs_inline_bulk_status(struct afs_fs_cursor *, struct afs_net *,
945 struct afs_fid *, struct afs_file_status *,
946 struct afs_callback *, unsigned int,
947 struct afs_volsync *);
948extern int afs_fs_fetch_status(struct afs_fs_cursor *, struct afs_net *,
949 struct afs_fid *, struct afs_file_status *,
950 struct afs_callback *, struct afs_volsync *);
951

--- 8 unchanged lines hidden (view full) ---

960 * inode.c
961 */
962extern int afs_fetch_status(struct afs_vnode *, struct key *, bool);
963extern int afs_iget5_test(struct inode *, void *);
964extern struct inode *afs_iget_pseudo_dir(struct super_block *, bool);
965extern struct inode *afs_iget(struct super_block *, struct key *,
966 struct afs_fid *, struct afs_file_status *,
967 struct afs_callback *,
972extern int afs_fs_inline_bulk_status(struct afs_fs_cursor *, struct afs_net *,
973 struct afs_fid *, struct afs_file_status *,
974 struct afs_callback *, unsigned int,
975 struct afs_volsync *);
976extern int afs_fs_fetch_status(struct afs_fs_cursor *, struct afs_net *,
977 struct afs_fid *, struct afs_file_status *,
978 struct afs_callback *, struct afs_volsync *);
979

--- 8 unchanged lines hidden (view full) ---

988 * inode.c
989 */
990extern int afs_fetch_status(struct afs_vnode *, struct key *, bool);
991extern int afs_iget5_test(struct inode *, void *);
992extern struct inode *afs_iget_pseudo_dir(struct super_block *, bool);
993extern struct inode *afs_iget(struct super_block *, struct key *,
994 struct afs_fid *, struct afs_file_status *,
995 struct afs_callback *,
968 struct afs_cb_interest *);
996 struct afs_cb_interest *,
997 struct afs_vnode *);
969extern void afs_zap_data(struct afs_vnode *);
970extern int afs_validate(struct afs_vnode *, struct key *);
971extern int afs_getattr(const struct path *, struct kstat *, u32, unsigned int);
972extern int afs_setattr(struct dentry *, struct iattr *);
973extern void afs_evict_inode(struct inode *);
974extern int afs_drop_inode(struct inode *);
975
976/*

--- 91 unchanged lines hidden (view full) ---

1068 * rxrpc.c
1069 */
1070extern struct workqueue_struct *afs_async_calls;
1071
1072extern int __net_init afs_open_socket(struct afs_net *);
1073extern void __net_exit afs_close_socket(struct afs_net *);
1074extern void afs_charge_preallocation(struct work_struct *);
1075extern void afs_put_call(struct afs_call *);
998extern void afs_zap_data(struct afs_vnode *);
999extern int afs_validate(struct afs_vnode *, struct key *);
1000extern int afs_getattr(const struct path *, struct kstat *, u32, unsigned int);
1001extern int afs_setattr(struct dentry *, struct iattr *);
1002extern void afs_evict_inode(struct inode *);
1003extern int afs_drop_inode(struct inode *);
1004
1005/*

--- 91 unchanged lines hidden (view full) ---

1097 * rxrpc.c
1098 */
1099extern struct workqueue_struct *afs_async_calls;
1100
1101extern int __net_init afs_open_socket(struct afs_net *);
1102extern void __net_exit afs_close_socket(struct afs_net *);
1103extern void afs_charge_preallocation(struct work_struct *);
1104extern void afs_put_call(struct afs_call *);
1076extern long afs_make_call(struct afs_addr_cursor *, struct afs_call *, gfp_t, bool);
1105extern void afs_make_call(struct afs_addr_cursor *, struct afs_call *, gfp_t);
1106extern long afs_wait_for_call_to_complete(struct afs_call *, struct afs_addr_cursor *);
1077extern struct afs_call *afs_alloc_flat_call(struct afs_net *,
1078 const struct afs_call_type *,
1079 size_t, size_t);
1080extern void afs_flat_call_destructor(struct afs_call *);
1081extern void afs_send_empty_reply(struct afs_call *);
1082extern void afs_send_simple_reply(struct afs_call *, const void *, size_t);
1083extern int afs_extract_data(struct afs_call *, bool);
1084extern int afs_protocol_error(struct afs_call *, int, enum afs_eproto_cause);

--- 128 unchanged lines hidden (view full) ---

1213extern void afs_fs_exit(void);
1214
1215/*
1216 * vlclient.c
1217 */
1218extern struct afs_vldb_entry *afs_vl_get_entry_by_name_u(struct afs_vl_cursor *,
1219 const char *, int);
1220extern struct afs_addr_list *afs_vl_get_addrs_u(struct afs_vl_cursor *, const uuid_t *);
1107extern struct afs_call *afs_alloc_flat_call(struct afs_net *,
1108 const struct afs_call_type *,
1109 size_t, size_t);
1110extern void afs_flat_call_destructor(struct afs_call *);
1111extern void afs_send_empty_reply(struct afs_call *);
1112extern void afs_send_simple_reply(struct afs_call *, const void *, size_t);
1113extern int afs_extract_data(struct afs_call *, bool);
1114extern int afs_protocol_error(struct afs_call *, int, enum afs_eproto_cause);

--- 128 unchanged lines hidden (view full) ---

1243extern void afs_fs_exit(void);
1244
1245/*
1246 * vlclient.c
1247 */
1248extern struct afs_vldb_entry *afs_vl_get_entry_by_name_u(struct afs_vl_cursor *,
1249 const char *, int);
1250extern struct afs_addr_list *afs_vl_get_addrs_u(struct afs_vl_cursor *, const uuid_t *);
1221extern int afs_vl_get_capabilities(struct afs_net *, struct afs_addr_cursor *, struct key *,
1222 struct afs_vlserver *, unsigned int, bool);
1251extern struct afs_call *afs_vl_get_capabilities(struct afs_net *, struct afs_addr_cursor *,
1252 struct key *, struct afs_vlserver *, unsigned int);
1223extern struct afs_addr_list *afs_yfsvl_get_endpoints(struct afs_vl_cursor *, const uuid_t *);
1224
1225/*
1226 * vl_probe.c
1227 */
1228extern void afs_vlserver_probe_result(struct afs_call *);
1229extern int afs_send_vl_probes(struct afs_net *, struct key *, struct afs_vlserver_list *);
1230extern int afs_wait_for_vl_probes(struct afs_vlserver_list *, unsigned long);

--- 282 unchanged lines hidden ---
1253extern struct afs_addr_list *afs_yfsvl_get_endpoints(struct afs_vl_cursor *, const uuid_t *);
1254
1255/*
1256 * vl_probe.c
1257 */
1258extern void afs_vlserver_probe_result(struct afs_call *);
1259extern int afs_send_vl_probes(struct afs_net *, struct key *, struct afs_vlserver_list *);
1260extern int afs_wait_for_vl_probes(struct afs_vlserver_list *, unsigned long);

--- 282 unchanged lines hidden ---