12 #include <linux/module.h>
13 #include <linux/slab.h>
15 #include <linux/ctype.h>
17 #include <linux/sched.h>
28 static struct afs_cell *afs_cell_root;
40 char *dvllist =
NULL, *_vllist =
NULL;
44 _enter(
"%*.*s,%s", namelen, namelen, name ?:
"", vllist);
49 _leave(
" = -ENAMETOOLONG");
64 INIT_LIST_HEAD(&cell->
link);
72 if (!vllist ||
strlen(vllist) < 7) {
73 ret =
dns_query(
"afsdb", name, namelen,
"ipv4", &dvllist,
NULL);
95 next =
strchr(_vllist, delimiter);
99 if (
sscanf(_vllist,
"%u.%u.%u.%u", &a, &b, &c, &d) != 4)
102 if (a > 255 || b > 255 || c > 255 || d > 255)
106 htonl((a << 24) | (b << 16) | (c << 8) | d);
111 memcpy(keyname,
"afs@", 4);
151 char *vllist,
bool retref)
156 _enter(
"%*.*s,%s", namesz, namesz, name ?:
"", vllist);
166 cell = afs_cell_alloc(name, namesz, vllist);
168 _leave(
" = %ld", PTR_ERR(cell));
178 #ifdef CONFIG_AFS_FSCACHE
206 if (retref && !IS_ERR(cell))
228 struct afs_cell *old_root, *new_root;
241 cp =
strchr(rootcell,
':');
243 _debug(
"kAFS: no VL server IP addresses specified");
249 if (IS_ERR(new_root)) {
250 _leave(
" = %ld", PTR_ERR(new_root));
251 return PTR_ERR(new_root);
256 old_root = afs_cell_root;
257 afs_cell_root = new_root;
273 _enter(
"\"%*.*s\",", namesz, namesz, name ?:
"");
292 cell = afs_cell_root;
330 if (cell && !list_empty(&cell->
link))
367 wake_up(&afs_cells_freeable_wq);
377 static void afs_cell_destroy(
struct afs_cell *cell)
412 #ifdef CONFIG_AFS_FSCACHE
413 fscache_relinquish_cookie(cell->cache, 0);
435 while (!list_empty(&afs_cells)) {
441 if (!list_empty(&afs_cells)) {
444 list_del_init(&cell->
link);
450 _debug(
"PURGING CELL %s (%d)",
454 afs_cell_destroy(cell);