9 #ifdef CONFIG_NFS_USE_KERNEL_DNS
11 #include <linux/module.h>
25 ret =
rpc_pton(net, ip_addr, ip_len, sa, salen);
35 #include <linux/module.h>
36 #include <linux/hash.h>
37 #include <linux/string.h>
39 #include <linux/slab.h>
40 #include <linux/module.h>
41 #include <linux/socket.h>
53 #define NFS_DNS_HASHBITS 4
54 #define NFS_DNS_HASHTBL_SIZE (1 << NFS_DNS_HASHBITS)
67 static void nfs_dns_ent_update(
struct cache_head *cnew,
80 static void nfs_dns_ent_init(
struct cache_head *cnew,
93 nfs_dns_ent_update(cnew, ckey);
100 static void nfs_dns_ent_put(
struct kref *ref)
109 static struct cache_head *nfs_dns_ent_alloc(
void)
122 static unsigned int nfs_dns_hash(
const struct nfs_dns_ent *key)
129 char **
bpp,
int *blen)
170 seq_puts(m,
"# ip address hostname ttl\n");
174 ttl = item->
h.expiry_time - seconds_since_boot();
224 if (buf[buflen-1] !=
'\n')
226 buf[buflen-1] =
'\0';
228 len =
qword_get(&buf, buf1,
sizeof(buf1));
235 len =
qword_get(&buf, buf1,
sizeof(buf1));
243 if (get_uint(&buf, &ttl) < 0)
247 key.
h.expiry_time = ttl + seconds_since_boot();
250 item = nfs_dns_lookup(cd, &key);
257 item = nfs_dns_update(cd, &key, item);
262 cache_put(&item->
h, cd);
274 *item = nfs_dns_lookup(cd, key);
283 static int do_cache_lookup_nowait(
struct cache_detail *cd,
289 *item = nfs_dns_lookup(cd, key);
294 || (*item)->h.expiry_time < seconds_since_boot()
302 cache_put(&(*item)->h, cd);
308 static int do_cache_lookup_wait(
struct cache_detail *cd,
318 ret = do_cache_lookup(cd, key, item, dreq);
322 ret = do_cache_lookup_nowait(cd, key, item);
330 size_t namelen,
struct sockaddr *sa,
size_t salen)
348 }
else if (ret == -
ENOENT)
373 cd->
name =
"dns_resolve",
378 cd->
match = nfs_dns_match,
379 cd->
init = nfs_dns_ent_init,
380 cd->
update = nfs_dns_ent_update,
381 cd->
alloc = nfs_dns_ent_alloc,
426 case RPC_PIPEFS_MOUNT:
429 case RPC_PIPEFS_UMOUNT:
441 .notifier_call = rpc_pipefs_event,