Lines Matching +full:2 +full:- +full:cell

1 // SPDX-License-Identifier: GPL-2.0-or-later
37 struct afs_cell *cell; in afs_proc_cells_show() local
45 cell = list_entry(v, struct afs_cell, proc_link); in afs_proc_cells_show()
46 vllist = rcu_dereference(cell->vl_servers); in afs_proc_cells_show()
48 /* display one cell per line on subsequent lines */ in afs_proc_cells_show()
49 seq_printf(m, "%3u %3u %6lld %2u %2u %s\n", in afs_proc_cells_show()
50 refcount_read(&cell->ref), in afs_proc_cells_show()
51 atomic_read(&cell->active), in afs_proc_cells_show()
52 cell->dns_expiry - ktime_get_real_seconds(), in afs_proc_cells_show()
53 vllist ? vllist->nr_servers : 0, in afs_proc_cells_show()
54 cell->state, in afs_proc_cells_show()
55 cell->name); in afs_proc_cells_show()
63 return seq_hlist_start_head_rcu(&afs_seq2net(m)->proc_cells, *_pos); in afs_proc_cells_start()
68 return seq_hlist_next_rcu(v, &afs_seq2net(m)->proc_cells, pos); in afs_proc_cells_next()
86 * - to add cells: echo "add <cellname> <IP>[:<IP>][:<IP>]"
90 struct seq_file *m = file->private_data; in afs_proc_cells_write()
123 struct afs_cell *cell; in afs_proc_cells_write() local
125 cell = afs_lookup_cell(net, name, strlen(name), args, true); in afs_proc_cells_write()
126 if (IS_ERR(cell)) { in afs_proc_cells_write()
127 ret = PTR_ERR(cell); in afs_proc_cells_write()
131 if (test_and_set_bit(AFS_CELL_FL_NO_GC, &cell->flags)) in afs_proc_cells_write()
132 afs_unuse_cell(net, cell, afs_cell_trace_unuse_no_pin); in afs_proc_cells_write()
144 ret = -EINVAL; in afs_proc_cells_write()
165 preflist = rcu_dereference(net->address_prefs); in afs_proc_addr_prefs_show()
173 preflist->version, preflist->ipv6_off, preflist->nr, preflist->max_prefs); in afs_proc_addr_prefs_show()
177 for (i = 0; i < preflist->nr; i++) { in afs_proc_addr_prefs_show()
178 pref = &preflist->prefs[i]; in afs_proc_addr_prefs_show()
180 addr.sin.sin_family = pref->family; in afs_proc_addr_prefs_show()
181 if (pref->family == AF_INET) { in afs_proc_addr_prefs_show()
182 memcpy(&addr.sin.sin_addr, &pref->ipv4_addr, in afs_proc_addr_prefs_show()
184 snprintf(buf, sizeof(buf), "%pISc/%u", &addr.sin, pref->subnet_mask); in afs_proc_addr_prefs_show()
185 seq_printf(m, "UDP %-43.43s %5u\n", buf, pref->prio); in afs_proc_addr_prefs_show()
187 memcpy(&addr.sin6.sin6_addr, &pref->ipv6_addr, in afs_proc_addr_prefs_show()
189 snprintf(buf, sizeof(buf), "%pISc/%u", &addr.sin6, pref->subnet_mask); in afs_proc_addr_prefs_show()
190 seq_printf(m, "UDP %-43.43s %5u\n", buf, pref->prio); in afs_proc_addr_prefs_show()
200 * Display the name of the current workstation cell.
204 struct afs_cell *cell; in afs_proc_rootcell_show() local
208 down_read(&net->cells_lock); in afs_proc_rootcell_show()
209 cell = net->ws_cell; in afs_proc_rootcell_show()
210 if (cell) in afs_proc_rootcell_show()
211 seq_printf(m, "%s\n", cell->name); in afs_proc_rootcell_show()
212 up_read(&net->cells_lock); in afs_proc_rootcell_show()
217 * Set the current workstation cell and optionally supply its list of volume
220 * echo "cell.name:192.168.231.14" >/proc/fs/afs/rootcell
224 struct seq_file *m = file->private_data; in afs_proc_rootcell_write()
229 ret = -EINVAL; in afs_proc_rootcell_write()
257 * Display the list of volumes known to a cell.
270 refcount_read(&vol->ref), vol->vid, in afs_proc_cell_volumes_show()
271 afs_vol_types[vol->type], in afs_proc_cell_volumes_show()
272 vol->name); in afs_proc_cell_volumes_show()
278 __acquires(cell->proc_lock) in afs_proc_cell_volumes_start()
280 struct afs_cell *cell = pde_data(file_inode(m->file)); in afs_proc_cell_volumes_start() local
283 return seq_hlist_start_head_rcu(&cell->proc_volumes, *_pos); in afs_proc_cell_volumes_start()
289 struct afs_cell *cell = pde_data(file_inode(m->file)); in afs_proc_cell_volumes_next() local
291 return seq_hlist_next_rcu(v, &cell->proc_volumes, _pos); in afs_proc_cell_volumes_next()
295 __releases(cell->proc_lock) in afs_proc_cell_volumes_stop()
318 [DNS_LOOKUP_NOT_DONE] = "no-lookup",
322 [DNS_LOOKUP_GOT_NOT_FOUND] = "not-found",
323 [DNS_LOOKUP_GOT_LOCAL_FAILURE] = "local-failure",
324 [DNS_LOOKUP_GOT_TEMP_FAILURE] = "temp-failure",
325 [DNS_LOOKUP_GOT_NS_FAILURE] = "ns-failure",
330 * Display the list of Volume Location servers we're using for a cell.
334 const struct afs_vl_seq_net_private *priv = m->private; in afs_proc_cell_vlservers_show()
335 const struct afs_vlserver_list *vllist = priv->vllist; in afs_proc_cell_vlservers_show()
343 dns_record_sources[vllist ? vllist->source : 0], in afs_proc_cell_vlservers_show()
344 dns_lookup_statuses[vllist ? vllist->status : 0]); in afs_proc_cell_vlservers_show()
349 vlserver = entry->server; in afs_proc_cell_vlservers_show()
350 alist = rcu_dereference(vlserver->addresses); in afs_proc_cell_vlservers_show()
353 vlserver->name, entry->priority, entry->weight, in afs_proc_cell_vlservers_show()
354 dns_record_sources[alist ? alist->source : entry->source], in afs_proc_cell_vlservers_show()
355 dns_lookup_statuses[alist ? alist->status : entry->status]); in afs_proc_cell_vlservers_show()
357 for (i = 0; i < alist->nr_addrs; i++) in afs_proc_cell_vlservers_show()
359 alist->preferred == i ? '>' : '-', in afs_proc_cell_vlservers_show()
360 rxrpc_kernel_remote_addr(alist->addrs[i].peer)); in afs_proc_cell_vlservers_show()
362 seq_printf(m, " info: fl=%lx rtt=%d\n", vlserver->flags, vlserver->rtt); in afs_proc_cell_vlservers_show()
364 vlserver->probe.flags, vlserver->probe.error, in afs_proc_cell_vlservers_show()
365 vlserver->probe.abort_code, in afs_proc_cell_vlservers_show()
366 atomic_read(&vlserver->probe_outstanding)); in afs_proc_cell_vlservers_show()
373 struct afs_vl_seq_net_private *priv = m->private; in afs_proc_cell_vlservers_start()
375 struct afs_cell *cell = pde_data(file_inode(m->file)); in afs_proc_cell_vlservers_start() local
380 vllist = rcu_dereference(cell->vl_servers); in afs_proc_cell_vlservers_start()
381 priv->vllist = vllist; in afs_proc_cell_vlservers_start()
388 if (pos - 1 >= vllist->nr_servers) in afs_proc_cell_vlservers_start()
391 return &vllist->servers[pos - 1]; in afs_proc_cell_vlservers_start()
397 struct afs_vl_seq_net_private *priv = m->private; in afs_proc_cell_vlservers_next()
398 struct afs_vlserver_list *vllist = priv->vllist; in afs_proc_cell_vlservers_next()
404 if (!vllist || pos - 1 >= vllist->nr_servers) in afs_proc_cell_vlservers_next()
407 return &vllist->servers[pos - 1]; in afs_proc_cell_vlservers_next()
435 seq_puts(m, "UUID REF ACT CELL\n"); in afs_proc_servers_show()
440 estate = rcu_dereference(server->endpoint_state); in afs_proc_servers_show()
441 alist = estate->addresses; in afs_proc_servers_show()
443 &server->uuid, in afs_proc_servers_show()
444 refcount_read(&server->ref), in afs_proc_servers_show()
445 atomic_read(&server->active), in afs_proc_servers_show()
446 server->cell->name); in afs_proc_servers_show()
447 seq_printf(m, " - info: fl=%lx rtt=%u\n", in afs_proc_servers_show()
448 server->flags, server->rtt); in afs_proc_servers_show()
449 seq_printf(m, " - probe: last=%d\n", in afs_proc_servers_show()
450 (int)(jiffies - server->probed_at) / HZ); in afs_proc_servers_show()
451 failed = estate->failed_set; in afs_proc_servers_show()
452 seq_printf(m, " - ESTATE pq=%x np=%u rsp=%lx f=%lx\n", in afs_proc_servers_show()
453 estate->probe_seq, atomic_read(&estate->nr_probing), in afs_proc_servers_show()
454 estate->responsive_set, estate->failed_set); in afs_proc_servers_show()
455 seq_printf(m, " - ALIST v=%u ap=%u\n", in afs_proc_servers_show()
456 alist->version, alist->addr_pref_version); in afs_proc_servers_show()
457 for (i = 0; i < alist->nr_addrs; i++) { in afs_proc_servers_show()
458 const struct afs_address *addr = &alist->addrs[i]; in afs_proc_servers_show()
461 i, rxrpc_kernel_remote_addr(addr->peer), in afs_proc_servers_show()
462 alist->preferred == i ? "*" : in afs_proc_servers_show()
464 rxrpc_kernel_get_srtt(addr->peer), in afs_proc_servers_show()
465 addr->last_error, addr->prio); in afs_proc_servers_show()
474 return seq_hlist_start_head_rcu(&afs_seq2net(m)->fs_proc, *_pos); in afs_proc_servers_start()
479 return seq_hlist_next_rcu(v, &afs_seq2net(m)->fs_proc, _pos); in afs_proc_servers_next()
502 struct afs_sysnames *sysnames = net->sysnames; in afs_proc_sysname_show()
503 unsigned int i = (unsigned long)v - 1; in afs_proc_sysname_show()
505 if (i < sysnames->nr) in afs_proc_sysname_show()
506 seq_printf(m, "%s\n", sysnames->subs[i]); in afs_proc_sysname_show()
511 __acquires(&net->sysnames_lock) in afs_proc_sysname_start()
516 read_lock(&net->sysnames_lock); in afs_proc_sysname_start()
518 names = net->sysnames; in afs_proc_sysname_start()
519 if (*pos >= names->nr) in afs_proc_sysname_start()
527 struct afs_sysnames *names = net->sysnames; in afs_proc_sysname_next()
530 if (*pos >= names->nr) in afs_proc_sysname_next()
536 __releases(&net->sysnames_lock) in afs_proc_sysname_stop()
540 read_unlock(&net->sysnames_lock); in afs_proc_sysname_stop()
556 struct seq_file *m = file->private_data; in afs_proc_sysname_write()
563 return -ENOMEM; in afs_proc_sysname_write()
564 refcount_set(&sysnames->usage, 1); in afs_proc_sysname_write()
572 ret = -ENAMETOOLONG; in afs_proc_sysname_write()
577 s[len - 4] == '@' && in afs_proc_sysname_write()
578 s[len - 3] == 's' && in afs_proc_sysname_write()
579 s[len - 2] == 'y' && in afs_proc_sysname_write()
580 s[len - 1] == 's') in afs_proc_sysname_write()
585 (len < 2 || (len == 2 && s[1] == '.'))) in afs_proc_sysname_write()
591 ret = -EFBIG; in afs_proc_sysname_write()
592 if (sysnames->nr >= AFS_NR_SYSNAME) in afs_proc_sysname_write()
598 ret = -ENOMEM; in afs_proc_sysname_write()
604 sysnames->subs[sysnames->nr] = sub; in afs_proc_sysname_write()
605 sysnames->nr++; in afs_proc_sysname_write()
608 if (sysnames->nr == 0) { in afs_proc_sysname_write()
609 sysnames->subs[0] = sysnames->blank; in afs_proc_sysname_write()
610 sysnames->nr++; in afs_proc_sysname_write()
613 write_lock(&net->sysnames_lock); in afs_proc_sysname_write()
614 kill = net->sysnames; in afs_proc_sysname_write()
615 net->sysnames = sysnames; in afs_proc_sysname_write()
616 write_unlock(&net->sysnames_lock); in afs_proc_sysname_write()
623 ret = -EINVAL; in afs_proc_sysname_write()
632 if (sysnames && refcount_dec_and_test(&sysnames->usage)) { in afs_put_sysnames()
633 for (i = 0; i < sysnames->nr; i++) in afs_put_sysnames()
634 if (sysnames->subs[i] != afs_init_sysname && in afs_put_sysnames()
635 sysnames->subs[i] != sysnames->blank) in afs_put_sysnames()
636 kfree(sysnames->subs[i]); in afs_put_sysnames()
642 * Display general per-net namespace statistics
650 seq_printf(m, "dir-mgmt: look=%u reval=%u inval=%u relpg=%u\n", in afs_proc_stats_show()
651 atomic_read(&net->n_lookup), in afs_proc_stats_show()
652 atomic_read(&net->n_reval), in afs_proc_stats_show()
653 atomic_read(&net->n_inval), in afs_proc_stats_show()
654 atomic_read(&net->n_relpg)); in afs_proc_stats_show()
656 seq_printf(m, "dir-data: rdpg=%u\n", in afs_proc_stats_show()
657 atomic_read(&net->n_read_dir)); in afs_proc_stats_show()
659 seq_printf(m, "dir-edit: cr=%u rm=%u\n", in afs_proc_stats_show()
660 atomic_read(&net->n_dir_cr), in afs_proc_stats_show()
661 atomic_read(&net->n_dir_rm)); in afs_proc_stats_show()
663 seq_printf(m, "file-rd : n=%u nb=%lu\n", in afs_proc_stats_show()
664 atomic_read(&net->n_fetches), in afs_proc_stats_show()
665 atomic_long_read(&net->n_fetch_bytes)); in afs_proc_stats_show()
666 seq_printf(m, "file-wr : n=%u nb=%lu\n", in afs_proc_stats_show()
667 atomic_read(&net->n_stores), in afs_proc_stats_show()
668 atomic_long_read(&net->n_store_bytes)); in afs_proc_stats_show()
673 * initialise /proc/fs/afs/<cell>/
675 int afs_proc_cell_setup(struct afs_cell *cell) in afs_proc_cell_setup() argument
678 struct afs_net *net = cell->net; in afs_proc_cell_setup()
680 _enter("%p{%s},%p", cell, cell->name, net->proc_afs); in afs_proc_cell_setup()
682 dir = proc_net_mkdir(net->net, cell->name, net->proc_afs); in afs_proc_cell_setup()
689 cell) || in afs_proc_cell_setup()
693 cell)) in afs_proc_cell_setup()
700 remove_proc_subtree(cell->name, net->proc_afs); in afs_proc_cell_setup()
702 _leave(" = -ENOMEM"); in afs_proc_cell_setup()
703 return -ENOMEM; in afs_proc_cell_setup()
707 * remove /proc/fs/afs/<cell>/
709 void afs_proc_cell_remove(struct afs_cell *cell) in afs_proc_cell_remove() argument
711 struct afs_net *net = cell->net; in afs_proc_cell_remove()
714 remove_proc_subtree(cell->name, net->proc_afs); in afs_proc_cell_remove()
727 p = proc_net_mkdir(net->net, "afs", net->net->proc_net); in afs_proc_init()
754 net->proc_afs = p; in afs_proc_init()
761 _leave(" = -ENOMEM"); in afs_proc_init()
762 return -ENOMEM; in afs_proc_init()
770 proc_remove(net->proc_afs); in afs_proc_cleanup()
771 net->proc_afs = NULL; in afs_proc_cleanup()