22
22
#include <linux/backing-dev.h>
23
23
#include <linux/uuid.h>
24
24
#include <net/net_namespace.h>
25
+ #include <net/netns/generic.h>
26
+ #include <net/sock.h>
25
27
#include <net/af_rxrpc.h>
26
28
27
29
#include "afs.h"
@@ -40,7 +42,8 @@ struct afs_mount_params {
40
42
afs_voltype_t type ; /* type of volume requested */
41
43
int volnamesz ; /* size of volume name */
42
44
const char * volname ; /* name of volume to mount */
43
- struct afs_net * net ; /* Network namespace in effect */
45
+ struct net * net_ns ; /* Network namespace in effect */
46
+ struct afs_net * net ; /* the AFS net namespace stuff */
44
47
struct afs_cell * cell ; /* cell in which to find volume */
45
48
struct afs_volume * volume ; /* volume record */
46
49
struct key * key ; /* key to use for secure mounting */
@@ -189,7 +192,7 @@ struct afs_read {
189
192
* - there's one superblock per volume
190
193
*/
191
194
struct afs_super_info {
192
- struct afs_net * net ; /* Network namespace */
195
+ struct net * net_ns ; /* Network namespace */
193
196
struct afs_cell * cell ; /* The cell in which the volume resides */
194
197
struct afs_volume * volume ; /* volume record */
195
198
bool dyn_root ; /* True if dynamic root */
@@ -210,14 +213,14 @@ struct afs_sysnames {
210
213
char * subs [AFS_NR_SYSNAME ];
211
214
refcount_t usage ;
212
215
unsigned short nr ;
213
- short error ;
214
216
char blank [1 ];
215
217
};
216
218
217
219
/*
218
220
* AFS network namespace record.
219
221
*/
220
222
struct afs_net {
223
+ struct net * net ; /* Backpointer to the owning net namespace */
221
224
struct afs_uuid uuid ;
222
225
bool live ; /* F if this namespace is being removed */
223
226
@@ -280,7 +283,6 @@ struct afs_net {
280
283
};
281
284
282
285
extern const char afs_init_sysname [];
283
- extern struct afs_net __afs_net ;// Dummy AFS network namespace; TODO: replace with real netns
284
286
285
287
enum afs_cell_state {
286
288
AFS_CELL_UNSET ,
@@ -787,34 +789,36 @@ extern int afs_drop_inode(struct inode *);
787
789
* main.c
788
790
*/
789
791
extern struct workqueue_struct * afs_wq ;
792
+ extern int afs_net_id ;
790
793
791
- static inline struct afs_net * afs_d2net (struct dentry * dentry )
794
+ static inline struct afs_net * afs_net (struct net * net )
792
795
{
793
- return & __afs_net ;
796
+ return net_generic ( net , afs_net_id ) ;
794
797
}
795
798
796
- static inline struct afs_net * afs_i2net (struct inode * inode )
799
+ static inline struct afs_net * afs_sb2net (struct super_block * sb )
797
800
{
798
- return & __afs_net ;
801
+ return afs_net ( AFS_FS_S ( sb ) -> net_ns ) ;
799
802
}
800
803
801
- static inline struct afs_net * afs_v2net (struct afs_vnode * vnode )
804
+ static inline struct afs_net * afs_d2net (struct dentry * dentry )
802
805
{
803
- return & __afs_net ;
806
+ return afs_sb2net ( dentry -> d_sb ) ;
804
807
}
805
808
806
- static inline struct afs_net * afs_sock2net (struct sock * sk )
809
+ static inline struct afs_net * afs_i2net (struct inode * inode )
807
810
{
808
- return & __afs_net ;
811
+ return afs_sb2net ( inode -> i_sb ) ;
809
812
}
810
813
811
- static inline struct afs_net * afs_get_net (struct afs_net * net )
814
+ static inline struct afs_net * afs_v2net (struct afs_vnode * vnode )
812
815
{
813
- return net ;
816
+ return afs_i2net ( & vnode -> vfs_inode ) ;
814
817
}
815
818
816
- static inline void afs_put_net (struct afs_net * net )
819
+ static inline struct afs_net * afs_sock2net (struct sock * sk )
817
820
{
821
+ return net_generic (sock_net (sk ), afs_net_id );
818
822
}
819
823
820
824
static inline void __afs_stat (atomic_t * s )
@@ -842,15 +846,16 @@ extern void afs_mntpt_kill_timer(void);
842
846
/*
843
847
* netdevices.c
844
848
*/
845
- extern int afs_get_ipv4_interfaces (struct afs_interface * , size_t , bool );
849
+ extern int afs_get_ipv4_interfaces (struct afs_net * , struct afs_interface * ,
850
+ size_t , bool );
846
851
847
852
/*
848
853
* proc.c
849
854
*/
850
855
extern int __net_init afs_proc_init (struct afs_net * );
851
856
extern void __net_exit afs_proc_cleanup (struct afs_net * );
852
- extern int afs_proc_cell_setup (struct afs_net * , struct afs_cell * );
853
- extern void afs_proc_cell_remove (struct afs_net * , struct afs_cell * );
857
+ extern int afs_proc_cell_setup (struct afs_cell * );
858
+ extern void afs_proc_cell_remove (struct afs_cell * );
854
859
extern void afs_put_sysnames (struct afs_sysnames * );
855
860
856
861
/*
@@ -983,7 +988,7 @@ extern bool afs_annotate_server_list(struct afs_server_list *, struct afs_server
983
988
* super.c
984
989
*/
985
990
extern int __init afs_fs_init (void );
986
- extern void __exit afs_fs_exit (void );
991
+ extern void afs_fs_exit (void );
987
992
988
993
/*
989
994
* vlclient.c
0 commit comments