Lines Matching refs:idmap
64 struct idmap *idmap; member
67 struct idmap { struct
75 static struct user_namespace *idmap_userns(const struct idmap *idmap) in idmap_userns() argument
77 if (idmap && idmap->cred) in idmap_userns()
78 return idmap->cred->user_ns; in idmap_userns()
279 const char *type, struct idmap *idmap) in nfs_idmap_request_key() argument
289 if (!idmap->cred || idmap->cred->user_ns == &init_user_ns) in nfs_idmap_request_key()
292 mutex_lock(&idmap->idmap_mutex); in nfs_idmap_request_key()
294 desc, NULL, "", 0, idmap); in nfs_idmap_request_key()
295 mutex_unlock(&idmap->idmap_mutex); in nfs_idmap_request_key()
306 size_t data_size, struct idmap *idmap) in nfs_idmap_get_key() argument
314 rkey = nfs_idmap_request_key(name, namelen, type, idmap); in nfs_idmap_get_key()
350 size_t buflen, struct idmap *idmap) in nfs_idmap_lookup_name() argument
357 ret = nfs_idmap_get_key(id_str, id_len, type, buf, buflen, idmap); in nfs_idmap_lookup_name()
365 __u32 *id, struct idmap *idmap) in nfs_idmap_lookup_id() argument
372 data_size = nfs_idmap_get_key(name, namelen, type, id_str, NFS_UINT_MAXLEN, idmap); in nfs_idmap_lookup_id()
425 struct idmap *idmap = pdo->pdo_data; in nfs_idmap_pipe_destroy() local
426 struct rpc_pipe *pipe = idmap->idmap_pipe; in nfs_idmap_pipe_destroy()
437 struct idmap *idmap = pdo->pdo_data; in nfs_idmap_pipe_create() local
438 struct rpc_pipe *pipe = idmap->idmap_pipe; in nfs_idmap_pipe_create()
441 dentry = rpc_mkpipe_dentry(dir, "idmap", idmap, pipe); in nfs_idmap_pipe_create()
456 struct idmap *idmap; in nfs_idmap_new() local
460 idmap = kzalloc(sizeof(*idmap), GFP_KERNEL); in nfs_idmap_new()
461 if (idmap == NULL) in nfs_idmap_new()
464 mutex_init(&idmap->idmap_mutex); in nfs_idmap_new()
465 idmap->cred = get_cred(clp->cl_rpcclient->cl_cred); in nfs_idmap_new()
467 rpc_init_pipe_dir_object(&idmap->idmap_pdo, in nfs_idmap_new()
469 idmap); in nfs_idmap_new()
476 idmap->idmap_pipe = pipe; in nfs_idmap_new()
480 &idmap->idmap_pdo); in nfs_idmap_new()
484 clp->cl_idmap = idmap; in nfs_idmap_new()
487 rpc_destroy_pipe_data(idmap->idmap_pipe); in nfs_idmap_new()
489 put_cred(idmap->cred); in nfs_idmap_new()
490 kfree(idmap); in nfs_idmap_new()
497 struct idmap *idmap = clp->cl_idmap; in nfs_idmap_delete() local
499 if (!idmap) in nfs_idmap_delete()
504 &idmap->idmap_pdo); in nfs_idmap_delete()
505 rpc_destroy_pipe_data(idmap->idmap_pipe); in nfs_idmap_delete()
506 put_cred(idmap->cred); in nfs_idmap_delete()
507 kfree(idmap); in nfs_idmap_delete()
510 static int nfs_idmap_prepare_message(char *desc, struct idmap *idmap, in nfs_idmap_prepare_message() argument
552 nfs_idmap_prepare_pipe_upcall(struct idmap *idmap, in nfs_idmap_prepare_pipe_upcall() argument
555 if (idmap->idmap_upcall_data != NULL) { in nfs_idmap_prepare_pipe_upcall()
559 idmap->idmap_upcall_data = data; in nfs_idmap_prepare_pipe_upcall()
564 nfs_idmap_complete_pipe_upcall_locked(struct idmap *idmap, int ret) in nfs_idmap_complete_pipe_upcall_locked() argument
566 struct key *authkey = idmap->idmap_upcall_data->authkey; in nfs_idmap_complete_pipe_upcall_locked()
568 kfree(idmap->idmap_upcall_data); in nfs_idmap_complete_pipe_upcall_locked()
569 idmap->idmap_upcall_data = NULL; in nfs_idmap_complete_pipe_upcall_locked()
575 nfs_idmap_abort_pipe_upcall(struct idmap *idmap, int ret) in nfs_idmap_abort_pipe_upcall() argument
577 if (idmap->idmap_upcall_data != NULL) in nfs_idmap_abort_pipe_upcall()
578 nfs_idmap_complete_pipe_upcall_locked(idmap, ret); in nfs_idmap_abort_pipe_upcall()
587 struct idmap *idmap = (struct idmap *)aux; in nfs_idmap_legacy_upcall() local
602 data->idmap = idmap; in nfs_idmap_legacy_upcall()
605 ret = nfs_idmap_prepare_message(key->description, idmap, im, msg); in nfs_idmap_legacy_upcall()
610 if (!nfs_idmap_prepare_pipe_upcall(idmap, data)) in nfs_idmap_legacy_upcall()
613 ret = rpc_queue_upcall(idmap->idmap_pipe, msg); in nfs_idmap_legacy_upcall()
615 nfs_idmap_abort_pipe_upcall(idmap, ret); in nfs_idmap_legacy_upcall()
670 struct idmap *idmap = (struct idmap *)rpci->private; in idmap_pipe_downcall() local
680 if (idmap->idmap_upcall_data == NULL) in idmap_pipe_downcall()
683 authkey = idmap->idmap_upcall_data->authkey; in idmap_pipe_downcall()
708 &idmap->idmap_upcall_data->idmap_msg, in idmap_pipe_downcall()
716 nfs_idmap_complete_pipe_upcall_locked(idmap, ret); in idmap_pipe_downcall()
727 struct idmap *idmap = data->idmap; in idmap_pipe_destroy_msg() local
730 nfs_idmap_abort_pipe_upcall(idmap, msg->errno); in idmap_pipe_destroy_msg()
737 struct idmap *idmap = (struct idmap *)rpci->private; in idmap_release_pipe() local
739 nfs_idmap_abort_pipe_upcall(idmap, -EPIPE); in idmap_release_pipe()
744 struct idmap *idmap = server->nfs_client->cl_idmap; in nfs_map_name_to_uid() local
749 ret = nfs_idmap_lookup_id(name, namelen, "uid", &id, idmap); in nfs_map_name_to_uid()
751 *uid = make_kuid(idmap_userns(idmap), id); in nfs_map_name_to_uid()
761 struct idmap *idmap = server->nfs_client->cl_idmap; in nfs_map_group_to_gid() local
766 ret = nfs_idmap_lookup_id(name, namelen, "gid", &id, idmap); in nfs_map_group_to_gid()
768 *gid = make_kgid(idmap_userns(idmap), id); in nfs_map_group_to_gid()
778 struct idmap *idmap = server->nfs_client->cl_idmap; in nfs_map_uid_to_name() local
782 id = from_kuid_munged(idmap_userns(idmap), uid); in nfs_map_uid_to_name()
784 ret = nfs_idmap_lookup_name(id, "user", buf, buflen, idmap); in nfs_map_uid_to_name()
792 struct idmap *idmap = server->nfs_client->cl_idmap; in nfs_map_gid_to_group() local
796 id = from_kgid_munged(idmap_userns(idmap), gid); in nfs_map_gid_to_group()
798 ret = nfs_idmap_lookup_name(id, "group", buf, buflen, idmap); in nfs_map_gid_to_group()