Issue
It's a random and stupid question, but I have no clue what the i stands for in structs with members like:
[starting character]i_[some specifier]
Examples are like: bio struct, everytime dm_target is referenced, bvec_iter.
Whenever I read such a variable I read the complete name in my head, and it's very frustrating to me that I can't do it with these.
Solution
There no meaning in i_
, it's not special.
A loooong time ago structure members shared the same namespace as variables and such, they had to be unique - some people are used to that. And it is subjectively nice to have structure members starting with a unique prefix - IDE autocompletion works better, and it's easier to do lookup.
In the case of struct bio
members, bi_
is just a shortcut for... bio_
.
In the case of struct dm_target *ti
variable name, ti
looks like a nice shorter form of this
used in C++ and Python for referencing the current object.
In the case of struct bvec_iter
, bi_
is just a shorthand of bvec_iter
. Above, you have struct bio_vec
that uses bv_
for struct members.
These are just conventions that a specific developer used to mark some abstractions in their source code. It has no specific meaning.
It's also easier to look sometimes - when I see iter->bi_stuff
, I can "suspect" that iter
is a pointer to something bi
related (bio
? bvec_iter
?). In the context of many, many variables, such small clues are nice for the eye.
This all is subjective. It is way more important to follow one convention, rather that what convention it is.
Answered By - KamilCuk Answer Checked By - David Goodson (WPSolving Volunteer)