Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/doxygen/groups.dox
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
@defgroup types
@defgroup string
@defgroup bitutils
@defgroup stdversion
@defgroup trap Interrupt and exception handling
*/
5 changes: 5 additions & 0 deletions docs/source/pages/api/libs/stdbigos/version.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
=======
Version
=======

.. doxygengroup:: stdversion
65 changes: 59 additions & 6 deletions docs/source/pages/bigos/general/versioning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,66 @@ Versioning
==========

:Author: Oskar Meler
:Date: 24-02-2026
:Revision: 1
:Date: 19-05-2026
:Revision: 2

All version numbers in BigOS follow the `Major.Minor.Patch` format.

* **Major** – Increment this when changes are made to existing interfaces that break backward compatibility.
Versioning Scheme
-----------------

* **Minor** – Increment this when additions or backward-compatible changes are made to the interface.
All BigOS version numbers follow the ``generation.feature.patch`` format.

* **Patch** – Increment this for bug fixes or other non-breaking corrections.
Generation
^^^^^^^^^^
Incremented when breaking changes are made to existing interfaces or formats.
A change in Generation indicates **backward-incompatible modifications**.

Feature
^^^^^^^
Incremented when new functionality is added in a backward-compatible manner.
Feature updates do not break compatibility with older versions within the same Generation.

Patch
^^^^^
Incremented for bug fixes, internal improvements, and other non-breaking changes that do not affect interface behavior or compatibility.


Data Format vs Software Version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

BigOS distinguishes between:

Client version
The version of the running BigOS implementation (the consumer).

Interface version
The version of the interface contract being consumed.

The compatibility rules define whether a given client version can correctly interact with a given interface version.


Compatibility Rule
~~~~~~~~~~~~~~~~~~

A client version ``C`` is compatible with an interface version ``I`` if and only if the following conditions are met:

- C.generation == I.generation
- C.feature ≥ I.feature

Patch versions do not affect compatibility.


Version Limits
~~~~~~~~~~~~~~

Version components are constrained as follows:

- Generation ≤ 65535
- Feature ≤ 65535
- Patch ≤ 65535


Implementation Notes
~~~~~~~~~~~~~~~~~~~~

stdbigos provides a :doc:`utility library </pages/api/libs/stdbigos/version>` for working with version values.
30 changes: 30 additions & 0 deletions include/stdbigos/version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#ifndef STDBIGOS_VERSION
#define STDBIGOS_VERSION

/// @addtogroup stdbigos
/// @{
/// @addtogroup stdversion
/// @{

#include "stdbigos/types.h"

typedef struct {
u16 generation;
u16 feature;
u16 patch;
} version_t;

typedef u64 version_packed_t;

version_t version_make(u16 generation, u16 feature, u16 patch);

version_packed_t version_pack(version_t v);
version_t version_unpack(version_packed_t v);

bool version_is_compatible(version_t current, version_t required);
bool version_packed_is_compatible(version_packed_t current, version_packed_t required);

/// @}
/// @}

#endif // !STDBIGOS_VERSION
29 changes: 29 additions & 0 deletions src/lib/stdbigos/version.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include "stdbigos/version.h"

version_t version_make(u16 generation, u16 feature, u16 patch) {
return (version_t){.generation = generation, .feature = feature, .patch = patch};
}

version_packed_t version_pack(version_t v) {
version_packed_t generation_packed = ((version_packed_t)v.generation) << 32;
version_packed_t feature_packed = ((version_packed_t)v.feature) << 16;
version_packed_t patch_packed = ((version_packed_t)v.patch);
return generation_packed | feature_packed | patch_packed;
}

version_t version_unpack(version_packed_t v) {
u16 generation = v >> 32;
u16 feature = (v >> 16);
u16 patch = v;
return (version_t){.generation = generation, .feature = feature, .patch = patch};
}

bool version_is_compatible(version_t current, version_t required) {
return current.generation == required.generation && current.feature >= required.feature;
}

bool version_packed_is_compatible(version_packed_t current, version_packed_t required) {
version_t currentu = version_unpack(current);
version_t requiredu = version_unpack(required);
return currentu.generation == requiredu.generation && currentu.feature >= requiredu.feature;
}
Loading