From d23889c66852b124fa8844d8c13cf2983d4999f6 Mon Sep 17 00:00:00 2001 From: wxiat Date: Wed, 14 Jun 2023 15:05:19 +0800 Subject: [PATCH] add sw Signed-off-by: wxiat --- 1004-util-linux-add-sw.patch | 322 +++++++++++++++++++++++++++++++++++ util-linux.spec | 6 +- 2 files changed, 327 insertions(+), 1 deletion(-) create mode 100644 1004-util-linux-add-sw.patch diff --git a/1004-util-linux-add-sw.patch b/1004-util-linux-add-sw.patch new file mode 100644 index 0000000..be7097a --- /dev/null +++ b/1004-util-linux-add-sw.patch @@ -0,0 +1,322 @@ +From 0cea5b507f643f9159b3074236571faf3ed60c34 Mon Sep 17 00:00:00 2001 +From: wxiat +Date: Wed, 14 Jun 2023 15:03:54 +0800 +Subject: [PATCH] add sw + +Signed-off-by: rpm-build +--- + configure | 2 ++ + configure.ac | 2 ++ + include/pt-bsd.h | 4 ++-- + libfdisk/src/bsd.c | 16 ++++++++-------- + sys-utils/hwclock-rtc.c | 4 ++-- + sys-utils/hwclock.c | 12 ++++++------ + sys-utils/hwclock.h | 6 +++--- + sys-utils/lscpu.c | 2 +- + sys-utils/setarch.c | 4 ++++ + tests/ts/fdisk/bsd | 5 ++++- + 10 files changed, 34 insertions(+), 23 deletions(-) + +diff --git a/configure b/configure +index 2865523..a2ab58e 100755 +--- a/configure ++++ b/configure +@@ -30068,6 +30068,7 @@ else + case $host_cpu in + #( + alpha) syscall="442" ;; #( ++ sw_64) syscall="442" ;; #( + i*86) syscall="289" ;; #( + ia64*) syscall="1274" ;; #( + powerpc*) syscall="273" ;; #( +@@ -30172,6 +30173,7 @@ else + case $host_cpu in + #( + alpha) syscall="443" ;; #( ++ sw_64) syscall="443" ;; #( + i*86) syscall="290" ;; #( + ia64*) syscall="1275" ;; #( + powerpc*) syscall="274" ;; #( +diff --git a/configure.ac b/configure.ac +index 2450048..869b6e0 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -2024,6 +2024,7 @@ UL_BUILD_INIT([ionice]) + UL_REQUIRES_SYSCALL_CHECK([ionice], + [UL_CHECK_SYSCALL([ioprio_set], + [alpha], [442], ++ [sw_64], [442], + [i*86], [289], + [ia64*], [1274], + [powerpc*], [273], +@@ -2036,6 +2037,7 @@ UL_REQUIRES_SYSCALL_CHECK([ionice], + UL_REQUIRES_SYSCALL_CHECK([ionice], + [UL_CHECK_SYSCALL([ioprio_get], + [alpha], [443], ++ [sw_64], [443], + [i*86], [290], + [ia64*], [1275], + [powerpc*], [274], +diff --git a/include/pt-bsd.h b/include/pt-bsd.h +index 9bf47a5..8538a2c 100644 +--- a/include/pt-bsd.h ++++ b/include/pt-bsd.h +@@ -11,7 +11,7 @@ + #define BSD_LINUX_BOOTDIR "/usr/ucb/mdec" + + #if defined (__alpha__) || defined (__powerpc__) || \ +- defined (__ia64__) || defined (__hppa__) ++ defined (__ia64__) || defined (__hppa__) || defined (__sw_64__) + # define BSD_LABELSECTOR 0 + # define BSD_LABELOFFSET 64 + #else +@@ -137,7 +137,7 @@ struct bsd_disklabel { + #define BSD_FS_ADVFS 16 /* Digital Unix AdvFS */ + + /* this is annoying, but it's also the way it is :-( */ +-#ifdef __alpha__ ++#if defined __alpha__ || defined __sw_64__ + #define BSD_FS_EXT2 8 /* ext2 file system */ + #else + #define BSD_FS_MSDOS 8 /* MS-DOS file system */ +diff --git a/libfdisk/src/bsd.c b/libfdisk/src/bsd.c +index 9ba3140..8d9668f 100644 +--- a/libfdisk/src/bsd.c ++++ b/libfdisk/src/bsd.c +@@ -55,7 +55,7 @@ static struct fdisk_parttype bsd_fstypes[] = { + {BSD_FS_V71K, "4.1BSD"}, + {BSD_FS_V8, "Eighth Edition"}, + {BSD_FS_BSDFFS, "4.2BSD"}, +-#ifdef __alpha__ ++#if defined __alpha__ || defined __sw_64__ + {BSD_FS_EXT2, "ext2"}, + #else + {BSD_FS_MSDOS, "MS-DOS"}, +@@ -80,7 +80,7 @@ struct fdisk_bsd_label { + + struct dos_partition *dos_part; /* parent */ + struct bsd_disklabel bsd; /* on disk label */ +-#if defined (__alpha__) ++#if defined (__alpha__) || defined (__sw_64__) + /* We access this through a u_int64_t * when checksumming */ + char bsdbuffer[BSD_BBSIZE] __attribute__((aligned(8))); + #else +@@ -120,7 +120,7 @@ static struct fdisk_parttype *bsd_partition_parttype( + } + + +-#if defined (__alpha__) ++#if defined (__alpha__) || defined (__sw_64__) + static void alpha_bootblock_checksum (char *boot) + { + uint64_t *dp = (uint64_t *) boot, sum = 0; +@@ -605,7 +605,7 @@ int fdisk_bsd_edit_disklabel(struct fdisk_context *cxt) + struct bsd_disklabel *d = self_disklabel(cxt); + uintmax_t res; + +-#if defined (__alpha__) || defined (__ia64__) ++#if defined (__alpha__) || defined (__ia64__) || defined (__sw_64__) + if (fdisk_ask_number(cxt, DEFAULT_SECTOR_SIZE, d->d_secsize, + UINT32_MAX, _("bytes/sector"), &res) == 0) + d->d_secsize = res; +@@ -710,7 +710,7 @@ int fdisk_bsd_write_bootstrap(struct fdisk_context *cxt) + sector = 0; + if (l->dos_part) + sector = dos_partition_get_start(l->dos_part); +-#if defined (__alpha__) ++#if defined (__alpha__) || defined (__sw_64__) + alpha_bootblock_checksum(l->bsdbuffer); + #endif + if (lseek(cxt->dev_fd, (off_t) sector * DEFAULT_SECTOR_SIZE, SEEK_SET) == -1) { +@@ -760,7 +760,7 @@ static int bsd_initlabel (struct fdisk_context *cxt) + else + d -> d_type = BSD_DTYPE_ST506; + +-#if !defined (__alpha__) ++#if !defined (__alpha__) && !defined (__sw_64__) + d -> d_flags = BSD_D_DOSPART; + #else + d -> d_flags = 0; +@@ -884,7 +884,7 @@ static int bsd_write_disklabel(struct fdisk_context *cxt) + memmove(&l->bsdbuffer[BSD_LABELSECTOR * DEFAULT_SECTOR_SIZE + + BSD_LABELOFFSET], d, sizeof(*d)); + +-#if defined (__alpha__) && BSD_LABELSECTOR == 0 ++#if (defined (__alpha__) || defined (__sw_64__)) && BSD_LABELSECTOR == 0 + /* Write the checksum to the end of the first sector. */ + alpha_bootblock_checksum(l->bsdbuffer); + #endif +@@ -920,7 +920,7 @@ static int bsd_translate_fstype (int linux_type) + case 0x06: /* DOS 16-bit >=32M */ + case 0xe1: /* DOS access */ + case 0xe3: /* DOS R/O */ +-#if !defined (__alpha__) ++#if !defined (__alpha__) && !defined (__sw_64__) + case 0xf2: /* DOS secondary */ + return BSD_FS_MSDOS; + #endif +diff --git a/sys-utils/hwclock-rtc.c b/sys-utils/hwclock-rtc.c +index ef95d98..ec612f5 100644 +--- a/sys-utils/hwclock-rtc.c ++++ b/sys-utils/hwclock-rtc.c +@@ -255,7 +255,7 @@ static int synchronize_to_clock_tick_rtc(const struct hwclock_control *ctl) + } else { + int rc; /* Return code from ioctl */ + /* Turn on update interrupts (one per second) */ +-#if defined(__alpha__) || defined(__sparc__) ++#if defined(__alpha__) || defined(__sw_64__) || defined(__sparc__) + /* + * Not all alpha kernels reject RTC_UIE_ON, but probably + * they should. +@@ -387,7 +387,7 @@ struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl) + return &rtc_interface; + } + +-#ifdef __alpha__ ++#if defined __alpha__ || defined __sw_64__ + /* + * Get the Hardware Clock epoch setting from the kernel. + */ +diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c +index 19e7410..47aee63 100644 +--- a/sys-utils/hwclock.c ++++ b/sys-utils/hwclock.c +@@ -1024,7 +1024,7 @@ manipulate_clock(const struct hwclock_control *ctl, const time_t set_time, + * Get or set the kernel RTC driver's epoch on Alpha machines. + * ISA machines are hard coded for 1900. + */ +-#if defined(__linux__) && defined(__alpha__) ++#if defined(__linux__) && defined(__alpha__) || defined(__sw_64__) + static void + manipulate_epoch(const struct hwclock_control *ctl) + { +@@ -1067,7 +1067,7 @@ usage(void) + puts(_(" -w, --systohc set the RTC from the system time")); + puts(_(" --systz send timescale configurations to the kernel")); + puts(_(" -a, --adjust adjust the RTC to account for systematic drift")); +-#if defined(__linux__) && defined(__alpha__) ++#if defined(__linux__) && defined(__alpha__) || defined(__sw_64__) + puts(_(" --getepoch display the RTC epoch")); + puts(_(" --setepoch set the RTC epoch according to --epoch")); + #endif +@@ -1082,7 +1082,7 @@ usage(void) + printf(_( + " --directisa use the ISA bus instead of %1$s access\n"), _PATH_RTC_DEV); + puts(_(" --date