[pbs-devel] [PATCH v4 proxmox-backup 4/5] node: status: declutter kernel-version

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Nov 29 14:05:59 CET 2023


On Wed, Nov 29, 2023 at 01:50:00PM +0100, Gabriel Goller wrote:
> On 11/29/23 11:23, Wolfgang Bumiller wrote:
> > On Wed, Nov 29, 2023 at 10:07:45AM +0100, Gabriel Goller wrote:
> > > +#[api]
> > > +#[derive(Serialize, Deserialize, Default)]
> > > +#[serde(rename_all = "lowercase")]
> > > +/// The current kernel version (output of `uname`)
> > > +pub struct KernelVersionInformation {
> > > +    /// The systemname/nodename
> > > +    pub sysname: String,
> > > +    /// The kernel release number
> > > +    pub release: String,
> > > +    /// The kernel version
> > > +    pub version: String,
> > > +    /// The machine architecture
> > > +    pub machine: String,
> > > +}
> > > +
> > > +impl KernelVersionInformation {
> > > +    pub fn from_ostr(sysname: &OsStr, release: &OsStr, version: &OsStr, machine: &OsStr) -> Self {
> > from_ostr is a bit of a weird name for a public method taking 4
> > parameters.
> > 
> > consider a `From<&UtsName>` implementation.
> Hmm I was under the impression that we don't want to pull in any more crates
> into `pbs-api-types`...

Sorry, that was a brainfart.
For some reason I thought we had features there (and we used to have
access to sys back when UPID type was in here...).
(Same goes for my other reply)

> Another option I had was implement From<[&OsStr; 4] on
> KernelVersionInformation?

`[&OsStr; 4]` is a bit too unspecific for a From<> impl, maybe just name
it `from_uname_parts` so it's clear what exactly to put in there.




More information about the pbs-devel mailing list