Compare commits

..

No commits in common. "imports/c8-beta/s390utils-2.6.0-30.el8" and "c8" have entirely different histories.

15 changed files with 6721 additions and 42257 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
SOURCES/cmsfs-1.1.8c.tar.gz SOURCES/cmsfs-1.1.8c.tar.gz
SOURCES/s390-tools-2.6.0.tar.gz SOURCES/s390-tools-2.29.0-rust-vendor.tar.xz
SOURCES/s390-tools-2.29.0.tar.gz
SOURCES/src_vipa-2.1.0.tar.gz SOURCES/src_vipa-2.1.0.tar.gz

View File

@ -1,3 +0,0 @@
9c9a4e89bddb2b4e6e09ef6fc7c2e6f2ad6316de SOURCES/cmsfs-1.1.8c.tar.gz
46a09493030c3c80987b7710e34a33462e4b90f4 SOURCES/s390-tools-2.6.0.tar.gz
8ed8592a0a9370ce8422df9231ccb17f6cf49bed SOURCES/src_vipa-2.1.0.tar.gz

View File

@ -132,8 +132,12 @@ case "$COMMAND" in
fi fi
fi fi
if [ -n "$NEWDEFAULT" ]; then if [ -n "$NEWDEFAULT" ] && [ -f "${ZIPLCFG}" ]; then
sed -i -e "s,^default=.*,default=${NEWDEFAULT}," "${ZIPLCFG}" if grep -q "^default=" "${ZIPLCFG}"; then
sed -i -e "s,^default=.*,default=${NEWDEFAULT}," "${ZIPLCFG}"
else
echo "default=${NEWDEFAULT}" >> "${ZIPLCFG}"
fi
fi fi
exit 0 exit 0
@ -151,8 +155,10 @@ case "$COMMAND" in
BLS_TARGET="${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" BLS_TARGET="${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf"
BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")" BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")"
TITLE="$(grep '^title[ \t]' "${BLS_TARGET}" | sed -e 's/^title[ \t]*//')" if [ -f "${BLS_TARGET}" ] && [ -f "${ZIPLCFG}" ]; then
sed -i -e "/^default=${TITLE}/d" "${ZIPLCFG}" TITLE="$(grep '^title[ \t]' "${BLS_TARGET}" | sed -e 's/^title[ \t]*//')"
sed -i -e "/^default=${TITLE}/d" "${ZIPLCFG}"
fi
if [[ -f "${BLS_DEBUG}" ]]; then if [[ -f "${BLS_DEBUG}" ]]; then
TITLE="$(grep '^title[ \t]' "${BLS_DEBUG}" | sed -e 's/^title[ \t]*//')" TITLE="$(grep '^title[ \t]' "${BLS_DEBUG}" | sed -e 's/^title[ \t]*//')"

View File

@ -35,6 +35,14 @@ get_config_by_subchannel ()
| LC_ALL=C sed -e "$__sed_discard_ignored_files" | LC_ALL=C sed -e "$__sed_discard_ignored_files"
} }
get_config_by_subchannel_nm ()
{
LANG=C grep -E -i -l \
"^s390-subchannels=([0-9]\.[0-9]\.[a-f0-9]+;){0,2}${1};([0-9]\.[0-9]\.[a-f0-9]+;){0,2}$" \
/etc/NetworkManager/system-connections/*.nmconnection \
| LC_ALL=C sed -e "$__sed_discard_ignored_files"
}
CHANNEL=${DEVPATH##*/} CHANNEL=${DEVPATH##*/}
if [ $MODE = "dracut" ]; then if [ $MODE = "dracut" ]; then
@ -65,7 +73,14 @@ elif [ $MODE = "normal" ]; then
if [ -n "$CONFIG_FILE" ]; then if [ -n "$CONFIG_FILE" ]; then
. $CONFIG_FILE . $CONFIG_FILE
else else
exit 1 CONFIG_FILE=$(get_config_by_subchannel_nm $CHANNEL)
if [ -n "$CONFIG_FILE" ]; then
NETTYPE=$(sed -nr "/^\[ethernet\]/ { :l /^s390-nettype[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" $CONFIG_FILE)
SUBCHANNELS=$(sed -nr "/^\[ethernet\]/ { :l /^s390-subchannels[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" $CONFIG_FILE | sed -e "s/;/,/g" -e "s/,$//")
LAYER2=$(sed -nr "/^\[ethernet-s390-options\]/ { :l /^layer2[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" $CONFIG_FILE)
else
exit 1
fi
fi fi
else else
echo "Unknown mode=$MODE" echo "Unknown mode=$MODE"

View File

@ -0,0 +1,12 @@
diff -up cmsfs-1.1.8c/cmsfslst.c.orig cmsfs-1.1.8c/cmsfslst.c
--- cmsfs-1.1.8c/cmsfslst.c.orig 2020-08-19 09:47:36.459063820 +0000
+++ cmsfs-1.1.8c/cmsfslst.c 2020-08-19 09:47:45.619063820 +0000
@@ -49,7 +49,7 @@ int main(int argc,unsigned char *argv[])
}
/* sanity check */
- if (*devname == 0x00)
+ if ((devname == NULL) || (*devname == 0x00))
{
(void) fprintf(stderr,"Please specify a CMS volume.\n");
(void) fprintf(stderr,USAGE,argv[0]);

View File

@ -1,12 +1,12 @@
diff -urN cmsfs-1.1.8/cmsfssed.sh cmsfs-1.1.8_/cmsfssed.sh diff -aruN cmsfs-1.1.8c/cmsfssed.sh cmsfs-1.1.8c.alma/cmsfssed.sh
--- cmsfs-1.1.8/cmsfssed.sh 2003-02-28 17:52:59.000000000 -0500 --- cmsfs-1.1.8c/cmsfssed.sh 2006-01-29 07:04:32
+++ cmsfs-1.1.8_/cmsfssed.sh 2004-05-28 16:36:22.000000000 -0400 +++ cmsfs-1.1.8c.alma/cmsfssed.sh 2023-11-01 10:57:10
@@ -85,7 +85,7 @@ @@ -85,7 +85,7 @@
DRIVER_SOURCE="cmsfs22x.c" DRIVER_SOURCE="cmsfs22x.c"
MODULES_DIRECTORY="/lib/modules/`uname -r`/fs" MODULES_DIRECTORY="/lib/modules/`uname -r`/fs"
;; ;;
- 2.4*|2.5*) - 2.4*|2.5*)
+ 2.4*|2.5*|2.6*|3.*|4.*) + 2.4*|2.5*|2.6*|3.*|4.*|5.*)
LINUX_RELEASE="2.4" LINUX_RELEASE="2.4"
# ln -s cmsfs24x.c cmsfsvfs.c # ln -s cmsfs24x.c cmsfsvfs.c
INCLUDES="-I/lib/modules/`uname -r`/build/include" INCLUDES="-I/lib/modules/`uname -r`/build/include"

View File

@ -306,6 +306,14 @@ if [ $MODE_ZNET ]; then
eval "$line" eval "$line"
free_device $SUBCHANNELS free_device $SUBCHANNELS
done done
for line in $(LANG=C grep -E -i -h \
"^s390-subchannels=([0-9]\.[0-9]\.[a-f0-9]+;){2,3}$" \
$( (ls /etc/NetworkManager/system-connections/*.nmconnection 2> /dev/null || echo "__no_config_file") | \
LC_ALL=C sed -e "$__sed_discard_ignored_files") 2> /dev/null)
do
SUBCHANNELS="$(echo $line | sed -e "s/s390-subchannels=//" -e "s/;/,/g")"
free_device $SUBCHANNELS
done
fi fi
[ -z "$ALL_DEVICES" ] && exit 0 [ -z "$ALL_DEVICES" ] && exit 0

File diff suppressed because it is too large Load Diff

View File

@ -1,146 +0,0 @@
From ecf5a4ecb909bfd91306678d0c460ab2f2837a33 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Mon, 18 Nov 2019 04:10:06 -0500
Subject: [PATCH 1/3] zipl: drop redundant string duplication
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Dan Horák <dan@danny.cz>
---
zipl/src/scan.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/zipl/src/scan.c b/zipl/src/scan.c
index 38fa5454..0ea37efa 100644
--- a/zipl/src/scan.c
+++ b/zipl/src/scan.c
@@ -1575,7 +1575,6 @@ scan_check_bls(struct scan_token *scan)
int i, rc;
char *target_value = NULL;
char *img_value = NULL;
- char *buffer = NULL;
/*
* In the BLS case, each BLS section heading inherits a keyword
* assignment target= from zipl.conf, and they are all the same.
@@ -1609,14 +1608,8 @@ scan_check_bls(struct scan_token *scan)
scan[i].content.keyword.value);
return rc;
}
- buffer = (char *)
- misc_malloc(strlen(img_value) + 1);
- if (buffer == NULL)
- return -1;
- memcpy(buffer, img_value, strlen(img_value));
- buffer[strlen(img_value)] = 0;
free(scan[i].content.keyword.value);
- scan[i].content.keyword.value = buffer;
+ scan[i].content.keyword.value = img_value;
}
}
}
From 05f83569960e2774e819fe0942da1f92d0cce35b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Mon, 18 Nov 2019 04:29:04 -0500
Subject: [PATCH 2/3] zipl: set reason not text for failed check
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Dan Horák <dan@danny.cz>
---
zipl/src/scan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/zipl/src/scan.c b/zipl/src/scan.c
index 0ea37efa..0f01cac9 100644
--- a/zipl/src/scan.c
+++ b/zipl/src/scan.c
@@ -1603,7 +1603,7 @@ scan_check_bls(struct scan_token *scan)
scan[i].content.keyword.value);
rc = misc_check_readable_file(img_value);
if (rc) {
- error_text(
+ error_reason(
"Image file '%s' is not accessible",
scan[i].content.keyword.value);
return rc;
From 8ab552b430f109d80966d0c56bed0d204d917d30 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Mon, 18 Nov 2019 11:45:50 -0500
Subject: [PATCH 3/3] zipl: fix handling of values with load address in BLS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Various keywords (like image or ramdisk) allow specifying a load address
as an optional argument. Adapt the logic for checking the presence of
the files to take this into the account.
Fixes: https://github.com/ibm-s390-tools/s390-tools/commit/d71628326d80e623fc9f008fe4ea93edb5592b2e
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1772054
Signed-off-by: Dan Horák <dan@danny.cz>
---
zipl/src/scan.c | 32 ++++++++++++++++++++++++++------
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/zipl/src/scan.c b/zipl/src/scan.c
index 0f01cac9..a34edf62 100644
--- a/zipl/src/scan.c
+++ b/zipl/src/scan.c
@@ -1575,6 +1575,8 @@ scan_check_bls(struct scan_token *scan)
int i, rc;
char *target_value = NULL;
char *img_value = NULL;
+ char *file = NULL;
+ char *tmp, *value;
/*
* In the BLS case, each BLS section heading inherits a keyword
* assignment target= from zipl.conf, and they are all the same.
@@ -1595,19 +1597,37 @@ scan_check_bls(struct scan_token *scan)
if (scan[i].content.keyword.keyword == scan_keyword_image ||
scan[i].content.keyword.keyword == scan_keyword_ramdisk) {
- rc = misc_check_readable_file(
- scan[i].content.keyword.value);
+ value = scan[i].content.keyword.value;
+ /*
+ * put the filename only into the file var before
+ * checking its presence
+ */
+ if (contains_address(value)) {
+ tmp = strrchr(value, ',');
+ file = strndup(value, tmp - value);
+ } else {
+ file = value;
+ }
+ rc = misc_check_readable_file(file);
if (rc) {
misc_asprintf(&img_value, "%s%s",
- target_value,
- scan[i].content.keyword.value);
+ target_value, file);
rc = misc_check_readable_file(img_value);
if (rc) {
error_reason(
- "Image file '%s' is not accessible",
- scan[i].content.keyword.value);
+ "File '%s' not accessible", file);
return rc;
}
+ /*
+ * when file has stripped the load address part,
+ * do generate a prefixed value
+ */
+ if (file != value) {
+ free(file);
+ free(img_value);
+ misc_asprintf(&img_value, "%s%s",
+ target_value, value);
+ }
free(scan[i].content.keyword.value);
scan[i].content.keyword.value = img_value;
}

View File

@ -0,0 +1,348 @@
From b2daaa34776ba6afec879e362378f6f7563590a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Mon, 20 Jun 2022 17:43:05 +0200
Subject: [PATCH 1/2] Revert "zipl/src: Implement sorting bls entries by
versions"
This reverts commit a0dba6bfdb50ff373fa710ffe2a307cc0748f18b.
---
zipl/src/scan.c | 139 ++----------------------------------------------
1 file changed, 3 insertions(+), 136 deletions(-)
diff --git a/zipl/src/scan.c b/zipl/src/scan.c
index 0cea1d4..9352f76 100644
--- a/zipl/src/scan.c
+++ b/zipl/src/scan.c
@@ -10,7 +10,6 @@
*
*/
-static const char *VERSION_KEYWORD = "version";
/* Need ISOC99 function isblank() in ctype.h */
#ifndef __USE_ISOC99
@@ -646,7 +645,7 @@ scan_file(const char* filename, struct scan_token** token)
static int
-bls_filter_by_names(const struct dirent *ent)
+bls_filter(const struct dirent *ent)
{
int offset = strlen(ent->d_name) - strlen(".conf");
@@ -656,111 +655,13 @@ bls_filter_by_names(const struct dirent *ent)
return strncmp(ent->d_name + offset, ".conf", strlen(".conf")) == 0;
}
-struct version {
- char *line; /* pointer to a line with version keyword */
- int offset; /* offset of version value in the line */
-};
-
-/*
- * Locate version in bls file represented by ENT
- */
-static void get_version(const struct dirent *ent, struct version *v)
-{
- char *line = NULL;
- size_t len = 0;
- char *d_name;
- FILE *stream;
- ssize_t read;
-
- memset(v, 0, sizeof(*v));
- d_name = misc_make_path((char *)blsdir, (char *)ent->d_name);
- if (!d_name)
- return;
-
- stream = fopen(d_name, "r");
- free(d_name);
- if (!stream)
- return;
-
- while ((read = getline(&line, &len, stream)) != -1) {
- if (line[read - 1] == '\n') {
- line[read - 1] = '\0';
- read--;
- }
- if ((size_t)read <= strlen(VERSION_KEYWORD) + 1)
- continue;
- if (strcmp(VERSION_KEYWORD, line) > 0)
- continue;
- if (!isblank(line[strlen(VERSION_KEYWORD)]))
- continue;
- /* skip blanks */
- v->offset = strlen(VERSION_KEYWORD) + 1;
- while (v->offset < read - 1 && isblank(line[v->offset]))
- v->offset++;
- if (isblank(line[v->offset]))
- /*
- * all characters after the keyword
- * are blanks. Invalid version
- */
- continue;
- v->line = line;
- fclose(stream);
- return;
- }
- free(line);
- fclose(stream);
-}
-
-static void put_version(struct version *v)
-{
- free(v->line);
-}
-
-/**
- * Check version in bls file represented by ENT.
- * Return 1 if version is valid. Otherwise return 0
- */
-static int bls_filter_by_versions(const struct dirent *ent)
-{
- struct version v;
-
- if (bls_filter_by_names(ent) == 0)
- return 0;
-
- get_version(ent, &v);
- if (v.line) {
- put_version(&v);
- return 1;
- }
- return 0;
-}
-
static int
-bls_sort_by_names(const struct dirent **ent_a, const struct dirent **ent_b)
+bls_sort(const struct dirent **ent_a, const struct dirent **ent_b)
{
return strverscmp((*ent_a)->d_name, (*ent_b)->d_name);
}
-static int
-bls_sort_by_versions(const struct dirent **ent_a, const struct dirent **ent_b)
-{
- struct version v1, v2;
- int ret;
-
- get_version(*ent_a, &v1);
- get_version(*ent_b, &v2);
- /*
- * Both versions are valid.
- * It is guaranteed by bls_filter_by_versions()
- */
- ret = strverscmp(v1.line + v1.offset, v2.line + v2.offset);
-
- put_version(&v1);
- put_version(&v2);
-
- return ret;
-}
static int
scan_append_section_heading(struct scan_token* scan, int* index, char* name);
@@ -1110,40 +1011,6 @@ scan_count_target_keywords(char* keyword[])
return num;
}
-static int bls_scandir(struct dirent ***bls_entries)
-{
- struct dirent **entries1;
- struct dirent **entries2;
- int n1, n2;
-
- /* arrange by names */
- n1 = scandir(blsdir, &entries1,
- bls_filter_by_names, bls_sort_by_names);
- if (n1 <= 0)
- return n1;
- /* arrange by versions */
- n2 = scandir(blsdir, &entries2,
- bls_filter_by_versions, bls_sort_by_versions);
-
- if (n2 <= 0 || n2 < n1) {
- /*
- * failed to sort by versions,
- * fall back to sorting by filenames
- */
- *bls_entries = entries1;
- while (n2--)
- free(entries2[n2]);
- free(entries2);
- return n1;
- }
- /* use arrangement by versions */
- *bls_entries = entries2;
- while (n1--)
- free(entries1[n1]);
- free(entries1);
- return n2;
-}
-
int
scan_check_target_data(char* keyword[], int* line)
{
@@ -1464,7 +1331,7 @@ int scan_bls(struct scan_token **token, int scan_size)
if (!(stat(blsdir, &sb) == 0 && S_ISDIR(sb.st_mode)))
return 0;
- n = bls_scandir(&bls_entries);
+ n = scandir(blsdir, &bls_entries, bls_filter, bls_sort);
if (n <= 0)
return n;
--
2.39.2
From 692e70bcfc32a05e30146bd7077c41e0eaceff03 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 20 Jun 2022 17:46:59 +0200
Subject: [PATCH 2/2] blscfg: sort like rpm nvr, not like a single version
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Dan Horák <dan@danny.cz>
---
zipl/src/Makefile | 1 +
zipl/src/scan.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 95 insertions(+), 2 deletions(-)
diff --git a/zipl/src/Makefile b/zipl/src/Makefile
index cab5655..7ec215d 100644
--- a/zipl/src/Makefile
+++ b/zipl/src/Makefile
@@ -9,6 +9,7 @@ ALL_LDFLAGS += -Wl,-z,noexecstack $(NO_PIE_LDFLAGS)
libs = $(rootdir)/libutil/libutil.a \
$(rootdir)/libvtoc/libvtoc.a \
+ -lrpmio -lrpm
objects = misc.o error.o scan.o job.o boot.o bootmap.o fs-map.o disk.o \
bootmap_header.o envblk.o install.o zipl.o
diff --git a/zipl/src/scan.c b/zipl/src/scan.c
index 9352f76..3327e2d 100644
--- a/zipl/src/scan.c
+++ b/zipl/src/scan.c
@@ -35,6 +35,8 @@
#include "lib/util_base.h"
+#include <rpm/rpmlib.h>
+
#include "boot.h"
#include "error.h"
#include "misc.h"
@@ -655,13 +657,103 @@ bls_filter(const struct dirent *ent)
return strncmp(ent->d_name + offset, ".conf", strlen(".conf")) == 0;
}
+/* returns name/version/release */
+/* NULL string pointer returned if nothing found */
+static void
+split_package_string (char *package_string, char **name,
+ char **version, char **release)
+{
+ char *package_version, *package_release;
+
+ /* Release */
+ package_release = strrchr (package_string, '-');
+
+ if (package_release != NULL)
+ *package_release++ = '\0';
+
+ *release = package_release;
+
+ /* Version */
+ package_version = strrchr(package_string, '-');
+
+ if (package_version != NULL)
+ *package_version++ = '\0';
+
+ *version = package_version;
+ /* Name */
+ *name = package_string;
+
+ /* Bubble up non-null values from release to name */
+ if (name != NULL && *name == NULL) {
+ *name = (*version == NULL ? *release : *version);
+ *version = *release;
+ *release = NULL;
+ }
+ if (*version == NULL) {
+ *version = *release;
+ *release = NULL;
+ }
+}
static int
-bls_sort(const struct dirent **ent_a, const struct dirent **ent_b)
+split_cmp(char *nvr0, char *nvr1, int has_name)
+{
+ int ret = 0;
+ char *name0, *version0, *release0;
+ char *name1, *version1, *release1;
+
+ split_package_string(nvr0, has_name ? &name0 : NULL, &version0, &release0);
+ split_package_string(nvr1, has_name ? &name1 : NULL, &version1, &release1);
+
+ if (has_name) {
+ ret = rpmvercmp(name0 == NULL ? "" : name0,
+ name1 == NULL ? "" : name1);
+ if (ret != 0)
+ return ret;
+ }
+
+ ret = rpmvercmp(version0 == NULL ? "" : version0,
+ version1 == NULL ? "" : version1);
+ if (ret != 0)
+ return ret;
+
+ ret = rpmvercmp(release0 == NULL ? "" : release0,
+ release1 == NULL ? "" : release1);
+ return ret;
+}
+
+/* return 1: filename0 is newer than filename1 */
+/* 0: filename0 and filename1 are the same version */
+/* -1: filename1 is newer than filename0 */
+static int bls_cmp(const char *filename0, const char *filename1)
{
- return strverscmp((*ent_a)->d_name, (*ent_b)->d_name);
+ char *id0, *id1;
+ int l, r;
+
+ id0 = strdup(filename0);
+ id1 = strdup(filename1);
+
+ l = strlen(id0);
+ if (l > 5 && strcmp(id0 + l - 5, ".conf"))
+ id0[l-5] = '\0';
+
+ l = strlen(id1);
+ if (l > 5 && strcmp(id1 + l - 5, ".conf"))
+ id1[l-5] = '\0';
+
+ r = split_cmp(id0, id1, 1);
+
+ free(id0);
+ free(id1);
+
+ return r;
}
+static int
+bls_sort(const struct dirent **ent_a, const struct dirent **ent_b)
+{
+ return bls_cmp((*ent_a)->d_name, (*ent_b)->d_name);
+}
static int
scan_append_section_heading(struct scan_token* scan, int* index, char* name);
--
2.39.2

View File

@ -61,10 +61,10 @@ index 871935c783f..d8d5eca5867 100755
;; ;;
--) --)
shift shift
diff --git a/scripts/zipl-switch-to-blscfg.1 b/scripts/zipl-switch-to-blscfg.1 diff --git a/scripts/zipl-switch-to-blscfg.8 b/scripts/zipl-switch-to-blscfg.8
index 6bd14d00d14..71b904ffd1c 100644 index 6bd14d00d14..71b904ffd1c 100644
--- a/scripts/zipl-switch-to-blscfg.1 --- a/scripts/zipl-switch-to-blscfg.8
+++ b/scripts/zipl-switch-to-blscfg.1 +++ b/scripts/zipl-switch-to-blscfg.8
@@ -37,9 +37,9 @@ The DIRECTORY where the BLS fragments will be generated. The directory is create @@ -37,9 +37,9 @@ The DIRECTORY where the BLS fragments will be generated. The directory is create
The FILE used for zipl configuration file, defaults to /etc/zipl.conf. The FILE used for zipl configuration file, defaults to /etc/zipl.conf.

View File

@ -1,147 +0,0 @@
From 8ec7b75204f3c7bf691e14b89c73c5dd28d2a824 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 15 Oct 2018 13:54:16 -0400
Subject: [PATCH] blscfg: sort like rpm nvr, not like a single version
Signed-off-by: Peter Jones <pjones@redhat.com>
---
zipl/src/scan.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++-
zipl/src/Makefile | 3 +-
2 files changed, 96 insertions(+), 3 deletions(-)
diff --git a/zipl/src/scan.c b/zipl/src/scan.c
index fe72e9ab13d..63186222783 100644
--- a/zipl/src/scan.c
+++ b/zipl/src/scan.c
@@ -33,6 +33,8 @@
#include "lib/util_base.h"
+#include <rpm/rpmlib.h>
+
#include "boot.h"
#include "error.h"
#include "misc.h"
@@ -652,14 +654,104 @@ bls_filter(const struct dirent *ent)
return strncmp(ent->d_name + offset, ".conf", strlen(".conf")) == 0;
}
+/* returns name/version/release */
+/* NULL string pointer returned if nothing found */
+static void
+split_package_string (char *package_string, char **name,
+ char **version, char **release)
+{
+ char *package_version, *package_release;
+
+ /* Release */
+ package_release = strrchr (package_string, '-');
+
+ if (package_release != NULL)
+ *package_release++ = '\0';
+
+ *release = package_release;
+
+ /* Version */
+ package_version = strrchr(package_string, '-');
+
+ if (package_version != NULL)
+ *package_version++ = '\0';
+
+ *version = package_version;
+ /* Name */
+ *name = package_string;
+
+ /* Bubble up non-null values from release to name */
+ if (name != NULL && *name == NULL) {
+ *name = (*version == NULL ? *release : *version);
+ *version = *release;
+ *release = NULL;
+ }
+ if (*version == NULL) {
+ *version = *release;
+ *release = NULL;
+ }
+}
+
+static int
+split_cmp(char *nvr0, char *nvr1, int has_name)
+{
+ int ret = 0;
+ char *name0, *version0, *release0;
+ char *name1, *version1, *release1;
+
+ split_package_string(nvr0, has_name ? &name0 : NULL, &version0, &release0);
+ split_package_string(nvr1, has_name ? &name1 : NULL, &version1, &release1);
+
+ if (has_name) {
+ ret = rpmvercmp(name0 == NULL ? "" : name0,
+ name1 == NULL ? "" : name1);
+ if (ret != 0)
+ return ret;
+ }
+
+ ret = rpmvercmp(version0 == NULL ? "" : version0,
+ version1 == NULL ? "" : version1);
+ if (ret != 0)
+ return ret;
+
+ ret = rpmvercmp(release0 == NULL ? "" : release0,
+ release1 == NULL ? "" : release1);
+ return ret;
+}
+
+/* return 1: filename0 is newer than filename1 */
+/* 0: filename0 and filename1 are the same version */
+/* -1: filename1 is newer than filename0 */
+static int bls_cmp(const char *filename0, const char *filename1)
+{
+ char *id0, *id1;
+ int l, r;
+
+ id0 = strdup(filename0);
+ id1 = strdup(filename1);
+
+ l = strlen(id0);
+ if (l > 5 && strcmp(id0 + l - 5, ".conf"))
+ id0[l-5] = '\0';
+
+ l = strlen(id1);
+ if (l > 5 && strcmp(id1 + l - 5, ".conf"))
+ id1[l-5] = '\0';
+
+ r = split_cmp(id0, id1, 1);
+
+ free(id0);
+ free(id1);
+
+ return r;
+}
static int
bls_sort(const struct dirent **ent_a, const struct dirent **ent_b)
{
- return strverscmp((*ent_a)->d_name, (*ent_b)->d_name);
+ return bls_cmp((*ent_a)->d_name, (*ent_b)->d_name);
}
-
static int
scan_append_section_heading(struct scan_token* scan, int* index, char* name);
static int
diff --git a/zipl/src/Makefile b/zipl/src/Makefile
index 1634c0d5121..bc797990652 100644
--- a/zipl/src/Makefile
+++ b/zipl/src/Makefile
@@ -7,7 +7,7 @@ ALL_CPPFLAGS += -I../include -I../boot \
-D_FILE_OFFSET_BITS=64 $(NO_PIE_CFLAGS)
ALL_LDFLAGS += -Wl,-z,noexecstack $(NO_PIE_LDFLAGS)
-libs = $(rootdir)/libutil/libutil.a
+libs = $(rootdir)/libutil/libutil.a -lrpm
objects = misc.o error.o scan.o job.o boot.o bootmap.o disk.o \
install.o zipl.o $(rootdir)/zipl/boot/data.o
--
2.17.1

File diff suppressed because it is too large Load Diff

View File

@ -2,10 +2,12 @@
# config file syntax: # config file syntax:
# deviceno WWPN FCPLUN # deviceno WWPN FCPLUN
# deviceno # allowed when auto LUN scan is enabled and port is in NPIV mode
# #
# Example: # Example:
# 0.0.4000 0x5005076300C213e9 0x5022000000000000 # 0.0.4000 0x5005076300C213e9 0x5022000000000000
# 0.0.4001 0x5005076300c213e9 0x5023000000000000 # 0.0.4001 0x5005076300c213e9 0x5023000000000000
# 0.0.5000
# #
# #
# manual setup: # manual setup:
@ -21,12 +23,20 @@
CONFIG=/etc/zfcp.conf CONFIG=/etc/zfcp.conf
PATH=/bin:/sbin PATH=/bin:/sbin
set_online()
{
DEVICE=$1
[ `cat /sys/bus/ccw/drivers/zfcp/${DEVICE}/online` = "0" ] \
&& echo 1 > /sys/bus/ccw/drivers/zfcp/${DEVICE}/online
}
if [ -f "$CONFIG" ]; then if [ -f "$CONFIG" ]; then
if [ ! -d /sys/bus/ccw/drivers/zfcp ]; then if [ ! -d /sys/bus/ccw/drivers/zfcp ]; then
modprobe zfcp modprobe zfcp
fi fi
if [ ! -d /sys/bus/ccw/drivers/zfcp ]; then if [ ! -d /sys/bus/ccw/drivers/zfcp ]; then
return exit 1
fi fi
sed 'y/ABCDEF/abcdef/' < $CONFIG | while read line; do sed 'y/ABCDEF/abcdef/' < $CONFIG | while read line; do
case $line in case $line in
@ -34,6 +44,17 @@ if [ -f "$CONFIG" ]; then
*) *)
[ -z "$line" ] && continue [ -z "$line" ] && continue
set $line set $line
if [ $# -eq 1 ]; then
DEVICE=${1##*0x}
if [ `cat /sys/module/zfcp/parameters/allow_lun_scan` = "Y" ]; then
set_online ${DEVICE}
grep -q NPIV /sys/bus/ccw/devices/${DEVICE}/host*/fc_host/host*/port_type || \
echo "Error: Only device ID (${DEVICE}) given, but port not in NPIV mode"
else
echo "Error: Only device ID (${DEVICE}) given, but LUN scan is disabled for the zfcp module"
fi
continue
fi
if [ $# -eq 5 ]; then if [ $# -eq 5 ]; then
DEVICE=$1 DEVICE=$1
SCSIID=$2 SCSIID=$2
@ -46,11 +67,11 @@ if [ -f "$CONFIG" ]; then
WWPN=$2 WWPN=$2
FCPLUN=$3 FCPLUN=$3
fi fi
[ `cat /sys/bus/ccw/drivers/zfcp/${DEVICE}/online` = "0" ] \ set_online ${DEVICE}
&& echo 1 > /sys/bus/ccw/drivers/zfcp/${DEVICE}/online
[ ! -d /sys/bus/ccw/drivers/zfcp/${DEVICE}/${WWPN}/${FCPLUN} ] \ [ ! -d /sys/bus/ccw/drivers/zfcp/${DEVICE}/${WWPN}/${FCPLUN} ] \
&& echo $FCPLUN > /sys/bus/ccw/drivers/zfcp/${DEVICE}/${WWPN}/unit_add && echo $FCPLUN > /sys/bus/ccw/drivers/zfcp/${DEVICE}/${WWPN}/unit_add
;; ;;
esac esac
done done
fi fi
exit 0

File diff suppressed because it is too large Load Diff