Lines Matching full:id

24 we're talking about an id in the upper or lower idmapset.
58 and id ``k11000`` which has been generated by the first idmapping by mapping
62 what id ``k11000`` corresponds to in the second or third idmapping. The
79 an id mapped. We can simply say that ``u1000`` is unmapped in the second and
83 The algorithm to calculate what a given id maps to is pretty simple. First, we
84 need to verify that the range can contain our target id. We will skip this step
85 for simplicity. After that if we want to know what ``id`` maps to we can do
91 id - u + k = n
96 id - k + u = n
108 want to know what id this was mapped from in the upper idmapset of the first
111 id - k + u = n
114 Now assume we are given the id ``u1100`` in the upper idmapset of the second
115 idmapping and we want to know what this id maps down to in the lower idmapset
119 id - u + k = n
128 userspace-id:kernel-id:range
130 A userspace id is always an element in the upper idmapset of an idmapping of
131 type ``uid_t`` or ``gid_t`` and a kernel id is always an element in the lower
133 "userspace id" will be used to refer to the well known ``uid_t`` and ``gid_t``
134 types and "kernel id" will be used to refer to ``kuid_t`` and ``kgid_t``.
138 A userspace id on the other hand is an id that is reported to userspace by the
139 kernel, or is passed by userspace to the kernel, or a raw device id that is
149 For example, the id ``u1000`` is an id in the upper idmapset or "userspace
151 kernel id in the lower idmapset or "kernel idmapset" starting with ``k10000``.
153 A kernel id is always created by an idmapping. Such idmappings are associated
172 ownership of a file is read from disk by a filesystem, the userspace id is
173 immediately translated into a kernel id according to the idmapping associated
181 simply the identity idmapping. This would mean id ``u1000`` read from disk
182 would be mapped to id ``k1000``. So an inode's ``i_uid`` and ``i_gid`` field
202 If we've been given ``k11000`` from one idmapping we can map that id up in
204 the same kernel id in their kernel idmapsets. For example, consider the
211 then translate ``k11000`` into a userspace id in the second idmapping using the
214 /* Map the kernel id up into a userspace id in the second idmapping. */
217 Note, how we can get back to the kernel id in the first idmapping by inverting
220 /* Map the userspace id down into a kernel id in the second idmapping. */
223 /* Map the kernel id up into a userspace id in the first idmapping. */
226 This algorithm allows us to answer the question what userspace id a given
227 kernel id corresponds to in a given idmapping. In order to be able to answer
228 this question both idmappings need to contain the same kernel id in their
231 For example, when the kernel reads a raw userspace id from disk it maps it down
232 into a kernel id according to the idmapping associated with the filesystem.
239 ownership information about the file the kernel can't simply map the id back up
243 So the kernel will map the id back up in the idmapping of the caller. Let's
251 It is possible to translate a kernel id from one idmapping to another one via
253 a kernel id.
261 kernel id in the first idmapping into a kernel id in the second idmapping we
264 1. Map the kernel id up into a userspace id in the first idmapping::
266 /* Map the kernel id up into a userspace id in the first idmapping. */
269 2. Map the userspace id down into a kernel id in the second idmapping::
271 /* Map the userspace id down into a kernel id in the second idmapping. */
275 the kernel id in one idmapping to a kernel id in another idmapping.
277 This allows us to answer the question what kernel id we would need to use to
278 get the same userspace id in another idmapping. In order to be able to answer
279 this question both idmappings need to contain the same userspace id in their
282 Note, how we can easily get back to the kernel id in the first idmapping by
285 1. Map the kernel id up into a userspace id in the second idmapping::
287 /* Map the kernel id up into a userspace id in the second idmapping. */
290 2. Map the userspace id down into a kernel id in the first idmapping::
292 /* Map the userspace id down into a kernel id in the first idmapping. */
297 userspace id mapped. This will come in handy when working with idmapped mounts.
302 It is never valid to use an id in the kernel idmapset of one idmapping as the
303 id in the userspace idmapset of another or the same idmapping. While the kernel
304 idmapset always indicates an idmapset in the kernel id space the userspace
305 idmapset indicates a userspace id. So the following translations are forbidden::
307 /* Map the userspace id down into a kernel id in the first idmapping. */
310 /* INVALID: Map the kernel id down into a kernel id in the second idmapping. */
316 /* Map the kernel id up into a userspace id in the first idmapping. */
319 /* INVALID: Map the userspace id up into a userspace id in the second idmapping. */
326 The concepts of mapping an id down or mapping an id up are expressed in the two
330 /* Map the userspace id down into a kernel id. */
333 /* Map the kernel id up into a userspace id. */
361 the kernel id back up into a userspace id when writing to disk.
362 So with the second step the kernel guarantees that a valid userspace id can be
368 kernel maps the caller's userspace id down into a kernel id according to the
369 caller's idmapping and then maps that kernel id up according to the
377 caller id: u1000
397 on. Ultimately the userspace id that lands on disk will be ``u1000``.
404 caller id: u1000
418 It's immediately clear that while the caller's userspace id could be
432 caller id: u1000
446 We can see that the translation always succeeds. The userspace id that the
448 the kernel id that was created in the caller's idmapping. This has mainly two
452 userspace id. We could only do this if we were to mount the whole fileystem
474 file id: u1000
481 1. Map the userspace id on disk down into a kernel id in the filesystem's
486 2. Map the kernel id up into a userspace id in the caller's idmapping::
490 The crossmapping algorithm fails in this case because the kernel id in the
491 filesystem idmapping cannot be mapped up to a userspace id in the caller's
500 file id: u1000
507 1. Map the userspace id on disk down into a kernel id in the filesystem's
512 2. Map the kernel id up into a userspace id in the caller's idmapping::
516 Again, the crossmapping algorithm fails in this case because the kernel id in
517 the filesystem idmapping cannot be mapped to a userspace id in the caller's
526 1. Map the userspace id on disk down into a kernel id in the filesystem's
531 2. Map the kernel id up into a userspace id in the caller's idmapping::
552 dir id: u0
553 dir/file1 id: u1000
554 dir/file2 id: u2000
564 dir id: u10000
565 dir/file1 id: u11000
566 dir/file2 id: u12000
575 different login userspace ids. Most users will have ``u1000`` as the login id
577 owned by ``u1000``. At uni or at work they may have another login id such as
633 /* Map the filesystem's kernel id up into a userspace id in the filesystem's idmapping. */
636 /* Map the filesystem's userspace id down ito a kernel id in the mount's idmapping. */
641 The ``mapped_fs*id()`` functions translate the caller's kernel ids into
645 /* Map the caller's kernel id up into a userspace id in the mount's idmapping. */
648 /* Map the mount's userspace id down into a kernel id in the filesystem's idmapping. */
658 Assume a file owned by ``u1000`` is read from disk. The filesystem maps this id
664 kernel id up to a userspace id in the caller's idmapping.
667 first call ``i_uid_into_mnt()`` thereby translating the filesystem's kernel id
668 into a kernel id in the mount's idmapping::
671 /* Map the filesystem's kernel id up into a userspace id. */
674 /* Map the filesystem's userspace id down ito a kernel id in the mount's idmapping. */
678 kernel id in the mount's idmapping into a userspace id in the caller's
688 mapped to a userspace id in the filesystem's idmapping. Since ``k11000`` can't
693 first call ``mapped_fs*id()`` thereby translating the caller's kernel id into
694 a kernel id according to the mount's idmapping::
697 /* Map the caller's kernel id up into a userspace id in the mount's idmapping. */
700 /* Map the mount's userspace id down into a kernel id in the filesystem's idmapping. */
704 userspace id in the filesystem's idmapping::
720 caller id: u1000
732 2. Translate the caller's kernel id into a kernel id in the filesystem's
736 /* Map the kernel id up into a userspace id in the mount's idmapping. */
739 /* Map the userspace id down into a kernel id in the filesystem's idmapping. */
754 caller id: u1000
765 2. Translate the caller's kernel id into a kernel id in the filesystem's
769 /* Map the kernel id up into a userspace id in the mount's idmapping. */
772 /* Map the userspace id down into a kernel id in the filesystem's idmapping. */
787 file id: u1000
795 1. Map the userspace id on disk down into a kernel id in the filesystem's
800 2. Translate the kernel id into a kernel id in the mount's idmapping::
803 /* Map the kernel id up into a userspace id in the filesystem's idmapping. */
806 /* Map the userspace id down into a kernel id in the mounts's idmapping. */
809 3. Map the kernel id up into a userspace id in the caller's idmapping::
813 Earlier, the caller's kernel id couldn't be crossmapped in the filesystems's
823 file id: u1000
831 1. Map the userspace id on disk down into a kernel id in the filesystem's
836 2. Translate the kernel id into a kernel id in the mount's idmapping::
839 /* Map the kernel id up into a userspace id in the filesystem's idmapping. */
842 /* Map the userspace id down into a kernel id in the mounts's idmapping. */
845 3. Map the kernel id up into a userspace id in the caller's idmapping::
849 Earlier, the file's kernel id couldn't be crossmapped in the filesystems's
875 storage. At home they have id ``u1000`` and all files in their home directory
876 are owned by ``u1000`` whereas at uni or work they have login id ``u1125``.
894 caller id: u1125
903 2. Translate the caller's kernel id into a kernel id in the filesystem's
907 /* Map the kernel id up into a userspace id in the mount's idmapping. */
910 /* Map the userspace id down into a kernel id in the filesystem's idmapping. */
920 Now let's briefly look at what ownership the caller with id ``u1125`` will see
925 file id: u1000
930 1. Map the userspace id on disk down into a kernel id in the filesystem's
935 2. Translate the kernel id into a kernel id in the mount's idmapping::
938 /* Map the kernel id up into a userspace id in the filesystem's idmapping. */
941 /* Map the userspace id down into a kernel id in the mounts's idmapping. */
944 3. Map the kernel id up into a userspace id in the caller's idmapping::
949 which is the caller's userspace id on their workstation in our example.
951 The raw userspace id that is put on disk is ``u1000`` so when the user takes
979 2. The translation algorithms in ``mapped_fs*id()`` and ``i_*id_into_mnt()``
982 Let's consider ``mapped_fs*id()`` first. This function translates the
983 caller's kernel id into a kernel id in the filesystem's idmapping via
987 /* Map the kernel id up into a userspace id in the mount's idmapping. */
990 /* Map the userspace id down into a kernel id in the filesystem's idmapping. */
997 /* Map the kernel id up into a userspace id in the mount's idmapping. */
1000 /* Map the userspace id down into a kernel id in the filesystem's idmapping. */
1004 id into a mount's kernel id::
1007 /* Map the kernel id up into a userspace id in the filesystem's idmapping. */
1010 /* Map the userspace id down into a kernel id in the mounts's idmapping. */
1018 /* Map the kernel id up into a userspace id in the filesystem's idmapping. */
1021 /* Map the userspace id down into a kernel id in the mounts's idmapping. */