Skip to content

Commit 73fb847

Browse files
Stanislav KinsburskyJ. Bruce Fields
authored andcommitted
SUNRPC: introduce cache_detail->cache_request callback
This callback will allow to simplify upcalls in further patches in this series. Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
1 parent 462b8f6 commit 73fb847

6 files changed

Lines changed: 20 additions & 8 deletions

File tree

‎fs/nfs/dns_resolve.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ static int nfs_dns_upcall(struct cache_detail *cd,
144144

145145
ret = nfs_cache_upcall(cd, key->hostname);
146146
if (ret)
147-
ret = sunrpc_cache_pipe_upcall(cd, ch, nfs_dns_request);
147+
ret = sunrpc_cache_pipe_upcall(cd, ch, cd->cache_request);
148148
return ret;
149149
}
150150

@@ -359,6 +359,7 @@ static struct cache_detail nfs_dns_resolve_template = {
359359
.name = "dns_resolve",
360360
.cache_put = nfs_dns_ent_put,
361361
.cache_upcall = nfs_dns_upcall,
362+
.cache_request = nfs_dns_request,
362363
.cache_parse = nfs_dns_parse,
363364
.cache_show = nfs_dns_show,
364365
.match = nfs_dns_match,

‎fs/nfsd/export.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static void expkey_request(struct cache_detail *cd,
6969

7070
static int expkey_upcall(struct cache_detail *cd, struct cache_head *h)
7171
{
72-
return sunrpc_cache_pipe_upcall(cd, h, expkey_request);
72+
return sunrpc_cache_pipe_upcall(cd, h, cd->cache_request);
7373
}
7474

7575
static struct svc_expkey *svc_expkey_update(struct cache_detail *cd, struct svc_expkey *new,
@@ -246,6 +246,7 @@ static struct cache_detail svc_expkey_cache_template = {
246246
.name = "nfsd.fh",
247247
.cache_put = expkey_put,
248248
.cache_upcall = expkey_upcall,
249+
.cache_request = expkey_request,
249250
.cache_parse = expkey_parse,
250251
.cache_show = expkey_show,
251252
.match = expkey_match,
@@ -340,7 +341,7 @@ static void svc_export_request(struct cache_detail *cd,
340341

341342
static int svc_export_upcall(struct cache_detail *cd, struct cache_head *h)
342343
{
343-
return sunrpc_cache_pipe_upcall(cd, h, svc_export_request);
344+
return sunrpc_cache_pipe_upcall(cd, h, cd->cache_request);
344345
}
345346

346347
static struct svc_export *svc_export_update(struct svc_export *new,
@@ -714,6 +715,7 @@ static struct cache_detail svc_export_cache_template = {
714715
.name = "nfsd.export",
715716
.cache_put = svc_export_put,
716717
.cache_upcall = svc_export_upcall,
718+
.cache_request = svc_export_request,
717719
.cache_parse = svc_export_parse,
718720
.cache_show = svc_export_show,
719721
.match = svc_export_match,

‎fs/nfsd/nfs4idmap.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ idtoname_request(struct cache_detail *cd, struct cache_head *ch, char **bpp,
142142
static int
143143
idtoname_upcall(struct cache_detail *cd, struct cache_head *ch)
144144
{
145-
return sunrpc_cache_pipe_upcall(cd, ch, idtoname_request);
145+
return sunrpc_cache_pipe_upcall(cd, ch, cd->cache_request);
146146
}
147147

148148
static int
@@ -193,6 +193,7 @@ static struct cache_detail idtoname_cache_template = {
193193
.name = "nfs4.idtoname",
194194
.cache_put = ent_put,
195195
.cache_upcall = idtoname_upcall,
196+
.cache_request = idtoname_request,
196197
.cache_parse = idtoname_parse,
197198
.cache_show = idtoname_show,
198199
.warn_no_listener = warn_no_idmapd,
@@ -323,7 +324,7 @@ nametoid_request(struct cache_detail *cd, struct cache_head *ch, char **bpp,
323324
static int
324325
nametoid_upcall(struct cache_detail *cd, struct cache_head *ch)
325326
{
326-
return sunrpc_cache_pipe_upcall(cd, ch, nametoid_request);
327+
return sunrpc_cache_pipe_upcall(cd, ch, cd->cache_request);
327328
}
328329

329330
static int
@@ -366,6 +367,7 @@ static struct cache_detail nametoid_cache_template = {
366367
.name = "nfs4.nametoid",
367368
.cache_put = ent_put,
368369
.cache_upcall = nametoid_upcall,
370+
.cache_request = nametoid_request,
369371
.cache_parse = nametoid_parse,
370372
.cache_show = nametoid_show,
371373
.warn_no_listener = warn_no_idmapd,

‎include/linux/sunrpc/cache.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ struct cache_detail {
8383
int (*cache_upcall)(struct cache_detail *,
8484
struct cache_head *);
8585

86+
void (*cache_request)(struct cache_detail *cd,
87+
struct cache_head *ch,
88+
char **bpp, int *blen);
89+
8690
int (*cache_parse)(struct cache_detail *,
8791
char *buf, int len);
8892

‎net/sunrpc/auth_gss/svcauth_gss.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static void rsi_request(struct cache_detail *cd,
184184

185185
static int rsi_upcall(struct cache_detail *cd, struct cache_head *h)
186186
{
187-
return sunrpc_cache_pipe_upcall(cd, h, rsi_request);
187+
return sunrpc_cache_pipe_upcall(cd, h, cd->cache_request);
188188
}
189189

190190

@@ -276,6 +276,7 @@ static struct cache_detail rsi_cache_template = {
276276
.name = "auth.rpcsec.init",
277277
.cache_put = rsi_put,
278278
.cache_upcall = rsi_upcall,
279+
.cache_request = rsi_request,
279280
.cache_parse = rsi_parse,
280281
.match = rsi_match,
281282
.init = rsi_init,

‎net/sunrpc/svcauth_unix.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static void ip_map_request(struct cache_detail *cd,
159159

160160
static int ip_map_upcall(struct cache_detail *cd, struct cache_head *h)
161161
{
162-
return sunrpc_cache_pipe_upcall(cd, h, ip_map_request);
162+
return sunrpc_cache_pipe_upcall(cd, h, cd->cache_request);
163163
}
164164

165165
static struct ip_map *__ip_map_lookup(struct cache_detail *cd, char *class, struct in6_addr *addr);
@@ -472,7 +472,7 @@ static void unix_gid_request(struct cache_detail *cd,
472472

473473
static int unix_gid_upcall(struct cache_detail *cd, struct cache_head *h)
474474
{
475-
return sunrpc_cache_pipe_upcall(cd, h, unix_gid_request);
475+
return sunrpc_cache_pipe_upcall(cd, h, cd->cache_request);
476476
}
477477

478478
static struct unix_gid *unix_gid_lookup(struct cache_detail *cd, uid_t uid);
@@ -578,6 +578,7 @@ static struct cache_detail unix_gid_cache_template = {
578578
.name = "auth.unix.gid",
579579
.cache_put = unix_gid_put,
580580
.cache_upcall = unix_gid_upcall,
581+
.cache_request = unix_gid_request,
581582
.cache_parse = unix_gid_parse,
582583
.cache_show = unix_gid_show,
583584
.match = unix_gid_match,
@@ -875,6 +876,7 @@ static struct cache_detail ip_map_cache_template = {
875876
.name = "auth.unix.ip",
876877
.cache_put = ip_map_put,
877878
.cache_upcall = ip_map_upcall,
879+
.cache_request = ip_map_request,
878880
.cache_parse = ip_map_parse,
879881
.cache_show = ip_map_show,
880882
.match = ip_map_match,

0 commit comments

Comments
 (0)