summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2017-11-02 15:27:47 +0000
committerDavid Howells <dhowells@redhat.com>2017-11-13 15:38:17 +0000
commit4d9df9868f31df6725481135c10ac6419ce58d44 (patch)
treec4fcbe437438c940485d438ad5c5871ab20d3288
parentad6a942a9e74edea8a4a126a1e434feff6a6d5c2 (diff)
afs: Keep and pass sockaddr_rxrpc addresses rather than in_addr
Keep and pass sockaddr_rxrpc addresses around rather than keeping and passing in_addr addresses to allow for the use of IPv6 and non-standard port numbers in future. This also allows the port and service_id fields to be removed from the afs_call struct. Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r--fs/afs/cell.c18
-rw-r--r--fs/afs/fsclient.c36
-rw-r--r--fs/afs/internal.h15
-rw-r--r--fs/afs/proc.c10
-rw-r--r--fs/afs/rxrpc.c18
-rw-r--r--fs/afs/server.c31
-rw-r--r--fs/afs/vlclient.c20
-rw-r--r--fs/afs/vlocation.c30
-rw-r--r--fs/afs/vnode.c28
-rw-r--r--fs/afs/volume.c9
10 files changed, 85 insertions, 130 deletions
diff --git a/fs/afs/cell.c b/fs/afs/cell.c
index 2224e335eed7..5523fa3c05d9 100644
--- a/fs/afs/cell.c
+++ b/fs/afs/cell.c
@@ -31,7 +31,7 @@ static struct afs_cell *afs_cell_alloc(struct afs_net *net,
char keyname[4 + AFS_MAXCELLNAME + 1], *cp, *dp, *next;
char *dvllist = NULL, *_vllist = NULL;
char delimiter = ':';
- int ret;
+ int ret, i;
_enter("%*.*s,%s", namelen, namelen, name ?: "", vllist);
@@ -61,6 +61,14 @@ static struct afs_cell *afs_cell_alloc(struct afs_net *net,
INIT_LIST_HEAD(&cell->vl_list);
spin_lock_init(&cell->vl_lock);
+ for (i = 0; i < AFS_CELL_MAX_ADDRS; i++) {
+ struct sockaddr_rxrpc *srx = &cell->vl_addrs[i];
+ srx->srx_family = AF_RXRPC;
+ srx->srx_service = VL_SERVICE;
+ srx->transport_type = SOCK_DGRAM;
+ srx->transport.sin.sin_port = htons(AFS_VL_PORT);
+ }
+
/* if the ip address is invalid, try dns query */
if (!vllist || strlen(vllist) < 7) {
ret = dns_query("afsdb", name, namelen, "ipv4", &dvllist, NULL);
@@ -83,6 +91,7 @@ static struct afs_cell *afs_cell_alloc(struct afs_net *net,
/* fill in the VL server list from the rest of the string */
do {
+ struct sockaddr_rxrpc *srx = &cell->vl_addrs[cell->vl_naddrs];
unsigned a, b, c, d;
next = strchr(_vllist, delimiter);
@@ -95,10 +104,13 @@ static struct afs_cell *afs_cell_alloc(struct afs_net *net,
if (a > 255 || b > 255 || c > 255 || d > 255)
goto bad_address;
- cell->vl_addrs[cell->vl_naddrs++].s_addr =
+ srx->transport_len = sizeof(struct sockaddr_in);
+ srx->transport.sin.sin_family = AF_INET;
+ srx->transport.sin.sin_addr.s_addr =
htonl((a << 24) | (b << 16) | (c << 8) | d);
- } while (cell->vl_naddrs < AFS_CELL_MAX_ADDRS && (_vllist = next));
+ } while (cell->vl_naddrs++,
+ cell->vl_naddrs < AFS_CELL_MAX_ADDRS && (_vllist = next));
/* create a key to represent an anonymous user */
memcpy(keyname, "afs@", 4);
diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c
index ce6f0159e1d4..bac2e8db6e75 100644
--- a/fs/afs/fsclient.c
+++ b/fs/afs/fsclient.c
@@ -297,8 +297,6 @@ int afs_fs_fetch_file_status(struct afs_server *server,
call->key = key;
call->reply = vnode;
call->reply2 = volsync;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
@@ -504,8 +502,6 @@ static int afs_fs_fetch_data64(struct afs_server *server,
call->reply = vnode;
call->reply2 = NULL; /* volsync */
call->reply3 = req;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
call->operation_ID = FSFETCHDATA64;
/* marshall the parameters */
@@ -551,8 +547,6 @@ int afs_fs_fetch_data(struct afs_server *server,
call->reply = vnode;
call->reply2 = NULL; /* volsync */
call->reply3 = req;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
call->operation_ID = FSFETCHDATA;
/* marshall the parameters */
@@ -619,8 +613,6 @@ int afs_fs_give_up_callbacks(struct afs_net *net,
if (!call)
return -ENOMEM;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
@@ -723,8 +715,6 @@ int afs_fs_create(struct afs_server *server,
call->reply2 = newfid;
call->reply3 = newstatus;
call->reply4 = newcb;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
@@ -810,8 +800,6 @@ int afs_fs_remove(struct afs_server *server,
call->key = key;
call->reply = vnode;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
@@ -893,8 +881,6 @@ int afs_fs_link(struct afs_server *server,
call->key = key;
call->reply = dvnode;
call->reply2 = vnode;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
@@ -988,8 +974,6 @@ int afs_fs_symlink(struct afs_server *server,
call->reply = vnode;
call->reply2 = newfid;
call->reply3 = newstatus;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
@@ -1094,8 +1078,6 @@ int afs_fs_rename(struct afs_server *server,
call->key = key;
call->reply = orig_dvnode;
call->reply2 = new_dvnode;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
@@ -1196,8 +1178,6 @@ static int afs_fs_store_data64(struct afs_server *server,
call->wb = wb;
call->key = wb->key;
call->reply = vnode;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
call->mapping = vnode->vfs_inode.i_mapping;
call->first = first;
call->last = last;
@@ -1274,8 +1254,6 @@ int afs_fs_store_data(struct afs_server *server, struct afs_writeback *wb,
call->wb = wb;
call->key = wb->key;
call->reply = vnode;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
call->mapping = vnode->vfs_inode.i_mapping;
call->first = first;
call->last = last;
@@ -1383,8 +1361,6 @@ static int afs_fs_setattr_size64(struct afs_server *server, struct key *key,
call->key = key;
call->reply = vnode;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
call->store_version = vnode->status.data_version + 1;
call->operation_ID = FSSTOREDATA;
@@ -1435,8 +1411,6 @@ static int afs_fs_setattr_size(struct afs_server *server, struct key *key,
call->key = key;
call->reply = vnode;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
call->store_version = vnode->status.data_version + 1;
call->operation_ID = FSSTOREDATA;
@@ -1483,8 +1457,6 @@ int afs_fs_setattr(struct afs_server *server, struct key *key,
call->key = key;
call->reply = vnode;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
call->operation_ID = FSSTORESTATUS;
/* marshall the parameters */
@@ -1721,8 +1693,6 @@ int afs_fs_get_volume_status(struct afs_server *server,
call->reply = vnode;
call->reply2 = vs;
call->reply3 = tmpbuf;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
@@ -1805,8 +1775,6 @@ int afs_fs_set_lock(struct afs_server *server,
call->key = key;
call->reply = vnode;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
@@ -1839,8 +1807,6 @@ int afs_fs_extend_lock(struct afs_server *server,
call->key = key;
call->reply = vnode;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
@@ -1872,8 +1838,6 @@ int afs_fs_release_lock(struct afs_server *server,
call->key = key;
call->reply = vnode;
- call->service_id = FS_SERVICE;
- call->port = htons(AFS_FS_PORT);
/* marshall the parameters */
bp = call->request;
diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index b16181b2fa43..4fe26bd7bfb0 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -106,7 +106,6 @@ struct afs_call {
bool async; /* T if asynchronous */
bool upgrade; /* T to request service upgrade */
u16 service_id; /* RxRPC service ID to call */
- __be16 port; /* target UDP port */
u32 operation_ID; /* operation ID for an incoming call */
u32 count; /* count for use in unmarshalling */
__be32 tmp; /* place to extract temporary data */
@@ -264,7 +263,7 @@ struct afs_cell {
spinlock_t vl_lock; /* vl_list lock */
unsigned short vl_naddrs; /* number of VL servers in addr list */
unsigned short vl_curr_svix; /* current server index */
- struct in_addr vl_addrs[AFS_CELL_MAX_ADDRS]; /* cell VL server addresses */
+ struct sockaddr_rxrpc vl_addrs[AFS_CELL_MAX_ADDRS]; /* cell VL server addresses */
char name[0]; /* cell name - must go last */
};
@@ -284,7 +283,7 @@ struct afs_cache_vlocation {
#define AFS_VOL_VTM_BAK 0x04 /* backup version of the volume is available (on this server) */
afs_volid_t vid[3]; /* volume IDs for R/W, R/O and Bak volumes */
- struct in_addr servers[8]; /* fileserver addresses */
+ struct sockaddr_rxrpc servers[8]; /* fileserver addresses */
time_t rtime; /* last retrieval time */
};
@@ -315,7 +314,7 @@ struct afs_vlocation {
struct afs_server {
atomic_t usage;
time64_t time_of_death; /* time at which put reduced usage to 0 */
- struct in_addr addr; /* server address */
+ struct sockaddr_rxrpc addr; /* server address */
struct afs_net *net; /* Network namespace in which the server resides */
struct afs_cell *cell; /* cell in which server resides */
struct list_head link; /* link in cell's server list */
@@ -654,7 +653,7 @@ extern void __net_exit afs_close_socket(struct afs_net *);
extern void afs_charge_preallocation(struct work_struct *);
extern void afs_put_call(struct afs_call *);
extern int afs_queue_call_work(struct afs_call *);
-extern int afs_make_call(struct in_addr *, struct afs_call *, gfp_t, bool);
+extern int afs_make_call(struct sockaddr_rxrpc *, struct afs_call *, gfp_t, bool);
extern struct afs_call *afs_alloc_flat_call(struct afs_net *,
const struct afs_call_type *,
size_t, size_t);
@@ -690,7 +689,7 @@ do { \
extern void afs_server_timer(struct timer_list *);
extern struct afs_server *afs_lookup_server(struct afs_cell *,
- const struct in_addr *);
+ struct sockaddr_rxrpc *);
extern struct afs_server *afs_find_server(struct afs_net *,
const struct sockaddr_rxrpc *);
extern void afs_put_server(struct afs_net *, struct afs_server *);
@@ -707,11 +706,11 @@ extern void __exit afs_fs_exit(void);
* vlclient.c
*/
extern int afs_vl_get_entry_by_name(struct afs_net *,
- struct in_addr *, struct key *,
+ struct sockaddr_rxrpc *, struct key *,
const char *, struct afs_cache_vlocation *,
bool);
extern int afs_vl_get_entry_by_id(struct afs_net *,
- struct in_addr *, struct key *,
+ struct sockaddr_rxrpc *, struct key *,
afs_volid_t, afs_voltype_t,
struct afs_cache_vlocation *, bool);
diff --git a/fs/afs/proc.c b/fs/afs/proc.c
index 677a453b08bf..f76018104ae0 100644
--- a/fs/afs/proc.c
+++ b/fs/afs/proc.c
@@ -570,16 +570,16 @@ static void afs_proc_cell_vlservers_stop(struct seq_file *p, void *v)
*/
static int afs_proc_cell_vlservers_show(struct seq_file *m, void *v)
{
- struct in_addr *addr = v;
+ struct sockaddr_rxrpc *addr = v;
/* display header on line 1 */
- if (v == (struct in_addr *) 1) {
+ if (v == (void *)1) {
seq_puts(m, "ADDRESS\n");
return 0;
}
/* display one cell per line on subsequent lines */
- seq_printf(m, "%pI4\n", &addr->s_addr);
+ seq_printf(m, "%pISp\n", &addr->transport);
return 0;
}
@@ -652,7 +652,7 @@ static int afs_proc_cell_servers_show(struct seq_file *m, void *v)
{
struct afs_cell *cell = m->private;
struct afs_server *server = list_entry(v, struct afs_server, link);
- char ipaddr[20];
+ char ipaddr[64];
/* display header on line 1 */
if (v == &cell->servers) {
@@ -661,7 +661,7 @@ static int afs_proc_cell_servers_show(struct seq_file *m, void *v)
}
/* display one cell per line on subsequent lines */
- sprintf(ipaddr, "%pI4", &server->addr);
+ sprintf(ipaddr, "%pISp", &server->addr.transport);
seq_printf(m, "%3d %-15.15s %5d\n",
atomic_read(&server->usage), ipaddr, server->fs_state);
diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c
index 656ceb285b85..c108effb54be 100644
--- a/fs/afs/rxrpc.c
+++ b/fs/afs/rxrpc.c
@@ -322,10 +322,9 @@ static int afs_send_pages(struct afs_call *call, struct msghdr *msg)
/*
* initiate a call
*/
-int afs_make_call(struct in_addr *addr, struct afs_call *call, gfp_t gfp,
- bool async)
+int afs_make_call(struct sockaddr_rxrpc *srx, struct afs_call *call,
+ gfp_t gfp, bool async)
{
- struct sockaddr_rxrpc srx;
struct rxrpc_call *rxcall;
struct msghdr msg;
struct kvec iov[1];
@@ -334,7 +333,7 @@ int afs_make_call(struct in_addr *addr, struct afs_call *call, gfp_t gfp,
u32 abort_code;
int ret;
- _enter("%x,{%d},", addr->s_addr, ntohs(call->port));
+ _enter(",{%pISp},", &srx->transport);
ASSERT(call->type != NULL);
ASSERT(call->type->name != NULL);
@@ -345,15 +344,6 @@ int afs_make_call(struct in_addr *addr, struct afs_call *call, gfp_t gfp,
call->async = async;
- memset(&srx, 0, sizeof(srx));
- srx.srx_family = AF_RXRPC;
- srx.srx_service = call->service_id;
- srx.transport_type = SOCK_DGRAM;
- srx.transport_len = sizeof(srx.transport.sin);
- srx.transport.sin.sin_family = AF_INET;
- srx.transport.sin.sin_port = call->port;
- memcpy(&srx.transport.sin.sin_addr, addr, 4);
-
/* Work out the length we're going to transmit. This is awkward for
* calls such as FS.StoreData where there's an extra injection of data
* after the initial fixed part.
@@ -365,7 +355,7 @@ int afs_make_call(struct in_addr *addr, struct afs_call *call, gfp_t gfp,
}
/* create a call */
- rxcall = rxrpc_kernel_begin_call(call->net->socket, &srx, call->key,
+ rxcall = rxrpc_kernel_begin_call(call->net->socket, srx, call->key,
(unsigned long)call,
tx_total_len, gfp,
(async ?
diff --git a/fs/afs/server.c b/fs/afs/server.c
index d8044be913f0..662f7fbf5d05 100644
--- a/fs/afs/server.c
+++ b/fs/afs/server.c
@@ -11,6 +11,7 @@
#include <linux/sched.h>
#include <linux/slab.h>
+#include "afs_fs.h"
#include "internal.h"
static unsigned afs_server_timeout = 10; /* server timeout in seconds */
@@ -42,7 +43,7 @@ static int afs_install_server(struct afs_server *server)
struct afs_server *xserver;
struct afs_net *net = server->cell->net;
struct rb_node **pp, *p;
- int ret;
+ int ret, diff;
_enter("%p", server);
@@ -55,9 +56,10 @@ static int afs_install_server(struct afs_server *server)
p = *pp;
_debug("- consider %p", p);
xserver = rb_entry(p, struct afs_server, master_rb);
- if (server->addr.s_addr < xserver->addr.s_addr)
+ diff = memcmp(&server->addr, &xserver->addr, sizeof(server->addr));
+ if (diff < 0)
pp = &(*pp)->rb_left;
- else if (server->addr.s_addr > xserver->addr.s_addr)
+ else if (diff > 0)
pp = &(*pp)->rb_right;
else
goto error;
@@ -76,7 +78,7 @@ error:
* allocate a new server record
*/
static struct afs_server *afs_alloc_server(struct afs_cell *cell,
- const struct in_addr *addr)
+ const struct sockaddr_rxrpc *addr)
{
struct afs_server *server;
@@ -99,8 +101,7 @@ static struct afs_server *afs_alloc_server(struct afs_cell *cell,
INIT_DELAYED_WORK(&server->cb_break_work,
afs_dispatch_give_up_callbacks);
- memcpy(&server->addr, addr, sizeof(struct in_addr));
- server->addr.s_addr = addr->s_addr;
+ server->addr = *addr;
afs_inc_servers_outstanding(cell->net);
_leave(" = %p{%d}", server, atomic_read(&server->usage));
} else {
@@ -113,17 +114,17 @@ static struct afs_server *afs_alloc_server(struct afs_cell *cell,
* get an FS-server record for a cell
*/
struct afs_server *afs_lookup_server(struct afs_cell *cell,
- const struct in_addr *addr)
+ struct sockaddr_rxrpc *addr)
{
struct afs_server *server, *candidate;
- _enter("%p,%pI4", cell, &addr->s_addr);
+ _enter("%p,%pIS", cell, &addr->transport);
/* quick scan of the list to see if we already have the server */
read_lock(&cell->servers_lock);
list_for_each_entry(server, &cell->servers, link) {
- if (server->addr.s_addr == addr->s_addr)
+ if (memcmp(&server->addr, addr, sizeof(*addr)) == 0)
goto found_server_quickly;
}
read_unlock(&cell->servers_lock);
@@ -138,7 +139,7 @@ struct afs_server *afs_lookup_server(struct afs_cell *cell,
/* check the cell's server list again */
list_for_each_entry(server, &cell->servers, link) {
- if (server->addr.s_addr == addr->s_addr)
+ if (memcmp(&server->addr, addr, sizeof(*addr)) == 0)
goto found_server;
}
@@ -195,9 +196,9 @@ struct afs_server *afs_find_server(struct afs_net *net,
{
struct afs_server *server = NULL;
struct rb_node *p;
- struct in_addr addr = srx->transport.sin.sin_addr;
+ int diff;
- _enter("{%d,%pI4}", srx->transport.family, &addr.s_addr);
+ _enter("{%d,%pIS}", srx->transport.family, &srx->transport);
if (srx->transport.family != AF_INET) {
WARN(true, "AFS does not yes support non-IPv4 addresses\n");
@@ -212,9 +213,10 @@ struct afs_server *afs_find_server(struct afs_net *net,
_debug("- consider %p", p);
- if (addr.s_addr < server->addr.s_addr) {
+ diff = memcmp(srx, &server->addr, sizeof(*srx));
+ if (diff < 0) {
p = p->rb_left;
- } else if (addr.s_addr > server->addr.s_addr) {
+ } else if (diff > 0) {
p = p->rb_right;
} else {
afs_get_server(server);
@@ -225,7 +227,6 @@ struct afs_server *afs_find_server(struct afs_net *net,
server = NULL;
found:
read_unlock(&net->servers_lock);
- ASSERTIFCMP(server, server->addr.s_addr, ==, addr.s_addr);
_leave(" = %p", server);
return server;
}
diff --git a/fs/afs/vlclient.c b/fs/afs/vlclient.c
index f5a043a9ba61..48d137628d6a 100644
--- a/fs/afs/vlclient.c
+++ b/fs/afs/vlclient.c
@@ -12,6 +12,7 @@
#include <linux/gfp.h>
#include <linux/init.h>
#include <linux/sched.h>
+#include "afs_fs.h"
#include "internal.h"
/*
@@ -83,8 +84,15 @@ static int afs_deliver_vl_get_entry_by_xxx(struct afs_call *call)
bp++; /* type */
entry->nservers = ntohl(*bp++);
- for (loop = 0; loop < 8; loop++)
- entry->servers[loop].s_addr = *bp++;
+ for (loop = 0; loop < 8; loop++) {
+ entry->servers[loop].srx_family = AF_RXRPC;
+ entry->servers[loop].srx_service = FS_SERVICE;
+ entry->servers[loop].transport_type = SOCK_DGRAM;
+ entry->servers[loop].transport_len = sizeof(entry->servers[loop].transport.sin);
+ entry->servers[loop].transport.sin.sin_family = AF_INET;
+ entry->servers[loop].transport.sin.sin_port = htons(AFS_FS_PORT);
+ entry->servers[loop].transport.sin.sin_addr.s_addr = *bp++;
+ }
bp += 8; /* partition IDs */
@@ -144,7 +152,7 @@ static const struct afs_call_type afs_RXVLGetEntryById = {
* dispatch a get volume entry by name operation
*/
int afs_vl_get_entry_by_name(struct afs_net *net,
- struct in_addr *addr,
+ struct sockaddr_rxrpc *addr,
struct key *key,
const char *volname,
struct afs_cache_vlocation *entry,
@@ -166,8 +174,6 @@ int afs_vl_get_entry_by_name(struct afs_net *net,
call->key = key;
call->reply = entry;
- call->service_id = VL_SERVICE;
- call->port = htons(AFS_VL_PORT);
/* marshall the parameters */
bp = call->request;
@@ -185,7 +191,7 @@ int afs_vl_get_entry_by_name(struct afs_net *net,
* dispatch a get volume entry by ID operation
*/
int afs_vl_get_entry_by_id(struct afs_net *net,
- struct in_addr *addr,
+ struct sockaddr_rxrpc *addr,
struct key *key,
afs_volid_t volid,
afs_voltype_t voltype,
@@ -203,8 +209,6 @@ int afs_vl_get_entry_by_id(struct afs_net *net,
call->key = key;
call->reply = entry;
- call->service_id = VL_SERVICE;
- call->port = htons(AFS_VL_PORT);
/* marshall the parameters */
bp = call->request;
diff --git a/fs/afs/vlocation.c b/fs/afs/vlocation.c
index 745921171058..ec5ab8dc9bc8 100644
--- a/fs/afs/vlocation.c
+++ b/fs/afs/vlocation.c
@@ -30,7 +30,6 @@ static int afs_vlocation_access_vl_by_name(struct afs_vlocation *vl,
struct afs_cache_vlocation *vldb)
{
struct afs_cell *cell = vl->cell;
- struct in_addr addr;
int count, ret;
_enter("%s,%s", cell->name, vl->vldb.name);
@@ -38,12 +37,12 @@ static int afs_vlocation_access_vl_by_name(struct afs_vlocation *vl,
down_write(&vl->cell->vl_sem);
ret = -ENOMEDIUM;
for (count = cell->vl_naddrs; count > 0; count--) {
- addr = cell->vl_addrs[cell->vl_curr_svix];
+ struct sockaddr_rxrpc *addr = &cell->vl_addrs[cell->vl_curr_svix];
- _debug("CellServ[%hu]: %08x", cell->vl_curr_svix, addr.s_addr);
+ _debug("CellServ[%hu]: %pIS", cell->vl_curr_svix, &addr->transport);
/* attempt to access the VL server */
- ret = afs_vl_get_entry_by_name(cell->net, &addr, key,
+ ret = afs_vl_get_entry_by_name(cell->net, addr, key,
vl->vldb.name, vldb, false);
switch (ret) {
case 0:
@@ -88,7 +87,6 @@ static int afs_vlocation_access_vl_by_id(struct afs_vlocation *vl,
struct afs_cache_vlocation *vldb)
{
struct afs_cell *cell = vl->cell;
- struct in_addr addr;
int count, ret;
_enter("%s,%x,%d,", cell->name, volid, voltype);
@@ -96,12 +94,12 @@ static int afs_vlocation_access_vl_by_id(struct afs_vlocation *vl,
down_write(&vl->cell->vl_sem);
ret = -ENOMEDIUM;
for (count = cell->vl_naddrs; count > 0; count--) {
- addr = cell->vl_addrs[cell->vl_curr_svix];
+ struct sockaddr_rxrpc *addr = &cell->vl_addrs[cell->vl_curr_svix];
- _debug("CellServ[%hu]: %08x", cell->vl_curr_svix, addr.s_addr);
+ _debug("CellServ[%hu]: %pIS", cell->vl_curr_svix, &addr->transport);
/* attempt to access the VL server */
- ret = afs_vl_get_entry_by_id(cell->net, &addr, key, volid,
+ ret = afs_vl_get_entry_by_id(cell->net, addr, key, volid,
voltype, vldb, false);
switch (ret) {
case 0:
@@ -192,15 +190,7 @@ static int afs_vlocation_update_record(struct afs_vlocation *vl,
int ret;
/* try to look up a cached volume in the cell VL databases by ID */
- _debug("Locally Cached: %s %02x { %08x(%x) %08x(%x) %08x(%x) }",
- vl->vldb.name,
- vl->vldb.vidmask,
- ntohl(vl->vldb.servers[0].s_addr),
- vl->vldb.srvtmask[0],
- ntohl(vl->vldb.servers[1].s_addr),
- vl->vldb.srvtmask[1],
- ntohl(vl->vldb.servers[2].s_addr),
- vl->vldb.srvtmask[2]);
+ _debug("Locally Cached: %s %02x", vl->vldb.name, vl->vldb.vidmask);
_debug("Vids: %08x %08x %08x",
vl->vldb.vid[0],
@@ -258,11 +248,7 @@ static int afs_vlocation_update_record(struct afs_vlocation *vl,
static void afs_vlocation_apply_update(struct afs_vlocation *vl,
struct afs_cache_vlocation *vldb)
{
- _debug("Done VL Lookup: %s %02x { %08x(%x) %08x(%x) %08x(%x) }",
- vldb->name, vldb->vidmask,
- ntohl(vldb->servers[0].s_addr), vldb->srvtmask[0],
- ntohl(vldb->servers[1].s_addr), vldb->srvtmask[1],
- ntohl(vldb->servers[2].s_addr), vldb->srvtmask[2]);
+ _debug("Done VL Lookup: %s %02x", vldb->name, vldb->vidmask);
_debug("Vids: %08x %08x %08x",
vldb->vid[0], vldb->vid[1], vldb->vid[2]);
diff --git a/fs/afs/vnode.c b/fs/afs/vnode.c
index d5ef834ba4ac..b79d05374878 100644
--- a/fs/afs/vnode.c
+++ b/fs/afs/vnode.c
@@ -354,8 +354,8 @@ get_anyway:
if (IS_ERR(server))
goto no_server;
- _debug("USING SERVER: %p{%08x}",
- server, ntohl(server->addr.s_addr));
+ _debug("USING SERVER: %p{%pIS}",
+ server, &server->addr.transport);
ret = afs_fs_fetch_file_status(server, key, vnode, NULL,
false);
@@ -418,7 +418,7 @@ int afs_vnode_fetch_data(struct afs_vnode *vnode, struct key *key,
if (IS_ERR(server))
goto no_server;
- _debug("USING SERVER: %08x\n", ntohl(server->addr.s_addr));
+ _debug("USING SERVER: %pIS\n", &server->addr.transport);
ret = afs_fs_fetch_data(server, key, vnode, desc,
false);
@@ -474,7 +474,7 @@ int afs_vnode_create(struct afs_vnode *vnode, struct key *key,
if (IS_ERR(server))
goto no_server;
- _debug("USING SERVER: %08x\n", ntohl(server->addr.s_addr));
+ _debug("USING SERVER: %pIS\n", &server->addr.transport);
ret = afs_fs_create(server, key, vnode, name, mode, newfid,
newstatus, newcb, false);
@@ -530,7 +530,7 @@ int afs_vnode_remove(struct afs_vnode *vnode, struct key *key, const char *name,
if (IS_ERR(server))
goto no_server;
- _debug("USING SERVER: %08x\n", ntohl(server->addr.s_addr));
+ _debug("USING SERVER: %pIS\n", &server->addr.transport);
ret = afs_fs_remove(server, key, vnode, name, isdir,
false);
@@ -592,7 +592,7 @@ int afs_vnode_link(struct afs_vnode *dvnode, struct afs_vnode *vnode,
if (IS_ERR(server))
goto no_server;
- _debug("USING SERVER: %08x\n", ntohl(server->addr.s_addr));
+ _debug("USING SERVER: %pIS\n", &server->addr.transport);
ret = afs_fs_link(server, key, dvnode, vnode, name,
false);
@@ -656,7 +656,7 @@ int afs_vnode_symlink(struct afs_vnode *vnode, struct key *key,
if (IS_ERR(server))
goto no_server;
- _debug("USING SERVER: %08x\n", ntohl(server->addr.s_addr));
+ _debug("USING SERVER: %pIS\n", &server->addr.transport);
ret = afs_fs_symlink(server, key, vnode, name, content,
newfid, newstatus, false);
@@ -726,7 +726,7 @@ int afs_vnode_rename(struct afs_vnode *orig_dvnode,
if (IS_ERR(server))
goto no_server;
- _debug("USING SERVER: %08x\n", ntohl(server->addr.s_addr));
+ _debug("USING SERVER: %pIS\n", &server->addr.transport);
ret = afs_fs_rename(server, key, orig_dvnode, orig_name,
new_dvnode, new_name, false);
@@ -792,7 +792,7 @@ int afs_vnode_store_data(struct afs_writeback *wb, pgoff_t first, pgoff_t last,
if (IS_ERR(server))
goto no_server;
- _debug("USING SERVER: %08x\n", ntohl(server->addr.s_addr));
+ _debug("USING SERVER: %pIS\n", &server->addr.transport);
ret = afs_fs_store_data(server, wb, first, last, offset, to,
false);
@@ -845,7 +845,7 @@ int afs_vnode_setattr(struct afs_vnode *vnode, struct key *key,
if (IS_ERR(server))
goto no_server;
- _debug("USING SERVER: %08x\n", ntohl(server->addr.s_addr));
+ _debug("USING SERVER: %pIS\n", &server->addr.transport);
ret = afs_fs_setattr(server, key, vnode, attr, false);
@@ -892,7 +892,7 @@ int afs_vnode_get_volume_status(struct afs_vnode *vnode, struct key *key,
if (IS_ERR(server))
goto no_server;
- _debug("USING SERVER: %08x\n", ntohl(server->addr.s_addr));
+ _debug("USING SERVER: %pIS\n", &server->addr.transport);
ret = afs_fs_get_volume_status(server, key, vnode, vs, false);
@@ -931,7 +931,7 @@ int afs_vnode_set_lock(struct afs_vnode *vnode, struct key *key,
if (IS_ERR(server))
goto no_server;
- _debug("USING SERVER: %08x\n", ntohl(server->addr.s_addr));
+ _debug("USING SERVER: %pIS\n", &server->addr.transport);
ret = afs_fs_set_lock(server, key, vnode, type, false);
@@ -969,7 +969,7 @@ int afs_vnode_extend_lock(struct afs_vnode *vnode, struct key *key)
if (IS_ERR(server))
goto no_server;
- _debug("USING SERVER: %08x\n", ntohl(server->addr.s_addr));
+ _debug("USING SERVER: %pIS\n", &server->addr.transport);
ret = afs_fs_extend_lock(server, key, vnode, false);
@@ -1007,7 +1007,7 @@ int afs_vnode_release_lock(struct afs_vnode *vnode, struct key *key)
if (IS_ERR(server))
goto no_server;
- _debug("USING SERVER: %08x\n", ntohl(server->addr.s_addr));
+ _debug("USING SERVER: %pIS\n", &server->addr.transport);
ret = afs_fs_release_lock(server, key, vnode, false);
diff --git a/fs/afs/volume.c b/fs/afs/volume.c
index ccac5b1e079d..52f0dc40732b 100644
--- a/fs/afs/volume.c
+++ b/fs/afs/volume.c
@@ -248,8 +248,8 @@ struct afs_server *afs_volume_pick_fileserver(struct afs_vnode *vnode)
case 0:
afs_get_server(server);
up_read(&volume->server_sem);
- _leave(" = %p (picked %08x)",
- server, ntohl(server->addr.s_addr));
+ _leave(" = %p (picked %pIS)",
+ server, &server->addr.transport);
return server;
case -ENETUNREACH:
@@ -303,9 +303,8 @@ int afs_volume_release_fileserver(struct afs_vnode *vnode,
struct afs_volume *volume = vnode->volume;
unsigned loop;
- _enter("%s,%08x,%d",
- volume->vlocation->vldb.name, ntohl(server->addr.s_addr),
- result);
+ _enter("%s,%pIS,%d",
+ volume->vlocation->vldb.name, &server->addr.transport, result);
switch (result) {
/* success */