-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Long term plan to unify public zephyr APIs using ONE prefix #64627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
For completeness, adding some to the list:
|
From the TSC face to face meeting:
|
another option:
|
Note the emphasis on long-term in the proposal. Goal is to agree on the prefix and start migrating to it slowly, starting with new APIs being introduced in the tree, some APIs with wrong and misleading prefixes, i.e. https://github.com/zephyrproject-rtos/zephyr/blob/main/include/zephyr/sys/fdtable.h which is a public API using |
Can we also take a look at the use of |
Proposing.
|
Architecture WG:
Prefix options
|
another idea : keep |
Also worth to keep in mind that C reserves (some) identifiers starting with underscore: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf |
this is how threadx and others are using something like tx or txe, so, although ThreadX functions start with an underscore, they do not follow the exact pattern restricted by MISRA Rule 21.2. in any case, grepping the tree for z_ yields more than 5k ocurrances, this is the heavy lifti that needs to be done and that might be very disruptive. It is doable, but we will not be able to use z_ for public any time soon. Also, if we are going to use underscore (_) anyways, why not drop the z completely, i.e. now we have from a practical point of view and to be able to move in parallel on both fronts, private and public we should try and pick something other than |
Are we going to use
Just adding 1
I agree. There is way too many internal things using |
The second most popular option during the Arch. meeting vote is zep_ |
I voted, |
how? This is going to be internal to Zephyr, and whoever else is using it will probably have it internal to them, if we start thinking this way then we will never be able to integrate with anyone. Btw, and for fun, someone (supporting zephyr) already uses z_ and _z_ https://github.com/eclipse-zenoh/zenoh-pico/blob/main/include/zenoh-pico/net/subscribe.h |
We have a single namespace while linking. There is no such a thing as "internal" to Zephyr if it is linkable from other Zephyr areas. |
ok, having a distinct prefix for private/internal stuff that starts with _ might actually help with deviation from MISRA, so we could do this: option 1:
pros:
cons:
option 2:
pros:
cons:
option 3:
cons:
pros: |
zep_ does not directly relate to zephyr, phonetically speaking, where the 'p' has no meaning without the 'h'. zeph_ or zphr_, in that regard, are much better. (4 letters vs 3 is imho not an issue at all) I would go option 2, if mass-renaming can be obtained easily via coccinelle for instance. Or else, we are going to live with 2 systems for a long long time. |
I am still confused as to what is going on here. |
IMHO: 3 letters is more practical. Just try pronounce 4 letters zphr ;) |
Having a common prefix is a good practice:
|
look at the introduction in this issue and linked issues. |
I agree with this. Both phonetically and on writing, "zep" does not immediately read "zephyr-related" to me.
I like "zphr" in writing, but as pointed out by @butok it is very difficult to pronounce when talking about code.
I prefer option 2 as well. We choose one prefix for public APIs and use the same prepended with a single underscore for private APIs. |
Your mistake is thinking logic can be applied to phonetics of english words, when actually the language is all based on the spiritual vibes the combinations of the letters makes you feel. Therefore my vote on this bikeshed would be for zep_ over anything with an h. Because the abbreviations with h is making it seem like the zephyr wind is howling through around haunted mansion, while the zep is feeling like a cyberpunk airship gliding around the sky (potentially due to being the start of zeppelin, which we can rename the project to Zeppelin RTOS while we're at all this to be phonetically consistent too). This is a technical opinion based on objective facts. Source: am a monolingual English speaker. |
I did not ask for best practice advice. Which subsystem in the project does not already have its own namespace prefix? This proposal will rename all C identifiers that already have their own namespaces, e.g. to zphr_sys_le16_to_cpu, for no good reason, and will end up being a huge pain for users. |
Unrelated to the specific point that's being debated here, I think we should consider skipping the intermediate namespace for the existing "general purpose" namespaces like |
:D (way) More seriously, zeph is a classic short version of zephyr. The prefix would be kind of obvious. I am surprised it did not land in the list of possibilities. |
The majority of sys_util.h is probably the worst.
I fret the idea of such a wholesale rename, and I would only consider it acceptable if we are sure we will stop this problem once and for all. |
I like |
This is not being exactly proposed here. The proposal is: "Proposal is to pick some prefix and enforce it for all new public C identifiers, over time, (scale of years) migrate all APIs to this prefix." As discussed yesterday, the migration part after picking a prefix and using it for new identifiers is TBD and will be done on a case-per-case bais, there will be no mass prefixing of APIs.
Yes, agree. If at some point we decide we need to overhaul This proposal is not about mass migration and renames, it is a corrective measure to ensure we do not keep digging ourselves deeper in the mud.
we all like Zephyr :-) I am fine with that as well, and linguistically is probably the least controversial, its not like there are many things called Zephyr out there that might collide ;-) |
Just FYI, I've reopened a PR for count_bits using the The PR can be used to help determine the final choice, and probably shouldn't get merged until there's a conclusion here (although it can fairly easily be renamed until the next release if merged) |
(This discussion is dying again) |
@carlescufi this was on the agenda last week but we did not get to it, can we please make this first item on the agenda today? |
Architecture WG:
|
I have been thinking a bit more about this particular topic, and I have personally come to the conclusion that we should not prefix everything in Zephyr to avoid clashes with other code. Instead, I believe we should only rename those functions that are confirmed to be clashing with external implementations.
|
|
Architecture WG meeting:
The preliminary conclusions from this meeting is therefore:
|
It seems like the summary of the main idea of what you are proposing is to introduce a default prefix for any public APIs that do not fall into an area that already has a prefix. |
@carlescufi I guess this means that we still haven't settled on a prefix for util macros and functions like |
Correct, see my updated comment for more details. |
Add a new section with Zephyr-wide naming conventions, as well as a first rule for C code: area prefixes. Closes zephyrproject-rtos#64627. Signed-off-by: Carles Cufi <[email protected]>
Add a new section with Zephyr-wide naming conventions, as well as a first rule for C code: area prefixes. Closes zephyrproject-rtos#64627. Signed-off-by: Carles Cufi <[email protected]>
Architecture WG meeting: Discussion about the definition of public and private symbols: From bottom to top in terms of private vs public:
|
Uh oh!
There was an error while loading. Please reload this page.
Introduction
Our APIs are all over the place with various prefixes and legacy conventions that do not have any consistency or real meaning. We do mix internal API prefixes with public APIs in many places and some have decvided to use z_ as the prefix for public APIs in some places, adding more fuel to the fire.
Proposal is to pick some prefix and enforce it for all new public C identifiers, over time, (scale of years) migrate all APIs to this prefix.
Ideally we want to release LTS4 with a completely overhauled and consistent API using one prefix for all APIs.
Problem description
see
Proposed change
Come up with a prefix and enforce it for all new APIs and APIs that need to be changed because of conflicts and misuse of private prefixes. Possible prefixes:
zphr_
zph_
Alternatives
None
The text was updated successfully, but these errors were encountered: