mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-13 16:06:59 +02:00
sys-apps/nvme-cli: Sync with Gentoo
It's from Gentoo commit 70e9330e284f7692f95de81f1ed3379e570f799a.
This commit is contained in:
parent
5e2287973d
commit
b8300a7281
@ -1,2 +1,3 @@
|
||||
DIST nvme-cli-2.7.1.gh.tar.gz 902081 BLAKE2B 7d14838f7f0fd6d1ab1cb30041f862fe2db6f40fe72c13cb4ce227831cac6e141ff5cec2924c846f30629188754b0ce0630ad9009d2a490c193da20e8b8a45d1 SHA512 6a9f3574dfd4375e6f7a76ed95f698efb26da5b72a490579caeba9d46c4811ae31650844e0a0e1047dc627158d5ffbdc020112a5059d3195e7eadff902b70b19
|
||||
DIST nvme-cli-2.8.gh.tar.gz 910994 BLAKE2B c231fc087219622736bdc400c83d2a320670f247f77b53f0cad20c8117e620703badba7cd9a6f267ba79223be9c0d6710c2be968683f77fe72e45957e0c8b899 SHA512 1be0bed4e1bf8a25229f301c2b00b78d2de4eaf8ff2b815fa75e44dd35ddd7787604152bdf00696130df3281206a734c5f408c3f2127440e05c2e4b1cdbb79d4
|
||||
DIST nvme-cli-2.9.1.gh.tar.gz 932210 BLAKE2B 865808c17f2098f8d0be8ba928869801023f77f0ffd44b5d2424b9f75e01180f8d1990684e3e4a79363e650a44e58abe213b5ab55328f0bde9ed699eba9a215c SHA512 c9c86e7567c2d4c59aff1eb9d18f4775923db3c81a89c628b819121c32150d4bc2d65d0dacac764c64594369890b380d0fd06bc7c1f83f4a7f3e71a51a6fee24
|
||||
|
@ -0,0 +1,107 @@
|
||||
https://github.com/linux-nvme/nvme-cli/pull/2332
|
||||
|
||||
From 61bbd959bc069e4552e50a276b8a0e1487545ec2 Mon Sep 17 00:00:00 2001
|
||||
From: Sam James <sam@gentoo.org>
|
||||
Date: Sat, 4 May 2024 09:13:06 +0100
|
||||
Subject: [PATCH 1/2] Use C99 types for uint32_t
|
||||
|
||||
<stdint.h> provides `uint32_t`, while `u_int_32` is an unofficial/internal
|
||||
typedef that glibc happens to provide. This fixes the build on musl.
|
||||
|
||||
Bug: https://bugs.gentoo.org/931194
|
||||
Signed-off-by: Sam James <sam@gentoo.org>
|
||||
--- a/nvme.c
|
||||
+++ b/nvme.c
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <locale.h>
|
||||
#include <stdio.h>
|
||||
+#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
@@ -9075,8 +9076,8 @@ static int check_dhchap_key(int argc, char **argv, struct command *command, stru
|
||||
|
||||
unsigned char decoded_key[128];
|
||||
unsigned int decoded_len;
|
||||
- u_int32_t crc = crc32(0L, NULL, 0);
|
||||
- u_int32_t key_crc;
|
||||
+ uint32_t crc = crc32(0L, NULL, 0);
|
||||
+ uint32_t key_crc;
|
||||
int err = 0, hmac;
|
||||
struct config {
|
||||
char *key;
|
||||
@@ -9144,10 +9145,10 @@ static int check_dhchap_key(int argc, char **argv, struct command *command, stru
|
||||
return -EINVAL;
|
||||
}
|
||||
crc = crc32(crc, decoded_key, decoded_len);
|
||||
- key_crc = ((u_int32_t)decoded_key[decoded_len]) |
|
||||
- ((u_int32_t)decoded_key[decoded_len + 1] << 8) |
|
||||
- ((u_int32_t)decoded_key[decoded_len + 2] << 16) |
|
||||
- ((u_int32_t)decoded_key[decoded_len + 3] << 24);
|
||||
+ key_crc = ((uint32_t)decoded_key[decoded_len]) |
|
||||
+ ((uint32_t)decoded_key[decoded_len + 1] << 8) |
|
||||
+ ((uint32_t)decoded_key[decoded_len + 2] << 16) |
|
||||
+ ((uint32_t)decoded_key[decoded_len + 3] << 24);
|
||||
if (key_crc != crc) {
|
||||
nvme_show_error("CRC mismatch (key %08x, crc %08x)", key_crc, crc);
|
||||
return -EINVAL;
|
||||
--- a/util/base64.c
|
||||
+++ b/util/base64.c
|
||||
@@ -20,6 +20,7 @@
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
+#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
@@ -42,7 +43,7 @@ static const char base64_table[65] =
|
||||
int base64_encode(const unsigned char *src, int srclen, char *dst)
|
||||
{
|
||||
int i, bits = 0;
|
||||
- u_int32_t ac = 0;
|
||||
+ uint32_t ac = 0;
|
||||
char *cp = dst;
|
||||
|
||||
for (i = 0; i < srclen; i++) {
|
||||
@@ -77,7 +78,7 @@ int base64_encode(const unsigned char *src, int srclen, char *dst)
|
||||
*/
|
||||
int base64_decode(const char *src, int srclen, unsigned char *dst)
|
||||
{
|
||||
- u_int32_t ac = 0;
|
||||
+ uint32_t ac = 0;
|
||||
int i, bits = 0;
|
||||
unsigned char *bp = dst;
|
||||
|
||||
|
||||
From 51208e30da0bfb12340d3a4f3afa0472312a8541 Mon Sep 17 00:00:00 2001
|
||||
From: Sam James <sam@gentoo.org>
|
||||
Date: Sat, 4 May 2024 09:15:03 +0100
|
||||
Subject: [PATCH 2/2] `u_char` -> `unsigned char`
|
||||
|
||||
`u_char` is not a standard name for `unsigned char` and may not work;
|
||||
some implementations may provide it for convenience.
|
||||
|
||||
Signed-off-by: Sam James <sam@gentoo.org>
|
||||
--- a/plugins/innogrit/typedef.h
|
||||
+++ b/plugins/innogrit/typedef.h
|
||||
@@ -53,14 +53,14 @@ struct vsc_smart_log {
|
||||
unsigned int low_pwr_cnt;
|
||||
unsigned int wa;
|
||||
unsigned int ps3_entry_cnt;
|
||||
- u_char highest_temp[4];
|
||||
+ unsigned char highest_temp[4];
|
||||
unsigned int weight_ec;
|
||||
unsigned int slc_cap_mb;
|
||||
unsigned long long nand_page_write_cnt;
|
||||
unsigned int program_error_cnt;
|
||||
unsigned int erase_error_cnt;
|
||||
- u_char flash_type;
|
||||
- u_char reserved2[3];
|
||||
+ unsigned char flash_type;
|
||||
+ unsigned char reserved2[3];
|
||||
unsigned int hs_crc_err_cnt;
|
||||
unsigned int ddr_ecc_err_cnt;
|
||||
unsigned int reserved3[44];
|
||||
|
28
sdk_container/src/third_party/portage-stable/sys-apps/nvme-cli/files/nvme-cli-2.9.1-musl.patch
vendored
Normal file
28
sdk_container/src/third_party/portage-stable/sys-apps/nvme-cli/files/nvme-cli-2.9.1-musl.patch
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
https://bugs.gentoo.org/934081
|
||||
https://github.com/linux-nvme/nvme-cli/commit/650070ad5d4a97fc87f9018743e3b566deba36c8
|
||||
|
||||
From 650070ad5d4a97fc87f9018743e3b566deba36c8 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Tue, 21 May 2024 14:09:32 -0700
|
||||
Subject: [PATCH] plugins/ssstc: Replace __uint16_t with uint16_t
|
||||
|
||||
uint16_t is ISO defined and comes from stdint.h, makes it
|
||||
portable across glibc and musl on linux.
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
--- a/plugins/ssstc/ssstc-nvme.c
|
||||
+++ b/plugins/ssstc/ssstc-nvme.c
|
||||
@@ -64,9 +64,9 @@ void show_ssstc_add_smart_log_jsn(struct nvme_additional_smart_log *smart,
|
||||
unsigned int nsid, const char *devname)
|
||||
{
|
||||
struct json_object *root, *entry_stats, *dev_stats, *multi;
|
||||
- __uint16_t wear_level_min = 0;
|
||||
- __uint16_t wear_level_max = 0;
|
||||
- __uint16_t wear_level_avg = 0;
|
||||
+ uint16_t wear_level_min = 0;
|
||||
+ uint16_t wear_level_max = 0;
|
||||
+ uint16_t wear_level_avg = 0;
|
||||
uint64_t raw_val = 0;
|
||||
|
||||
root = json_create_object();
|
||||
|
@ -11,7 +11,7 @@ SRC_URI="https://github.com/linux-nvme/nvme-cli/archive/v${PV}.tar.gz -> ${P}.gh
|
||||
|
||||
LICENSE="GPL-2 GPL-2+"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 ~arm64 ~loong ~ppc64 ~riscv ~sparc x86"
|
||||
KEYWORDS="amd64 arm64 ~loong ~ppc64 ~riscv ~sparc x86"
|
||||
IUSE="+json"
|
||||
|
||||
RDEPEND="
|
||||
|
53
sdk_container/src/third_party/portage-stable/sys-apps/nvme-cli/nvme-cli-2.9.1.ebuild
vendored
Normal file
53
sdk_container/src/third_party/portage-stable/sys-apps/nvme-cli/nvme-cli-2.9.1.ebuild
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
# Copyright 1999-2024 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit meson systemd udev
|
||||
|
||||
DESCRIPTION="NVM-Express user space tooling for Linux"
|
||||
HOMEPAGE="https://github.com/linux-nvme/nvme-cli"
|
||||
SRC_URI="https://github.com/linux-nvme/nvme-cli/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz"
|
||||
|
||||
LICENSE="GPL-2 GPL-2+"
|
||||
SLOT="0"
|
||||
KEYWORDS="amd64 ~arm64 ~loong ~ppc64 ~riscv ~sparc x86"
|
||||
IUSE="+json"
|
||||
|
||||
RDEPEND="
|
||||
>=sys-libs/libnvme-1.9:=[json?]
|
||||
json? ( dev-libs/json-c:= )
|
||||
sys-libs/zlib:=
|
||||
"
|
||||
DEPEND="
|
||||
${RDEPEND}
|
||||
virtual/os-headers
|
||||
"
|
||||
BDEPEND="
|
||||
virtual/pkgconfig
|
||||
"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${PN}-2.9.1-musl-stdint.patch
|
||||
"${FILESDIR}"/${PN}-2.9.1-musl.patch
|
||||
)
|
||||
|
||||
src_configure() {
|
||||
local emesonargs=(
|
||||
-Dversion-tag="${PV}"
|
||||
-Ddocs=all
|
||||
-Dhtmldir="${EPREFIX}/usr/share/doc/${PF}/html"
|
||||
-Dsystemddir="$(systemd_get_systemunitdir)"
|
||||
-Dudevrulesdir="${EPREFIX}$(get_udevdir)/rules.d"
|
||||
$(meson_feature json json-c)
|
||||
)
|
||||
meson_src_configure
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
udev_reload
|
||||
}
|
||||
|
||||
pkg_postrm() {
|
||||
udev_reload
|
||||
}
|
Loading…
Reference in New Issue
Block a user