You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(19) |
Nov
(18) |
Dec
(34) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(14) |
Feb
(14) |
Mar
(3) |
Apr
(10) |
May
(10) |
Jun
(17) |
Jul
(15) |
Aug
(24) |
Sep
(24) |
Oct
(11) |
Nov
(13) |
Dec
(15) |
2008 |
Jan
(10) |
Feb
(46) |
Mar
(20) |
Apr
(42) |
May
(44) |
Jun
(22) |
Jul
(59) |
Aug
(8) |
Sep
(15) |
Oct
(52) |
Nov
(30) |
Dec
(38) |
2009 |
Jan
(27) |
Feb
(27) |
Mar
(47) |
Apr
(85) |
May
(74) |
Jun
(41) |
Jul
(70) |
Aug
(64) |
Sep
(97) |
Oct
(147) |
Nov
(67) |
Dec
(48) |
2010 |
Jan
(68) |
Feb
(33) |
Mar
(53) |
Apr
(98) |
May
(55) |
Jun
(71) |
Jul
(99) |
Aug
(132) |
Sep
(291) |
Oct
(220) |
Nov
(344) |
Dec
(300) |
2011 |
Jan
(57) |
Feb
(25) |
Mar
(59) |
Apr
(104) |
May
(60) |
Jun
(155) |
Jul
(143) |
Aug
(43) |
Sep
(53) |
Oct
(20) |
Nov
(35) |
Dec
(103) |
2012 |
Jan
(62) |
Feb
(43) |
Mar
(29) |
Apr
(80) |
May
(75) |
Jun
(61) |
Jul
(52) |
Aug
(58) |
Sep
(33) |
Oct
(32) |
Nov
(69) |
Dec
(37) |
2013 |
Jan
(77) |
Feb
(28) |
Mar
(52) |
Apr
(18) |
May
(37) |
Jun
(21) |
Jul
(22) |
Aug
(55) |
Sep
(29) |
Oct
(74) |
Nov
(50) |
Dec
(44) |
2014 |
Jan
(77) |
Feb
(62) |
Mar
(81) |
Apr
(99) |
May
(59) |
Jun
(95) |
Jul
(55) |
Aug
(34) |
Sep
(78) |
Oct
(33) |
Nov
(48) |
Dec
(51) |
2015 |
Jan
(56) |
Feb
(120) |
Mar
(37) |
Apr
(15) |
May
(22) |
Jun
(196) |
Jul
(54) |
Aug
(33) |
Sep
(32) |
Oct
(42) |
Nov
(149) |
Dec
(61) |
2016 |
Jan
(15) |
Feb
(26) |
Mar
(37) |
Apr
(27) |
May
(14) |
Jun
(11) |
Jul
(13) |
Aug
(64) |
Sep
(2) |
Oct
(36) |
Nov
(18) |
Dec
(46) |
2017 |
Jan
(6) |
Feb
(1) |
Mar
(2) |
Apr
(50) |
May
(42) |
Jun
(11) |
Jul
(4) |
Aug
(12) |
Sep
(11) |
Oct
(21) |
Nov
(15) |
Dec
(42) |
2018 |
Jan
(33) |
Feb
(27) |
Mar
(20) |
Apr
(5) |
May
(4) |
Jun
(1) |
Jul
(42) |
Aug
(29) |
Sep
(11) |
Oct
(40) |
Nov
(312) |
Dec
(18) |
2019 |
Jan
(44) |
Feb
(98) |
Mar
(125) |
Apr
(160) |
May
(123) |
Jun
(33) |
Jul
(56) |
Aug
(81) |
Sep
(24) |
Oct
(23) |
Nov
(52) |
Dec
(86) |
2020 |
Jan
(6) |
Feb
(17) |
Mar
(62) |
Apr
(21) |
May
(118) |
Jun
(42) |
Jul
(52) |
Aug
(62) |
Sep
(20) |
Oct
(5) |
Nov
(23) |
Dec
(111) |
2021 |
Jan
(31) |
Feb
(8) |
Mar
(26) |
Apr
(13) |
May
(54) |
Jun
(31) |
Jul
(17) |
Aug
(10) |
Sep
(83) |
Oct
(8) |
Nov
(21) |
Dec
(33) |
2022 |
Jan
(67) |
Feb
(11) |
Mar
(4) |
Apr
(46) |
May
(12) |
Jun
(17) |
Jul
(19) |
Aug
(7) |
Sep
(53) |
Oct
(14) |
Nov
(29) |
Dec
(22) |
2023 |
Jan
(20) |
Feb
(4) |
Mar
(37) |
Apr
(25) |
May
(15) |
Jun
(20) |
Jul
(38) |
Aug
(1) |
Sep
(1) |
Oct
(34) |
Nov
|
Dec
(8) |
2024 |
Jan
(15) |
Feb
(10) |
Mar
|
Apr
(4) |
May
(23) |
Jun
|
Jul
(8) |
Aug
(2) |
Sep
(18) |
Oct
(1) |
Nov
(18) |
Dec
(15) |
2025 |
Jan
(5) |
Feb
(1) |
Mar
(7) |
Apr
(4) |
May
(18) |
Jun
(7) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Gleb C. <lna...@ya...> - 2025-06-26 12:12:29
|
Commit: 3aad61d GitHub URL: https://github.com/SCST-project/scst/commit/3aad61d2fd88856bfc8e9dcebf9fdb11986f5041 Author: Christoph Böhmwalder Date: 2025-06-26T15:11:58+03:00 Log Message: ----------- iscsi-scst: use /run instead of /var/run When attempting to manage iscsi-scstd using a systemd service file, systemd warns: PIDFile= references a path below legacy directory /var/run/, [...] Change the pidfile path to be under /run instead. /run has been in use as a replacement for /var/run for many years now (the original Debian proposal is from 2011). Most distributions symlink /var/run to /run, which means that this change should not have any adverse side effects for the vast majority of users. Modified Paths: -------------- iscsi-scst/usr/iscsi_scstd.c | 2 +- scstadmin/init.d/scst | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) =================================================================== diff --git a/iscsi-scst/usr/iscsi_scstd.c b/iscsi-scst/usr/iscsi_scstd.c index 60b8309..99380c0 100644 --- a/iscsi-scst/usr/iscsi_scstd.c +++ b/iscsi-scst/usr/iscsi_scstd.c @@ -979,7 +979,7 @@ int main(int argc, char **argv) pid_t pid; int fd; - fd = open("/var/run/iscsi-scstd.pid", O_WRONLY|O_CREAT, 0644); + fd = open("/run/iscsi-scstd.pid", O_WRONLY|O_CREAT, 0644); if (fd < 0) { log_error("unable to create pid file"); exit(1); diff --git a/scstadmin/init.d/scst b/scstadmin/init.d/scst index 9490e1b..8b4497c 100755 --- a/scstadmin/init.d/scst +++ b/scstadmin/init.d/scst @@ -102,7 +102,7 @@ start_daemon() { killproc() { exe=$(basename "$1") killall "$exe" - rm -f "/var/run/$exe.pid" + rm -f "/run/$exe.pid" } fi @@ -275,8 +275,8 @@ stop_scst() { scst_status() { # Status has a slightly different meaning for the status command: # 0 - service running - # 1 - service dead, but /var/run/ pid file exists - # 2 - service dead, but /var/lock/ lock file exists + # 1 - service dead, but /run/ pid file exists + # 2 - service dead, but /run/lock/ lock file exists # 3 - service not running parse_scst_conf |
From: Gleb C. <lna...@ya...> - 2025-06-06 09:53:26
|
Commit: 1325d58 GitHub URL: https://github.com/SCST-project/scst/commit/1325d587b888c6e652b7b221b332dd3b5694bb83 Author: Gleb Chesnokov Date: 2025-06-06T12:52:15+03:00 Log Message: ----------- nightly build: Update kernel versions Update the supported kernel versions. Modified Paths: -------------- .github/workflows/run_regression_tests.yaml | 11 +++++++-- nightly/conf/nightly.conf | 19 +++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) =================================================================== diff --git a/.github/workflows/run_regression_tests.yaml b/.github/workflows/run_regression_tests.yaml index 6b310d0..7f32ea1 100644 --- a/.github/workflows/run_regression_tests.yaml +++ b/.github/workflows/run_regression_tests.yaml @@ -35,18 +35,25 @@ jobs: '5.14.0-570.12.1.el9_6^AlmaLinux^9.6', '5.14.0-503.16.1.el9_5^AlmaLinux^9.5', '5.14.0-427.42.1.el9_4^AlmaLinux^9.4', - '5.14.0-362.24.2.el9_3^AlmaLinux^9.3', + '5.14.0-362.24.1.el9_3^AlmaLinux^9.3', '5.14.0-284.30.1.el9_2^AlmaLinux^9.2', + '5.14.0-162.23.1.el9_1^AlmaLinux^9.1', + '5.14.0-70.30.1.el9_0^AlmaLinux^9.0', '4.18.0-553.53.1.el8_10^AlmaLinux^8.10', '4.18.0-513.24.1.el8_9^AlmaLinux^8.9', '4.18.0-477.13.1.el8_8^AlmaLinux^8.8', '4.18.0-425.19.2.el8_7^AlmaLinux^8.7', '4.18.0-372.32.1.el8_6^AlmaLinux^8.6', + '4.18.0-348.23.1.el8_5^AlmaLinux^8.5', + '4.18.0-305.25.1.el8_4^AlmaLinux^8.4', + '4.18.0-240.22.1.el8_3^AlmaLinux^8.3', '3.10.0-1160.118.1.el7^CentOS^7.9.2009', + '3.10.0-862.14.4.el7^CentOS^7.5.1804', '5.15.0-303.171.5.2.1.el9uek^UEK^9', '5.4.17-2136.338.4.2.el8uek^UEK^8', '4.14.35-2047.543.3.el7uek^UEK^7', - '4.1.12-124.92.3.el6uek^UEK^6' + '4.1.12-124.93.1.el7uek^UEK^7', + '4.1.12-124.48.6.el6uek^UEK^6' ] steps: - name: Checkout code diff --git a/nightly/conf/nightly.conf b/nightly/conf/nightly.conf index 1766cb6..cf6dbf9 100644 --- a/nightly/conf/nightly.conf +++ b/nightly/conf/nightly.conf @@ -70,7 +70,7 @@ ABT_KERNELS=" \ 5.14.0-570.12.1.el9_6^AlmaLinux^9.6-nc \ 5.14.0-503.16.1.el9_5^AlmaLinux^9.5-nc \ 5.14.0-427.42.1.el9_4^AlmaLinux^9.4-nc \ -5.14.0-362.24.2.el9_3^AlmaLinux^9.3-nc \ +5.14.0-362.24.1.el9_3^AlmaLinux^9.3-nc \ 5.14.0-284.30.1.el9_2^AlmaLinux^9.2-nc \ 5.14.0-162.23.1.el9_1^AlmaLinux^9.1-nc \ 5.14.0-70.30.1.el9_0^AlmaLinux^9.0-nc \ @@ -79,9 +79,9 @@ ABT_KERNELS=" \ 4.18.0-477.13.1.el8_8^AlmaLinux^8.8-nc \ 4.18.0-425.19.2.el8_7^AlmaLinux^8.7-nc \ 4.18.0-372.32.1.el8_6^AlmaLinux^8.6-nc \ -4.18.0-348.2.1.el8_5^CentOS^8.5.2111-nc \ -4.18.0-305.3.1.el8^CentOS^8.4.2105-nc \ -4.18.0-240.15.1.el8_3^CentOS^8.3.2011-nc \ +4.18.0-348.23.1.el8_5^AlmaLinux^8.5-nc \ +4.18.0-305.25.1.el8_4^AlmaLinux^8.4-nc \ +4.18.0-240.22.1.el8_3^AlmaLinux^8.3-nc \ 4.18.0-193.28.1.el8_2^CentOS^8.2.2004-nc \ 4.18.0-147.8.1.el8_1^CentOS^8.1.1911-nc \ 4.18.0-80.11.2.el8_0^CentOS^8.0.1905-nc \ @@ -91,15 +91,8 @@ ABT_KERNELS=" \ 3.10.0-957.27.2.el7^CentOS^7.6.1810-nc \ 3.10.0-862.14.4.el7^CentOS^7.5.1804-nc \ 5.15.0-303.171.5.2.1.el9uek^UEK^9-nc \ -5.15.0-303.171.5.2.1.el8uek^UEK^8-nc \ 5.4.17-2136.338.4.2.el8uek^UEK^8-nc \ -5.4.17-2102.206.1.el8uek^UEK^8-nc \ -5.4.17-2036.104.5.el8uek^UEK^8-nc \ -5.4.17-2011.7.4.el8uek^UEK^8-nc \ -5.4.17-2136.338.4.2.el7uek^UEK^7-nc \ -5.4.17-2102.206.1.el7uek^UEK^7-nc \ -5.4.17-2036.104.5.el7uek^UEK^7-nc \ -5.4.17-2011.7.4.el7uek^UEK^7-nc \ 4.14.35-2047.543.3.el7uek^UEK^7-nc \ -4.1.12-124.92.3.el6uek^UEK^6-nc \ +4.1.12-124.93.1.el7uek^UEK^7-nc \ +4.1.12-124.48.6.el6uek^UEK^6-nc \ " |
From: Gleb C. <lna...@ya...> - 2025-06-06 09:36:10
|
Commit: 4b61f2b GitHub URL: https://github.com/SCST-project/scst/commit/4b61f2b4ace034aeaacd9d94c2ced6c4bb9b4dfc Author: Gleb Chesnokov Date: 2025-06-06T12:33:37+03:00 Log Message: ----------- scst.h: Fix RHEL 9 build Fixes: https://github.com/SCST-project/scst/issues/294 Modified Paths: -------------- qla2x00t-32gbit/qla_os.c | 8 ++++++-- scst/include/scst.h | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) =================================================================== diff --git a/qla2x00t-32gbit/qla_os.c b/qla2x00t-32gbit/qla_os.c index f6d8a51..6263d32 100644 --- a/qla2x00t-32gbit/qla_os.c +++ b/qla2x00t-32gbit/qla_os.c @@ -1997,7 +1997,9 @@ qla2xxx_slave_configure(struct scsi_device *sdev) scsi_qla_host_t *vha = shost_priv(sdev->host); struct req_que *req = vha->req; -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 6)) if (IS_T10_PI_CAPABLE(vha->hw)) blk_queue_update_dma_alignment(sdev->request_queue, 0x7); #endif @@ -3638,7 +3640,9 @@ skip_dpc: QLA_SG_ALL : 128; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0) || \ + (defined(RHEL_RELEASE_CODE) && \ + RHEL_RELEASE_CODE -0 >= RHEL_RELEASE_VERSION(9, 6)) if (IS_T10_PI_CAPABLE(base_vha->hw)) host->dma_alignment = 0x7; #endif diff --git a/scst/include/scst.h b/scst/include/scst.h index 878a125..f0a7e3e 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -5651,14 +5651,15 @@ __scst_scsi_execute_cmd(struct scsi_device *sdev, const unsigned char *cmd, unsigned char *sense, unsigned int sense_len, int timeout, int retries, blk_opf_t opf) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 3)) if (WARN_ON_ONCE(sense && sense_len != SCSI_SENSE_BUFFERSIZE)) return -EINVAL; #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) return scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, timeout, retries, opf, /*resid=*/NULL); - #elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0) && \ (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 8) return scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, @@ -5669,7 +5670,6 @@ __scst_scsi_execute_cmd(struct scsi_device *sdev, const unsigned char *cmd, /*sshdr=*/NULL, timeout, retries, opf, /*rq_flags=*/0, /*resid=*/NULL); #endif - #else opf |= data_direction == DMA_TO_DEVICE ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN; |
From: Gleb C. <lna...@ya...> - 2025-06-06 09:35:44
|
Commit: 0642b05 GitHub URL: https://github.com/SCST-project/scst/commit/0642b05bc557fa333525b1b2fed5ac68281b0134 Author: Gleb Chesnokov Date: 2025-06-06T12:33:36+03:00 Log Message: ----------- scst: Add RHEL 8.10 and 9.6 kernel support Add compatibility for RHEL 8.10 and RHEL 9.6 kernels. Update nightly build and regression test configs, and adjust version checks in the codebase to handle changes in these new RHEL kernel releases. Modified Paths: -------------- .github/workflows/run_regression_tests.yaml | 4 +-- nightly/conf/nightly.conf | 2 ++ scst/include/backport.h | 4 ++- scst/src/dev_handlers/scst_vdisk.c | 4 ++- scst/src/scst_lib.c | 19 +++++++++------ scst_local/scst_local.c | 8 ++++-- 6 files changed, 28 insertions(+), 13 deletions(-) =================================================================== diff --git a/.github/workflows/run_regression_tests.yaml b/.github/workflows/run_regression_tests.yaml index dd07c1c..6b310d0 100644 --- a/.github/workflows/run_regression_tests.yaml +++ b/.github/workflows/run_regression_tests.yaml @@ -4,11 +4,9 @@ on: push: branches: - 3.9.x - - master pull_request: branches: - 3.9.x - - master jobs: regression_tests: @@ -34,10 +32,12 @@ jobs: '4.9.337', '3.18.140', '3.10.108', + '5.14.0-570.12.1.el9_6^AlmaLinux^9.6', '5.14.0-503.16.1.el9_5^AlmaLinux^9.5', '5.14.0-427.42.1.el9_4^AlmaLinux^9.4', '5.14.0-362.24.2.el9_3^AlmaLinux^9.3', '5.14.0-284.30.1.el9_2^AlmaLinux^9.2', + '4.18.0-553.53.1.el8_10^AlmaLinux^8.10', '4.18.0-513.24.1.el8_9^AlmaLinux^8.9', '4.18.0-477.13.1.el8_8^AlmaLinux^8.8', '4.18.0-425.19.2.el8_7^AlmaLinux^8.7', diff --git a/nightly/conf/nightly.conf b/nightly/conf/nightly.conf index acceb08..1766cb6 100644 --- a/nightly/conf/nightly.conf +++ b/nightly/conf/nightly.conf @@ -67,12 +67,14 @@ ABT_KERNELS=" \ 3.12.74-nc \ 3.11.10-nc \ 3.10.108-nc \ +5.14.0-570.12.1.el9_6^AlmaLinux^9.6-nc \ 5.14.0-503.16.1.el9_5^AlmaLinux^9.5-nc \ 5.14.0-427.42.1.el9_4^AlmaLinux^9.4-nc \ 5.14.0-362.24.2.el9_3^AlmaLinux^9.3-nc \ 5.14.0-284.30.1.el9_2^AlmaLinux^9.2-nc \ 5.14.0-162.23.1.el9_1^AlmaLinux^9.1-nc \ 5.14.0-70.30.1.el9_0^AlmaLinux^9.0-nc \ +4.18.0-553.53.1.el8_10^AlmaLinux^8.10-nc \ 4.18.0-513.24.1.el8_9^AlmaLinux^8.9-nc \ 4.18.0-477.13.1.el8_8^AlmaLinux^8.8-nc \ 4.18.0-425.19.2.el8_7^AlmaLinux^8.7-nc \ diff --git a/scst/include/backport.h b/scst/include/backport.h index 803fcf6..70ed719 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -677,7 +677,9 @@ static inline u32 int_sqrt64(u64 x) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 5, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 5, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 6)) static inline long get_user_pages_backport(unsigned long start, unsigned long nr_pages, unsigned int gup_flags, diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 90c565e..8f4a3d7 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -968,7 +968,9 @@ static int vdisk_init_block_integrity(struct scst_vdisk_dev *virt_dev) #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) bi_profile_name = bi->name; -#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0) +#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 6)) bi_profile_name = bi->profile->name; #else bi_profile_name = blk_integrity_profile_name(bi); diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 50d60e3..1e67ab9 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -8398,8 +8398,9 @@ scst_free_bio(struct bio *bio) #endif } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) || \ -(defined(CONFIG_SUSE_KERNEL) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) || \ + (defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) static struct request *blk_make_request(struct request_queue *q, struct bio *bio, gfp_t gfp_mask) @@ -8447,7 +8448,9 @@ static struct request *blk_make_request(struct request_queue *q, static inline unsigned int queue_dma_pad_mask(const struct request_queue *q) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 6)) return q->dma_pad_mask; #else return q->limits.dma_pad_mask; @@ -15358,14 +15361,16 @@ out_unlock: void scst_vfs_unlink_and_put(struct path *path) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) && \ - (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 7) && \ - (!defined(CONFIG_SUSE_KERNEL) || \ +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) && \ + (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 7) && \ + (!defined(CONFIG_SUSE_KERNEL) || \ LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)) vfs_unlink(path->dentry->d_parent->d_inode, path->dentry); #elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0) vfs_unlink(path->dentry->d_parent->d_inode, path->dentry, NULL); -#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) +#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 6)) vfs_unlink(&init_user_ns, path->dentry->d_parent->d_inode, path->dentry, NULL); #else diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index ae6ab0f..6547b57 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -1023,7 +1023,9 @@ out: #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 6)) static int scst_local_slave_alloc(struct scsi_device *sdev) { struct request_queue *q = sdev->request_queue; @@ -1365,7 +1367,9 @@ static const struct scsi_host_template scst_lcl_ini_driver_template = { .name = SCST_LOCAL_NAME, .queuecommand = scst_local_queuecommand, .change_queue_depth = scst_local_change_queue_depth, -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 6)) .slave_alloc = scst_local_slave_alloc, #else .dma_alignment = (4096 - 1), |
From: Gleb C. <lna...@ya...> - 2025-06-06 09:34:54
|
Commit: a0a076e GitHub URL: https://github.com/SCST-project/scst/commit/a0a076e04edf28b894b9ed8f7c09ae58c2959b7f Author: Gleb Chesnokov Date: 2025-06-06T12:33:36+03:00 Log Message: ----------- .github/workflows: Improve regression test failure detection in GitHub Actions Update the run_regression_tests workflow to fail if "Compiling the patched kernel" is missing or if any non-zero error count ("N errors") or "FAILED" is detected after the marker. The previous check missed multi-digit error counts and did not handle a missing marker, which could result in undetected failures. Modified Paths: -------------- .github/workflows/run_regression_tests.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) =================================================================== diff --git a/.github/workflows/run_regression_tests.yaml b/.github/workflows/run_regression_tests.yaml index 6794cd5..dd07c1c 100644 --- a/.github/workflows/run_regression_tests.yaml +++ b/.github/workflows/run_regression_tests.yaml @@ -74,7 +74,15 @@ jobs: ./scripts/run-regression-tests -l -q -k -d /tmp/scst-${{matrix.version}} ${{matrix.version}}-nc-ns-nm | tee output.txt - cat output.txt | grep -A1 "Compiling the patched kernel" | grep -e "FAILED" -e "[^0] errors" > /dev/null 2>&1 && err=1 + if ! grep -q "Compiling the patched kernel" output.txt; then + echo "::error ::run-regression-tests failed" + err=1 + else + if grep -A1 "Compiling the patched kernel" output.txt | grep -E -q "FAILED|[1-9][0-9]* errors"; then + echo "::error ::Regression test failed" + err=1 + fi + fi rm -f output.txt |
From: Gleb C. <lna...@ya...> - 2025-06-06 09:32:09
|
Commit: 17eb80e GitHub URL: https://github.com/SCST-project/scst/commit/17eb80e049f170120f7c0c0abfc1798a12b28700 Author: Gleb Chesnokov Date: 2025-06-06T12:31:21+03:00 Log Message: ----------- nightly build: Add RHEL 10 kernel support Add AlmaLinux 10.0 kernel to nightly build configs and update helper scripts to handle AlmaLinux 10.0 package sources. Modified Paths: -------------- .github/workflows/run_regression_tests.yaml | 1 + nightly/conf/nightly.conf | 1 + scripts/rhel-rpm-functions | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) =================================================================== diff --git a/.github/workflows/run_regression_tests.yaml b/.github/workflows/run_regression_tests.yaml index 3a85f0e..65e4d77 100644 --- a/.github/workflows/run_regression_tests.yaml +++ b/.github/workflows/run_regression_tests.yaml @@ -35,6 +35,7 @@ jobs: '4.9.337', '3.18.140', '3.10.108', + '6.12.0-55.9.1.el10_0^AlmaLinux^10.0', '5.14.0-570.12.1.el9_6^AlmaLinux^9.6', '5.14.0-503.40.1.el9_5^AlmaLinux^9.5', '5.14.0-427.42.1.el9_4^AlmaLinux^9.4', diff --git a/nightly/conf/nightly.conf b/nightly/conf/nightly.conf index 0fa92c4..8f1011f 100644 --- a/nightly/conf/nightly.conf +++ b/nightly/conf/nightly.conf @@ -70,6 +70,7 @@ ABT_KERNELS=" \ 3.12.74-nc \ 3.11.10-nc \ 3.10.108-nc \ +6.12.0-55.9.1.el10_0^AlmaLinux^10.0-nc \ 5.14.0-570.12.1.el9_6^AlmaLinux^9.6-nc \ 5.14.0-503.40.1.el9_5^AlmaLinux^9.5-nc \ 5.14.0-427.42.1.el9_4^AlmaLinux^9.4-nc \ diff --git a/scripts/rhel-rpm-functions b/scripts/rhel-rpm-functions index c422946..b7f535f 100644 --- a/scripts/rhel-rpm-functions +++ b/scripts/rhel-rpm-functions @@ -37,7 +37,7 @@ function get_srpm_urls() { ;; "AlmaLinux") case $releasever in - [89]*) + [89]*|10*) echo "https://repo.almalinux.org/vault/${releasever}/BaseOS/Source/Packages/";; esac ;; @@ -97,7 +97,7 @@ function get_rpm_urls() { echo "";; "AlmaLinux") case $releasever in - [89]*) + [89]*|10*) echo "https://mirror.yandex.ru/almalinux/${releasever}/BaseOS/${arch}/os/Packages/";; esac ;; |
From: Gleb C. <lna...@ya...> - 2025-06-06 09:31:50
|
Commit: 02167c4 GitHub URL: https://github.com/SCST-project/scst/commit/02167c4028b48bd042acc9cb77b30bebf022ddc4 Author: Gleb Chesnokov Date: 2025-06-06T12:31:21+03:00 Log Message: ----------- scst.h: Fix RHEL 9 build Fixes: https://github.com/SCST-project/scst/issues/294 Modified Paths: -------------- qla2x00t-32gbit/qla_os.c | 8 ++++++-- scst/include/scst.h | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) =================================================================== diff --git a/qla2x00t-32gbit/qla_os.c b/qla2x00t-32gbit/qla_os.c index 36d8c0a..24f45ff 100644 --- a/qla2x00t-32gbit/qla_os.c +++ b/qla2x00t-32gbit/qla_os.c @@ -2006,7 +2006,9 @@ qla2xxx_sdev_configure(struct scsi_device *sdev, struct queue_limits *lim) scsi_qla_host_t *vha = shost_priv(sdev->host); struct req_que *req = vha->req; -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 6)) if (IS_T10_PI_CAPABLE(vha->hw)) blk_queue_update_dma_alignment(sdev->request_queue, 0x7); #endif @@ -3658,7 +3660,9 @@ skip_dpc: QLA_SG_ALL : 128; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0) || \ + (defined(RHEL_RELEASE_CODE) && \ + RHEL_RELEASE_CODE -0 >= RHEL_RELEASE_VERSION(9, 6)) if (IS_T10_PI_CAPABLE(base_vha->hw)) host->dma_alignment = 0x7; #endif diff --git a/scst/include/scst.h b/scst/include/scst.h index 878a125..f0a7e3e 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -5651,14 +5651,15 @@ __scst_scsi_execute_cmd(struct scsi_device *sdev, const unsigned char *cmd, unsigned char *sense, unsigned int sense_len, int timeout, int retries, blk_opf_t opf) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 3)) if (WARN_ON_ONCE(sense && sense_len != SCSI_SENSE_BUFFERSIZE)) return -EINVAL; #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) return scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, timeout, retries, opf, /*resid=*/NULL); - #elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0) && \ (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 8) return scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense, @@ -5669,7 +5670,6 @@ __scst_scsi_execute_cmd(struct scsi_device *sdev, const unsigned char *cmd, /*sshdr=*/NULL, timeout, retries, opf, /*rq_flags=*/0, /*resid=*/NULL); #endif - #else opf |= data_direction == DMA_TO_DEVICE ? REQ_OP_DRV_OUT : REQ_OP_DRV_IN; |
From: Gleb C. <lna...@ya...> - 2025-05-26 14:40:54
|
Commit: 15ebdec GitHub URL: https://github.com/SCST-project/scst/commit/15ebdec40398eb95c8d05940bfb9033302e45760 Author: Gleb Chesnokov Date: 2025-05-26T17:37:09+03:00 Log Message: ----------- nightly build: Add UEK 8 kernel support Add Oracle Linux UEK 8 kernel to nightly build configs and update helper scripts to handle UEK 8 package sources. Modified Paths: -------------- .github/workflows/run_regression_tests.yaml | 1 + nightly/conf/nightly.conf | 1 + scripts/rhel-rpm-functions | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) =================================================================== diff --git a/.github/workflows/run_regression_tests.yaml b/.github/workflows/run_regression_tests.yaml index 9fb00c1..3a85f0e 100644 --- a/.github/workflows/run_regression_tests.yaml +++ b/.github/workflows/run_regression_tests.yaml @@ -52,6 +52,7 @@ jobs: '4.18.0-240.22.1.el8_3^AlmaLinux^8.3', '3.10.0-1160.118.1.el7^CentOS^7.9.2009', '3.10.0-862.14.4.el7^CentOS^7.5.1804', + '6.12.0-0.20.20.el9uek^UEK^9', '5.15.0-308.179.6.3.el9uek^UEK^9', '5.4.17-2136.343.5.1.el8uek^UEK^8', '4.14.35-2047.543.3.1.el7uek^UEK^7', diff --git a/nightly/conf/nightly.conf b/nightly/conf/nightly.conf index acd653f..0fa92c4 100644 --- a/nightly/conf/nightly.conf +++ b/nightly/conf/nightly.conf @@ -93,6 +93,7 @@ ABT_KERNELS=" \ 3.10.0-1062.18.1.el7^CentOS^7.7.1908-nc \ 3.10.0-957.27.2.el7^CentOS^7.6.1810-nc \ 3.10.0-862.14.4.el7^CentOS^7.5.1804-nc \ +6.12.0-0.20.20.el9uek^UEK^9-nc \ 5.15.0-308.179.6.3.el9uek^UEK^9-nc \ 5.4.17-2136.343.5.1.el8uek^UEK^8-nc \ 4.14.35-2047.543.3.1.el7uek^UEK^7-nc \ diff --git a/scripts/rhel-rpm-functions b/scripts/rhel-rpm-functions index 7ca3ef5..c422946 100644 --- a/scripts/rhel-rpm-functions +++ b/scripts/rhel-rpm-functions @@ -44,7 +44,7 @@ function get_srpm_urls() { "Oracle Linux Server"|"UEK") echo "http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/${releaseverminor}/base/${arch}/getPackageSource" echo "http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/latest/${arch}/getPackageSource" - for ((i=4;i<=7;i++)); do + for ((i=4;i<=8;i++)); do echo "http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/UEKR$i/${arch}/getPackageSource" done ;; @@ -104,7 +104,7 @@ function get_rpm_urls() { "Oracle Linux Server"|"UEK") echo "http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/${releaseverminor}/base/${arch}/getPackageSource" echo "http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/latest/${arch}/getPackageSource" - for ((i=4;i<=7;i++)); do + for ((i=4;i<=8;i++)); do echo "http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/UEKR$i/${arch}/getPackageSource" done ;; |
From: Gleb C. <lna...@ya...> - 2025-05-26 14:40:19
|
Commit: ac41d32 GitHub URL: https://github.com/SCST-project/scst/commit/ac41d325f30101b1122ba1ebe7d6634d2c0e1328 Author: Gleb Chesnokov Date: 2025-05-26T17:37:09+03:00 Log Message: ----------- scst: Fix backport for stable, RHEL, and UEK kernels Update backport logic to support recent stable, RHEL, and UEK kernel versions. Adjust version checks and compatibility for sysfs_emit, timer_delete, and related helpers. Fixes: 0e8fdad5e48c ("scst: Use sysfs_emit/sysfs_emit_at instead of scnprintf()") Fixes: d21b6f1457f1 ("scst: Port to Linux kernel v6.15") Modified Paths: -------------- qla2x00t-32gbit/qla_os.c | 9 +++++++- scst/include/backport.h | 17 ++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) =================================================================== diff --git a/qla2x00t-32gbit/qla_os.c b/qla2x00t-32gbit/qla_os.c index 37417ee..36d8c0a 100644 --- a/qla2x00t-32gbit/qla_os.c +++ b/qla2x00t-32gbit/qla_os.c @@ -2949,7 +2949,14 @@ static void qla2x00_iocb_work_fn(struct work_struct *work) static void qla_trace_init(void) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0) && \ + (LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(6, 6, 0) >> 8 || \ + LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 87)) + /* + * See also commit d23569979ca1 ("tracing: Allow creating instances with specified system + * events") # v6.8. + * See also commit f568fbe8c603 # v6.6.87. + */ qla_trc_array = trace_array_get_by_name("qla2xxx"); #else qla_trc_array = trace_array_get_by_name("qla2xxx", NULL); diff --git a/scst/include/backport.h b/scst/include/backport.h index aa60068..a9f2225 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -43,6 +43,7 @@ #include <linux/string.h> #include <linux/sysfs.h> #include <linux/timer.h> +#include <linux/usb/quirks.h> #include <linux/vmalloc.h> #include <linux/workqueue.h> #include <linux/writeback.h> /* sync_page_range() */ @@ -1498,7 +1499,8 @@ static inline void __user *KERNEL_SOCKPTR(void *p) /* <linux/string.h> */ #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) && \ - (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 7) + (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 7) && \ + (!defined(UEK_KABI_RENAME) || !defined(USB_QUIRK_NO_LPM)) /* See also commit e9d408e107db ("new helper: memdup_user_nul()") # v4.5 */ static inline void *memdup_user_nul(const void __user *src, size_t len) { @@ -1576,7 +1578,10 @@ static inline ssize_t strscpy(char *dest, const char *src, size_t count) (LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(4, 19, 0) >> 8 || \ LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 179)) && \ (LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(5, 4, 0) >> 8 || \ - LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 103)) + LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 103)) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(8, 5)) && \ + !defined(UEK_KABI_RENAME) /* * See also commit 2efc459d06f1 ("sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output") * # v5.10. @@ -1664,6 +1669,9 @@ struct t10_pi_tuple { LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 154)) && \ (LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(6, 1, 0) >> 8 || \ LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 84)) && \ + (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 8 || \ + RHEL_MAJOR -0 == 8 && RHEL_MINOR -0 < 9 || \ + RHEL_MAJOR -0 == 9 && RHEL_MINOR -0 < 3) && \ (!defined(UEK_KABI_RENAME) || \ LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 17)) /* @@ -1683,7 +1691,10 @@ static inline int timer_delete_sync(struct timer_list *timer) #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0) && \ (LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(6, 1, 0) >> 8 || \ - LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 91)) + LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 91)) && \ + (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 8 || \ + RHEL_MAJOR -0 == 8 && RHEL_MINOR -0 < 9 || \ + RHEL_MAJOR -0 == 9 && RHEL_MINOR -0 < 3) /* * See also commit bb663f0f3c39 ("timers: Rename del_timer() to timer_delete()") # v6.2. * See also commit b086d1e82fcd # v6.1.91. |
From: Gleb C. <lna...@ya...> - 2025-05-26 14:40:19
|
Commit: 44bd290 GitHub URL: https://github.com/SCST-project/scst/commit/44bd290fea04df4a918ebd08dfc7fbffeebbb5e7 Author: Gleb Chesnokov Date: 2025-05-26T17:37:09+03:00 Log Message: ----------- scst: Add RHEL 8.10 and 9.6 kernel support Add compatibility for RHEL 8.10 and RHEL 9.6 kernels. Update nightly build and regression test configs, and adjust version checks in the codebase to handle changes in these new RHEL kernel releases. Modified Paths: -------------- .github/workflows/run_regression_tests.yaml | 2 ++ nightly/conf/nightly.conf | 2 ++ scst/include/backport.h | 4 ++- scst/src/dev_handlers/scst_vdisk.c | 4 ++- scst/src/scst_lib.c | 19 +++++++++------ scst_local/scst_local.c | 8 ++++-- 6 files changed, 28 insertions(+), 11 deletions(-) =================================================================== diff --git a/.github/workflows/run_regression_tests.yaml b/.github/workflows/run_regression_tests.yaml index 0496ed4..9fb00c1 100644 --- a/.github/workflows/run_regression_tests.yaml +++ b/.github/workflows/run_regression_tests.yaml @@ -35,12 +35,14 @@ jobs: '4.9.337', '3.18.140', '3.10.108', + '5.14.0-570.12.1.el9_6^AlmaLinux^9.6', '5.14.0-503.40.1.el9_5^AlmaLinux^9.5', '5.14.0-427.42.1.el9_4^AlmaLinux^9.4', '5.14.0-362.24.1.el9_3^AlmaLinux^9.3', '5.14.0-284.30.1.el9_2^AlmaLinux^9.2', '5.14.0-162.23.1.el9_1^AlmaLinux^9.1', '5.14.0-70.30.1.el9_0^AlmaLinux^9.0', + '4.18.0-553.53.1.el8_10^AlmaLinux^8.10', '4.18.0-513.24.1.el8_9^AlmaLinux^8.9', '4.18.0-477.13.1.el8_8^AlmaLinux^8.8', '4.18.0-425.19.2.el8_7^AlmaLinux^8.7', diff --git a/nightly/conf/nightly.conf b/nightly/conf/nightly.conf index fcde698..acd653f 100644 --- a/nightly/conf/nightly.conf +++ b/nightly/conf/nightly.conf @@ -70,12 +70,14 @@ ABT_KERNELS=" \ 3.12.74-nc \ 3.11.10-nc \ 3.10.108-nc \ +5.14.0-570.12.1.el9_6^AlmaLinux^9.6-nc \ 5.14.0-503.40.1.el9_5^AlmaLinux^9.5-nc \ 5.14.0-427.42.1.el9_4^AlmaLinux^9.4-nc \ 5.14.0-362.24.1.el9_3^AlmaLinux^9.3-nc \ 5.14.0-284.30.1.el9_2^AlmaLinux^9.2-nc \ 5.14.0-162.23.1.el9_1^AlmaLinux^9.1-nc \ 5.14.0-70.30.1.el9_0^AlmaLinux^9.0-nc \ +4.18.0-553.53.1.el8_10^AlmaLinux^8.10-nc \ 4.18.0-513.24.1.el8_9^AlmaLinux^8.9-nc \ 4.18.0-477.13.1.el8_8^AlmaLinux^8.8-nc \ 4.18.0-425.19.2.el8_7^AlmaLinux^8.7-nc \ diff --git a/scst/include/backport.h b/scst/include/backport.h index a9f2225..72e2972 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -689,7 +689,9 @@ static inline u32 int_sqrt64(u64 x) } #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 5, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 5, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 6)) static inline long get_user_pages_backport(unsigned long start, unsigned long nr_pages, unsigned int gup_flags, diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index de8801d..f552963 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -968,7 +968,9 @@ static int vdisk_init_block_integrity(struct scst_vdisk_dev *virt_dev) #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 0) bi_profile_name = bi->name; -#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0) +#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 6)) bi_profile_name = bi->profile->name; #else bi_profile_name = blk_integrity_profile_name(bi); diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 979caae..7eda3aa 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -8401,8 +8401,9 @@ scst_free_bio(struct bio *bio) #endif } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) || \ -(defined(CONFIG_SUSE_KERNEL) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) || \ + (defined(CONFIG_SUSE_KERNEL) && \ + LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) static struct request *blk_make_request(struct request_queue *q, struct bio *bio, gfp_t gfp_mask) @@ -8450,7 +8451,9 @@ static struct request *blk_make_request(struct request_queue *q, static inline unsigned int queue_dma_pad_mask(const struct request_queue *q) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 11, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 6)) return q->dma_pad_mask; #else return q->limits.dma_pad_mask; @@ -15365,14 +15368,16 @@ out_unlock: void scst_vfs_unlink_and_put(struct path *path) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) && \ - (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 7) && \ - (!defined(CONFIG_SUSE_KERNEL) || \ +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) && \ + (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 7) && \ + (!defined(CONFIG_SUSE_KERNEL) || \ LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)) vfs_unlink(path->dentry->d_parent->d_inode, path->dentry); #elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0) vfs_unlink(path->dentry->d_parent->d_inode, path->dentry, NULL); -#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) +#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 6)) vfs_unlink(&init_user_ns, path->dentry->d_parent->d_inode, path->dentry, NULL); #else diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index 723962c..4e83358 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -1032,7 +1032,9 @@ out: #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 6)) static int scst_local_slave_alloc(struct scsi_device *sdev) { struct request_queue *q = sdev->request_queue; @@ -1378,7 +1380,9 @@ static const struct scsi_host_template scst_lcl_ini_driver_template = { .name = SCST_LOCAL_NAME, .queuecommand = scst_local_queuecommand, .change_queue_depth = scst_local_change_queue_depth, -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0) && \ + (!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(9, 6)) .slave_alloc = scst_local_slave_alloc, #else .dma_alignment = (4096 - 1), |
From: Gleb C. <lna...@ya...> - 2025-05-26 14:39:29
|
Commit: 15695fe GitHub URL: https://github.com/SCST-project/scst/commit/15695fedce3ce2ac66aec186ba082ac2451056b0 Author: Gleb Chesnokov Date: 2025-05-26T17:37:09+03:00 Log Message: ----------- nightly build: Update kernel versions Another kernel versions update Modified Paths: -------------- .github/workflows/run_regression_tests.yaml | 36 +++++++----- nightly/conf/nightly.conf | 44 +++++++-------- 2 files changed, 41 insertions(+), 39 deletions(-) =================================================================== diff --git a/.github/workflows/run_regression_tests.yaml b/.github/workflows/run_regression_tests.yaml index cc81c12..0496ed4 100644 --- a/.github/workflows/run_regression_tests.yaml +++ b/.github/workflows/run_regression_tests.yaml @@ -16,37 +16,45 @@ jobs: fail-fast: false matrix: version: [ - '6.14', - '6.13.8', - '6.12.20', + '6.15', + '6.14.8', + '6.13.12', + '6.12.30', '6.11.11', '6.10.14', '6.9.12', '6.8.12', '6.7.12', - '6.6.83', - '6.1.131', - '5.15.179', - '5.10.235', - '5.4.291', + '6.6.92', + '6.1.140', + '5.15.184', + '5.10.237', + '5.4.293', '4.19.325', '4.14.336', '4.9.337', '3.18.140', '3.10.108', - '5.14.0-503.33.1.el9_5^AlmaLinux^9.5', + '5.14.0-503.40.1.el9_5^AlmaLinux^9.5', '5.14.0-427.42.1.el9_4^AlmaLinux^9.4', - '5.14.0-362.24.2.el9_3^AlmaLinux^9.3', + '5.14.0-362.24.1.el9_3^AlmaLinux^9.3', '5.14.0-284.30.1.el9_2^AlmaLinux^9.2', + '5.14.0-162.23.1.el9_1^AlmaLinux^9.1', + '5.14.0-70.30.1.el9_0^AlmaLinux^9.0', '4.18.0-513.24.1.el8_9^AlmaLinux^8.9', '4.18.0-477.13.1.el8_8^AlmaLinux^8.8', '4.18.0-425.19.2.el8_7^AlmaLinux^8.7', '4.18.0-372.32.1.el8_6^AlmaLinux^8.6', + '4.18.0-348.23.1.el8_5^AlmaLinux^8.5', + '4.18.0-305.25.1.el8_4^AlmaLinux^8.4', + '4.18.0-240.22.1.el8_3^AlmaLinux^8.3', '3.10.0-1160.118.1.el7^CentOS^7.9.2009', - '5.15.0-306.177.4.el9uek^UEK^9', - '5.4.17-2136.341.3.3.el8uek^UEK^8', - '4.14.35-2047.543.3.el7uek^UEK^7', - '4.1.12-124.92.3.el6uek^UEK^6' + '3.10.0-862.14.4.el7^CentOS^7.5.1804', + '5.15.0-308.179.6.3.el9uek^UEK^9', + '5.4.17-2136.343.5.1.el8uek^UEK^8', + '4.14.35-2047.543.3.1.el7uek^UEK^7', + '4.1.12-124.93.1.el7uek^UEK^7', + '4.1.12-124.48.6.el6uek^UEK^6' ] steps: - name: Checkout code diff --git a/nightly/conf/nightly.conf b/nightly/conf/nightly.conf index 76d1d80..fcde698 100644 --- a/nightly/conf/nightly.conf +++ b/nightly/conf/nightly.conf @@ -3,37 +3,38 @@ ABT_DETAILS="x86_64" ABT_JOBS=5 ABT_KERNELS=" \ -6.14 \ -6.13.8-nc \ -6.12.20-nc \ +6.15 \ +6.14.8-nc \ +6.13.12-nc \ +6.12.30-nc \ 6.11.11-nc \ 6.10.14-nc \ 6.9.12-nc \ 6.8.12-nc \ 6.7.12-nc \ -6.6.83-nc \ +6.6.92-nc \ 6.5.13-nc \ 6.4.16-nc \ 6.3.13-nc \ 6.2.16-nc \ -6.1.131-nc \ +6.1.140-nc \ 6.0.19-nc \ 5.19.17-nc \ 5.18.19-nc \ 5.17.15-nc \ 5.16.20-nc \ -5.15.179-nc \ +5.15.184-nc \ 5.14.21-nc \ 5.13.19-nc \ 5.12.19-nc \ 5.11.22-nc \ -5.10.235-nc \ +5.10.237-nc \ 5.9.16-nc \ 5.8.18-nc \ 5.7.19-nc \ 5.6.19-nc \ 5.5.19-nc \ -5.4.291-nc \ +5.4.293-nc \ 5.3.18-nc \ 5.2.21-nc \ 5.1.21-nc \ @@ -69,9 +70,9 @@ ABT_KERNELS=" \ 3.12.74-nc \ 3.11.10-nc \ 3.10.108-nc \ -5.14.0-503.33.1.el9_5^AlmaLinux^9.5-nc \ +5.14.0-503.40.1.el9_5^AlmaLinux^9.5-nc \ 5.14.0-427.42.1.el9_4^AlmaLinux^9.4-nc \ -5.14.0-362.24.2.el9_3^AlmaLinux^9.3-nc \ +5.14.0-362.24.1.el9_3^AlmaLinux^9.3-nc \ 5.14.0-284.30.1.el9_2^AlmaLinux^9.2-nc \ 5.14.0-162.23.1.el9_1^AlmaLinux^9.1-nc \ 5.14.0-70.30.1.el9_0^AlmaLinux^9.0-nc \ @@ -79,9 +80,9 @@ ABT_KERNELS=" \ 4.18.0-477.13.1.el8_8^AlmaLinux^8.8-nc \ 4.18.0-425.19.2.el8_7^AlmaLinux^8.7-nc \ 4.18.0-372.32.1.el8_6^AlmaLinux^8.6-nc \ -4.18.0-348.2.1.el8_5^CentOS^8.5.2111-nc \ -4.18.0-305.3.1.el8^CentOS^8.4.2105-nc \ -4.18.0-240.15.1.el8_3^CentOS^8.3.2011-nc \ +4.18.0-348.23.1.el8_5^AlmaLinux^8.5-nc \ +4.18.0-305.25.1.el8_4^AlmaLinux^8.4-nc \ +4.18.0-240.22.1.el8_3^AlmaLinux^8.3-nc \ 4.18.0-193.28.1.el8_2^CentOS^8.2.2004-nc \ 4.18.0-147.8.1.el8_1^CentOS^8.1.1911-nc \ 4.18.0-80.11.2.el8_0^CentOS^8.0.1905-nc \ @@ -90,16 +91,9 @@ ABT_KERNELS=" \ 3.10.0-1062.18.1.el7^CentOS^7.7.1908-nc \ 3.10.0-957.27.2.el7^CentOS^7.6.1810-nc \ 3.10.0-862.14.4.el7^CentOS^7.5.1804-nc \ -5.15.0-306.177.4.el9uek^UEK^9-nc \ -5.15.0-306.177.4.el8uek^UEK^8-nc \ -5.4.17-2136.341.3.3.el8uek^UEK^8-nc \ -5.4.17-2102.206.1.el8uek^UEK^8-nc \ -5.4.17-2036.104.5.el8uek^UEK^8-nc \ -5.4.17-2011.7.4.el8uek^UEK^8-nc \ -5.4.17-2136.341.3.3.el7uek^UEK^7-nc \ -5.4.17-2102.206.1.el7uek^UEK^7-nc \ -5.4.17-2036.104.5.el7uek^UEK^7-nc \ -5.4.17-2011.7.4.el7uek^UEK^7-nc \ -4.14.35-2047.543.3.el7uek^UEK^7-nc \ -4.1.12-124.92.3.el6uek^UEK^6-nc \ +5.15.0-308.179.6.3.el9uek^UEK^9-nc \ +5.4.17-2136.343.5.1.el8uek^UEK^8-nc \ +4.14.35-2047.543.3.1.el7uek^UEK^7-nc \ +4.1.12-124.93.1.el7uek^UEK^7-nc \ +4.1.12-124.48.6.el6uek^UEK^6-nc \ " |
From: Gleb C. <lna...@ya...> - 2025-05-26 14:38:11
|
Commit: fdbb34c GitHub URL: https://github.com/SCST-project/scst/commit/fdbb34c77e702c751cf96f19c5dd1b0985465436 Author: Gleb Chesnokov Date: 2025-05-26T17:37:09+03:00 Log Message: ----------- .github/workflows: Improve regression test failure detection in GitHub Actions Update the run_regression_tests workflow to fail if "Compiling the patched kernel" is missing or if any non-zero error count ("N errors") or "FAILED" is detected after the marker. The previous check missed multi-digit error counts and did not handle a missing marker, which could result in undetected failures. Modified Paths: -------------- .github/workflows/run_regression_tests.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) =================================================================== diff --git a/.github/workflows/run_regression_tests.yaml b/.github/workflows/run_regression_tests.yaml index 16c03cf..cc81c12 100644 --- a/.github/workflows/run_regression_tests.yaml +++ b/.github/workflows/run_regression_tests.yaml @@ -74,7 +74,15 @@ jobs: ./scripts/run-regression-tests -l -q -k -d /tmp/scst-${{matrix.version}} ${{matrix.version}}-nc-ns-nm | tee output.txt - cat output.txt | grep -A1 "Compiling the patched kernel" | grep -e "FAILED" -e "[^0] errors" > /dev/null 2>&1 && err=1 + if ! grep -q "Compiling the patched kernel" output.txt; then + echo "::error ::run-regression-tests failed" + err=1 + else + if grep -A1 "Compiling the patched kernel" output.txt | grep -E -q "FAILED|[1-9][0-9]* errors"; then + echo "::error ::Regression test failed" + err=1 + fi + fi rm -f output.txt |
From: Gleb C. <lna...@ya...> - 2025-05-21 08:34:55
|
Commit: 707554a GitHub URL: https://github.com/SCST-project/scst/commit/707554a310f0953d2f21eac45aee709ed6711157 Author: Gleb Chesnokov Date: 2025-05-21T11:34:29+03:00 Log Message: ----------- scst: Revert semantic kernel version change Partially revert the earlier commit which limited SCST_KVER to a semantic version only. Restore usage of the full kernel version string for improved clarity in build metadata. Fixes: ac1e7f82b7fc ("scst: Fix SCST_KVER to use semantic version only") Modified Paths: -------------- Makefile | 3 +-- scst/include/scst_const.h | 12 ++++++------ scst/src/Kbuild | 10 +++++----- scst/src/scst_main.c | 4 ++-- scst/src/scst_sysfs.c | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) =================================================================== diff --git a/Makefile b/Makefile index 04100b1..9cfbaea 100644 --- a/Makefile +++ b/Makefile @@ -71,7 +71,6 @@ ISCSI_DIR = iscsi-scst BUILD_DATE := $(shell date -u '+%Y/%m/%d-%H:%M:%S-%Z%:z') GIT_COMMIT := $(shell git rev-parse --short=12 HEAD 2>/dev/null) -KVER_SEMVER := $(shell echo ${KVER} | cut -d'-' -f1) ifndef BUILD_NUMBER BUILD_NUMBER := $(shell git rev-list --count HEAD 2>/dev/null || echo 0) @@ -81,7 +80,7 @@ ifndef ARCH_TYPE ARCH_TYPE := $(shell uname -m) endif -export KVER BUILD_DATE GIT_COMMIT KVER_SEMVER BUILD_NUMBER ARCH_TYPE +export KVER BUILD_DATE GIT_COMMIT BUILD_NUMBER ARCH_TYPE RELEASE_VERSION := $(shell echo -n "$$(sed -n 's/^\#define[[:blank:]]SCST_VERSION_NAME[[:blank:]]*\"\([^-]*\).*\"/\1/p' scst/include/scst_const.h)") diff --git a/scst/include/scst_const.h b/scst/include/scst_const.h index 7bbb85c..5d236f4 100644 --- a/scst/include/scst_const.h +++ b/scst/include/scst_const.h @@ -59,6 +59,12 @@ #define SCST_BUILD_DATE_STRING "" #endif +#ifdef SCST_BUILD_NUMBER +#define SCST_BUILD_NUMBER_STRING SCST_STRINGIFY(SCST_BUILD_NUMBER) +#else +#define SCST_BUILD_NUMBER_STRING "" +#endif + #ifdef SCST_GIT_COMMIT #define SCST_GIT_COMMIT_STRING SCST_STRINGIFY(SCST_GIT_COMMIT) #else @@ -71,12 +77,6 @@ #define SCST_KVER_STRING "" #endif -#ifdef SCST_BUILD_NUMBER -#define SCST_BUILD_NUMBER_STRING SCST_STRINGIFY(SCST_BUILD_NUMBER) -#else -#define SCST_BUILD_NUMBER_STRING "" -#endif - #ifdef SCST_ARCH_TYPE #define SCST_ARCH_TYPE_STRING SCST_STRINGIFY(SCST_ARCH_TYPE) #else diff --git a/scst/src/Kbuild b/scst/src/Kbuild index a91679c..94d5af7 100644 --- a/scst/src/Kbuild +++ b/scst/src/Kbuild @@ -15,12 +15,12 @@ ccflags-y := -I$(src)/../include \ -fstack-protector-strong \ -Wstrict-prototypes -ccflags-y += $(shell [ -n "${CONFIG_SCST_NO_DLM}" ] && echo -DCONFIG_SCST_NO_DLM) \ - $(shell [ -n "${BUILD_DATE}" ] && echo -DSCST_BUILD_DATE=${BUILD_DATE}) \ - $(shell [ -n "${GIT_COMMIT}" ] && echo -DSCST_GIT_COMMIT=${GIT_COMMIT}) \ - $(shell [ -n "${KVER}" ] && echo -DSCST_KVER=${KVER_SEMVER}) \ +ccflags-y += $(shell [ -n "${BUILD_DATE}" ] && echo -DSCST_BUILD_DATE=${BUILD_DATE}) \ $(shell [ -n "${BUILD_NUMBER}" ] && echo -DSCST_BUILD_NUMBER=${BUILD_NUMBER}) \ - $(shell [ -n "${ARCH_TYPE}" ] && echo -DSCST_ARCH_TYPE=${ARCH_TYPE}) + $(shell [ -n "${GIT_COMMIT}" ] && echo -DSCST_GIT_COMMIT=${GIT_COMMIT}) \ + $(shell [ -n "${KVER}" ] && echo -DSCST_KVER=${KVER}) \ + $(shell [ -n "${ARCH_TYPE}" ] && echo -DSCST_ARCH_TYPE=${ARCH_TYPE}) \ + $(shell [ -n "${CONFIG_SCST_NO_DLM}" ] && echo -DCONFIG_SCST_NO_DLM) #ccflags-y += -DCONFIG_SCST_STRICT_SERIALIZING #ccflags-y += -DCONFIG_SCST_USE_EXPECTED_VALUES diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index c7655e6..137ed83 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -2476,9 +2476,9 @@ static int __init init_scst(void) #endif PRINT_INFO("SCST version: %s", SCST_VERSION_STRING); PRINT_INFO("SCST build date: %s", SCST_BUILD_DATE_STRING); + PRINT_INFO("SCST build number: %s", SCST_BUILD_NUMBER_STRING); PRINT_INFO("SCST git commit sha1: %s", SCST_GIT_COMMIT_STRING); PRINT_INFO("SCST kver: %s", SCST_KVER_STRING); - PRINT_INFO("SCST build number: %s", SCST_BUILD_NUMBER_STRING); PRINT_INFO("SCST arch type: %s", SCST_ARCH_TYPE_STRING); scst_print_config(); @@ -2633,7 +2633,7 @@ MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("SCSI target core"); MODULE_VERSION(SCST_VERSION_STRING); MODULE_INFO(build_date, SCST_BUILD_DATE_STRING); +MODULE_INFO(build_number, SCST_BUILD_NUMBER_STRING); MODULE_INFO(git_commit, SCST_GIT_COMMIT_STRING); MODULE_INFO(kver, SCST_KVER_STRING); -MODULE_INFO(build_number, SCST_BUILD_NUMBER_STRING); MODULE_INFO(arch_type, SCST_ARCH_TYPE_STRING); diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index a2dc881..66c9414 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -7449,9 +7449,9 @@ static ssize_t scst_version_show(struct kobject *kobj, ret += sysfs_emit_at(buf, ret, "SCST version: %s\n", SCST_VERSION_STRING); ret += sysfs_emit_at(buf, ret, "SCST build date: %s\n", SCST_BUILD_DATE_STRING); + ret += sysfs_emit_at(buf, ret, "SCST build number: %s\n", SCST_BUILD_NUMBER_STRING); ret += sysfs_emit_at(buf, ret, "SCST git commit sha1: %s\n", SCST_GIT_COMMIT_STRING); ret += sysfs_emit_at(buf, ret, "SCST kver: %s\n", SCST_KVER_STRING); - ret += sysfs_emit_at(buf, ret, "SCST build number: %s\n", SCST_BUILD_NUMBER_STRING); ret += sysfs_emit_at(buf, ret, "SCST arch type: %s\n", SCST_ARCH_TYPE_STRING); if (scst_dump_config(config, sizeof(config))) |
From: Gleb C. <lna...@ya...> - 2025-05-19 17:49:43
|
Commit: 977904d GitHub URL: https://github.com/SCST-project/scst/commit/977904d33aaabbb532f3b5671320bfb725881020 Author: Gleb Chesnokov Date: 2025-05-19T20:46:54+03:00 Log Message: ----------- scst: Use separate sysfs_emit_at() for emitting SCST_SYSFS_KEY_MARK Replace combined sysfs_emit() calls with separate sysfs_emit() and sysfs_emit_at() invocations when emitting SCST_SYSFS_KEY_MARK in sysfs attribute show handlers. This improves code clarity and consistency, explicitly handling the conditional addition of SCST_SYSFS_KEY_MARK. This patch does not change any functionality. Modified Paths: -------------- iscsi-scst/kernel/target.c | 6 +- qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c | 11 +- qla2x00t/qla2x00-target/qla2x00t.c | 7 +- scst/src/dev_handlers/scst_disk.c | 13 +- scst/src/dev_handlers/scst_vdisk.c | 251 +++++++++------ scst/src/scst_copy_mgr.c | 8 +- scst/src/scst_sysfs.c | 149 +++++---- scst_local/scst_local.c | 7 +- srpt/src/ib_srpt.c | 10 +- 9 files changed, 282 insertions(+), 180 deletions(-) =================================================================== diff --git a/iscsi-scst/kernel/target.c b/iscsi-scst/kernel/target.c index b1ec29e..04668c6 100644 --- a/iscsi-scst/kernel/target.c +++ b/iscsi-scst/kernel/target.c @@ -577,8 +577,10 @@ static ssize_t iscsi_acg_sess_dedicated_threads_show(struct kobject *kobj, acg = container_of(kobj, struct scst_acg, acg_kobj); dedicated = scst_get_acg_tgt_priv(acg); - ret = sysfs_emit(buf, "%d\n%s", - dedicated, dedicated ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n", dedicated); + + if (dedicated) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; diff --git a/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c b/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c index 53b54e9..e885b97 100644 --- a/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c +++ b/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c @@ -1086,16 +1086,19 @@ static ssize_t sqa_show_expl_conf_enabled(struct kobject *kobj, struct sqa_scst_tgt *sqa_tgt; struct qla_tgt *tgt; struct qla_hw_data *ha; + ssize_t ret; scst_tgt = container_of(kobj, struct scst_tgt, tgt_kobj); sqa_tgt = scst_tgt_get_tgt_priv(scst_tgt); tgt = sqa_tgt->qla_tgt; ha = tgt->ha; - return sysfs_emit(buffer, "%d\n%s", - ha->base_qpair->enable_explicit_conf, - ha->base_qpair->enable_explicit_conf ? - SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buffer, "%d\n", ha->base_qpair->enable_explicit_conf); + + if (ha->base_qpair->enable_explicit_conf) + ret += sysfs_emit_at(buffer, ret, "%s\n", SCST_SYSFS_KEY_MARK); + + return ret; } static ssize_t sqa_store_expl_conf_enabled(struct kobject *kobj, diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index 8717b12..fbecb62 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -6616,9 +6616,10 @@ static ssize_t q2t_show_expl_conf_enabled(struct kobject *kobj, struct kobj_attr vha = tgt->vha; - res = sysfs_emit(buffer, "%d\n%s", - vha->hw->enable_explicit_conf, - vha->hw->enable_explicit_conf ? SCST_SYSFS_KEY_MARK "\n" : ""); + res = sysfs_emit(buffer, "%d\n", vha->hw->enable_explicit_conf); + + if (vha->hw->enable_explicit_conf) + res += sysfs_emit_at(buffer, res, "%s\n", SCST_SYSFS_KEY_MARK); out: return res; diff --git a/scst/src/dev_handlers/scst_disk.c b/scst/src/dev_handlers/scst_disk.c index 6b891cf..653f6d2 100644 --- a/scst/src/dev_handlers/scst_disk.c +++ b/scst/src/dev_handlers/scst_disk.c @@ -562,12 +562,15 @@ out_complete: static ssize_t disk_sysfs_cluster_mode_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - struct scst_device *dev = container_of(kobj, struct scst_device, - dev_kobj); + struct scst_device *dev = container_of(kobj, struct scst_device, dev_kobj); + ssize_t ret; + + ret = sysfs_emit(buf, "%d\n", dev->cluster_mode); + + if (dev->cluster_mode) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); - return sysfs_emit(buf, "%d\n%s", - dev->cluster_mode, - dev->cluster_mode ? SCST_SYSFS_KEY_MARK "\n" : ""); + return ret; } static int disk_sysfs_process_cluster_mode_store(struct scst_sysfs_work_item *work) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 87c7e26..de8801d 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -7722,6 +7722,7 @@ static ssize_t vdev_size_show(struct kobject *kobj, struct kobj_attribute *attr, struct scst_vdisk_dev *virt_dev; unsigned long long size; bool key; + ssize_t ret; dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; @@ -7734,8 +7735,12 @@ static ssize_t vdev_size_show(struct kobject *kobj, struct kobj_attribute *attr, */ key = !(virt_dev->nullio && size == VDISK_NULLIO_SIZE) && !size_shift; - return sysfs_emit(buf, "%llu\n%s", - size >> size_shift, key ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%llu\n", size >> size_shift); + + if (key) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + + return ret; } static ssize_t vdev_sysfs_size_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) @@ -7764,9 +7769,10 @@ static ssize_t vdisk_sysfs_blocksize_show(struct kobject *kobj, struct kobj_attr dev = container_of(kobj, struct scst_device, dev_kobj); - ret = sysfs_emit(buf, "%d\n%s", - dev->block_size, dev->block_size == (1 << DEF_DISK_BLOCK_SHIFT) ? "" : - SCST_SYSFS_KEY_MARK "\n"); + ret = sysfs_emit(buf, "%d\n", dev->block_size); + + if (dev->block_size != (1 << DEF_DISK_BLOCK_SHIFT)) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -7803,13 +7809,16 @@ static ssize_t vdisk_opt_trans_len_store(struct kobject *kobj, static ssize_t vdisk_opt_trans_len_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - struct scst_device *dev = - container_of(kobj, struct scst_device, dev_kobj); + struct scst_device *dev = container_of(kobj, struct scst_device, dev_kobj); struct scst_vdisk_dev *virt_dev = dev->dh_priv; + ssize_t ret; + + ret = sysfs_emit(buf, "%d\n", virt_dev->opt_trans_len); - return sysfs_emit(buf, "%d\n%s", - virt_dev->opt_trans_len, - virt_dev->opt_trans_len_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + if (virt_dev->opt_trans_len_set) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + + return ret; } static ssize_t vdisk_sysfs_rd_only_show(struct kobject *kobj, struct kobj_attribute *attr, @@ -7824,9 +7833,10 @@ static ssize_t vdisk_sysfs_rd_only_show(struct kobject *kobj, struct kobj_attrib dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - ret = sysfs_emit(buf, "%d\n%s", - virt_dev->rd_only, - virt_dev->rd_only == DEF_RD_ONLY ? "" : SCST_SYSFS_KEY_MARK "\n"); + ret = sysfs_emit(buf, "%d\n", virt_dev->rd_only); + + if (virt_dev->rd_only != DEF_RD_ONLY) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -7843,9 +7853,10 @@ static ssize_t vdisk_sysfs_wt_show(struct kobject *kobj, struct kobj_attribute * dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - ret = sysfs_emit(buf, "%d\n%s", - virt_dev->wt_flag, - virt_dev->wt_flag == DEF_WRITE_THROUGH ? "" : SCST_SYSFS_KEY_MARK "\n"); + ret = sysfs_emit(buf, "%d\n", virt_dev->wt_flag); + + if (virt_dev->wt_flag != DEF_WRITE_THROUGH) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -7862,9 +7873,10 @@ static ssize_t vdisk_sysfs_tp_show(struct kobject *kobj, struct kobj_attribute * dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - ret = sysfs_emit(buf, "%d\n%s", - virt_dev->thin_provisioned, - virt_dev->thin_provisioned_manually_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n", virt_dev->thin_provisioned); + + if (virt_dev->thin_provisioned_manually_set) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -7899,12 +7911,15 @@ static ssize_t vdisk_sysfs_expl_alua_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - struct scst_device *dev = container_of(kobj, struct scst_device, - dev_kobj); + struct scst_device *dev = container_of(kobj, struct scst_device, dev_kobj); + ssize_t ret; - return sysfs_emit(buf, "%d\n%s", - dev->expl_alua, - dev->expl_alua != DEF_EXPL_ALUA ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n", dev->expl_alua); + + if (dev->expl_alua != DEF_EXPL_ALUA) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + + return ret; } static ssize_t vdisk_sysfs_expl_alua_store(struct kobject *kobj, @@ -7939,9 +7954,10 @@ static ssize_t vdisk_sysfs_nv_cache_show(struct kobject *kobj, struct kobj_attri dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - ret = sysfs_emit(buf, "%d\n%s", - virt_dev->nv_cache, - virt_dev->nv_cache == DEF_NV_CACHE ? "" : SCST_SYSFS_KEY_MARK "\n"); + ret = sysfs_emit(buf, "%d\n", virt_dev->nv_cache); + + if (virt_dev->nv_cache != DEF_NV_CACHE) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -7959,9 +7975,10 @@ static ssize_t vdisk_sysfs_o_direct_show(struct kobject *kobj, struct kobj_attri dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - ret = sysfs_emit(buf, "%d\n%s", - virt_dev->o_direct_flag, - virt_dev->o_direct_flag == DEF_O_DIRECT ? "" : SCST_SYSFS_KEY_MARK "\n"); + ret = sysfs_emit(buf, "%d\n", virt_dev->o_direct_flag); + + if (virt_dev->o_direct_flag != DEF_O_DIRECT) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -7970,26 +7987,32 @@ static ssize_t vdisk_sysfs_o_direct_show(struct kobject *kobj, struct kobj_attri static ssize_t vdev_sysfs_dummy_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - struct scst_device *dev = container_of(kobj, struct scst_device, - dev_kobj); + struct scst_device *dev = container_of(kobj, struct scst_device, dev_kobj); struct scst_vdisk_dev *virt_dev = dev->dh_priv; + ssize_t ret; + + ret = sysfs_emit(buf, "%d\n", virt_dev->dummy); - return sysfs_emit(buf, "%d\n%s", - virt_dev->dummy, - virt_dev->dummy != DEF_DUMMY ? SCST_SYSFS_KEY_MARK "\n" : ""); + if (virt_dev->dummy != DEF_DUMMY) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + + return ret; } static ssize_t vdev_sysfs_rz_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - struct scst_device *dev = container_of(kobj, struct scst_device, - dev_kobj); + struct scst_device *dev = container_of(kobj, struct scst_device, dev_kobj); struct scst_vdisk_dev *virt_dev = dev->dh_priv; bool read_zero = virt_dev->read_zero; + ssize_t ret; - return sysfs_emit(buf, "%d\n%s", - read_zero, - read_zero != DEF_READ_ZERO ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n", read_zero); + + if (read_zero != DEF_READ_ZERO) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + + return ret; } static ssize_t vdev_sysfs_rz_store(struct kobject *kobj, @@ -8287,10 +8310,14 @@ static ssize_t vdev_sysfs_cluster_mode_show(struct kobject *kobj, struct kobj_at char *buf) { struct scst_device *dev = container_of(kobj, struct scst_device, dev_kobj); + ssize_t ret; + + ret = sysfs_emit(buf, "%d\n", dev->cluster_mode); - return sysfs_emit(buf, "%d\n%s", - dev->cluster_mode, - dev->cluster_mode ? SCST_SYSFS_KEY_MARK "\n" : ""); + if (dev->cluster_mode) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + + return ret; } static int vdev_sysfs_process_cluster_mode_store(struct scst_sysfs_work_item *work) @@ -8474,9 +8501,12 @@ static ssize_t vdev_sysfs_t10_vend_id_show(struct kobject *kobj, virt_dev = dev->dh_priv; read_lock(&vdisk_serial_rwlock); - ret = sysfs_emit(buf, "%s\n%s", - virt_dev->t10_vend_id, - virt_dev->t10_vend_id_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + + ret = sysfs_emit(buf, "%s\n", virt_dev->t10_vend_id); + + if (virt_dev->t10_vend_id_set) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + read_unlock(&vdisk_serial_rwlock); TRACE_EXIT_RES(ret); @@ -8534,9 +8564,12 @@ static ssize_t vdev_sysfs_vend_specific_id_show(struct kobject *kobj, virt_dev = dev->dh_priv; read_lock(&vdisk_serial_rwlock); - ret = sysfs_emit(buf, "%s\n%s", - virt_dev->vend_specific_id, - virt_dev->vend_specific_id_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + + ret = sysfs_emit(buf, "%s\n", virt_dev->vend_specific_id); + + if (virt_dev->vend_specific_id_set) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + read_unlock(&vdisk_serial_rwlock); TRACE_EXIT_RES(ret); @@ -8594,9 +8627,12 @@ static ssize_t vdev_sysfs_prod_id_show(struct kobject *kobj, virt_dev = dev->dh_priv; read_lock(&vdisk_serial_rwlock); - ret = sysfs_emit(buf, "%s\n%s", - virt_dev->prod_id, - virt_dev->prod_id_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + + ret = sysfs_emit(buf, "%s\n", virt_dev->prod_id); + + if (virt_dev->prod_id_set) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + read_unlock(&vdisk_serial_rwlock); TRACE_EXIT_RES(ret); @@ -8654,9 +8690,12 @@ static ssize_t vdev_sysfs_prod_rev_lvl_show(struct kobject *kobj, virt_dev = dev->dh_priv; read_lock(&vdisk_serial_rwlock); - ret = sysfs_emit(buf, "%s\n%s", - virt_dev->prod_rev_lvl, - virt_dev->prod_rev_lvl_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + + ret = sysfs_emit(buf, "%s\n", virt_dev->prod_rev_lvl); + + if (virt_dev->prod_rev_lvl_set) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + read_unlock(&vdisk_serial_rwlock); TRACE_EXIT_RES(ret); @@ -8715,9 +8754,12 @@ static ssize_t vdev_sysfs_scsi_device_name_show(struct kobject *kobj, struct kob virt_dev = dev->dh_priv; read_lock(&vdisk_serial_rwlock); - ret = sysfs_emit(buf, "%s\n%s", - virt_dev->scsi_device_name, - virt_dev->scsi_device_name_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + + ret = sysfs_emit(buf, "%s\n", virt_dev->scsi_device_name); + + if (virt_dev->scsi_device_name_set) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + read_unlock(&vdisk_serial_rwlock); TRACE_EXIT_RES(ret); @@ -8774,9 +8816,12 @@ static ssize_t vdev_sysfs_t10_dev_id_show(struct kobject *kobj, struct kobj_attr virt_dev = dev->dh_priv; read_lock(&vdisk_serial_rwlock); - ret = sysfs_emit(buf, "%s\n%s", - virt_dev->t10_dev_id, - virt_dev->t10_dev_id_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + + ret = sysfs_emit(buf, "%s\n", virt_dev->t10_dev_id); + + if (virt_dev->t10_dev_id_set) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + read_unlock(&vdisk_serial_rwlock); TRACE_EXIT_RES(ret); @@ -8848,8 +8893,11 @@ static ssize_t vdev_sysfs_eui64_id_show(struct kobject *kobj, for (i = 0; i < virt_dev->eui64_id_len; i++) ret += sysfs_emit_at(buf, ret, "%02x", virt_dev->eui64_id[i]); - ret += sysfs_emit_at(buf, ret, "\n%s", - virt_dev->eui64_id_len ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret += sysfs_emit_at(buf, ret, "\n"); + + if (virt_dev->eui64_id_len) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + read_unlock(&vdisk_serial_rwlock); return ret; @@ -8926,8 +8974,11 @@ static ssize_t vdev_sysfs_naa_id_show(struct kobject *kobj, struct kobj_attribut for (i = 0; i < virt_dev->naa_id_len; i++) ret += sysfs_emit_at(buf, ret, "%02x", virt_dev->naa_id[i]); - ret += sysfs_emit_at(buf, ret, "\n%s", - virt_dev->naa_id_len ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret += sysfs_emit_at(buf, ret, "\n"); + + if (virt_dev->naa_id_len) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + read_unlock(&vdisk_serial_rwlock); return ret; @@ -8995,9 +9046,12 @@ static ssize_t vdev_sysfs_usn_show(struct kobject *kobj, struct kobj_attribute * virt_dev = dev->dh_priv; read_lock(&vdisk_serial_rwlock); - ret = sysfs_emit(buf, "%s\n%s", - virt_dev->usn, - virt_dev->usn_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + + ret = sysfs_emit(buf, "%s\n", virt_dev->usn); + + if (virt_dev->usn_set) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + read_unlock(&vdisk_serial_rwlock); TRACE_EXIT_RES(ret); @@ -9045,10 +9099,12 @@ static ssize_t vdev_sysfs_inq_vend_specific_show(struct kobject *kobj, virt_dev = dev->dh_priv; read_lock(&vdisk_serial_rwlock); - ret = sysfs_emit(buf, "%.*s\n%s", - virt_dev->inq_vend_specific_len, - virt_dev->inq_vend_specific, - virt_dev->inq_vend_specific_len ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%.*s\n", + virt_dev->inq_vend_specific_len, virt_dev->inq_vend_specific); + + if (virt_dev->inq_vend_specific_len) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + read_unlock(&vdisk_serial_rwlock); return ret; @@ -9060,13 +9116,17 @@ static ssize_t vdev_sysfs_active_show(struct kobject *kobj, { struct scst_device *dev; struct scst_vdisk_dev *virt_dev; + ssize_t ret; dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - return sysfs_emit(buf, "%d\n%s", - virt_dev->dev_active, - virt_dev->dev_active != DEF_DEV_ACTIVE ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n", virt_dev->dev_active); + + if (virt_dev->dev_active != DEF_DEV_ACTIVE) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + + return ret; } static int vdev_sysfs_process_active_store(struct scst_sysfs_work_item *work) @@ -9183,9 +9243,10 @@ static ssize_t vdev_sysfs_bind_alua_state_show(struct kobject *kobj, bind_alua_state = virt_dev->bind_alua_state; spin_unlock(&virt_dev->flags_lock); - ret = sysfs_emit(buf, "%d\n%s", - bind_alua_state, - bind_alua_state != DEF_BIND_ALUA_STATE ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n", bind_alua_state); + + if (bind_alua_state != DEF_BIND_ALUA_STATE) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -9246,13 +9307,16 @@ static ssize_t vdev_async_store(struct kobject *kobj, struct kobj_attribute *att static ssize_t vdev_async_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - struct scst_device *dev = - container_of(kobj, struct scst_device, dev_kobj); + struct scst_device *dev = container_of(kobj, struct scst_device, dev_kobj); struct scst_vdisk_dev *virt_dev = dev->dh_priv; + ssize_t ret; - return sysfs_emit(buf, "%d\n%s", - virt_dev->async, - virt_dev->async ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n", virt_dev->async); + + if (virt_dev->async) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + + return ret; } static ssize_t vdev_dif_filename_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) @@ -9266,9 +9330,10 @@ static ssize_t vdev_dif_filename_show(struct kobject *kobj, struct kobj_attribut dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - ret = sysfs_emit(buf, "%s\n%s", - virt_dev->dif_filename, - virt_dev->dif_filename ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%s\n", virt_dev->dif_filename); + + if (virt_dev->dif_filename) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -9299,14 +9364,16 @@ static ssize_t vdev_lb_per_pb_exp_store(struct kobject *kobj, struct kobj_attrib static ssize_t vdev_lb_per_pb_exp_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - struct scst_device *dev = - container_of(kobj, struct scst_device, dev_kobj); + struct scst_device *dev = container_of(kobj, struct scst_device, dev_kobj); struct scst_vdisk_dev *virt_dev = dev->dh_priv; + ssize_t ret; + + ret = sysfs_emit(buf, "%d\n", virt_dev->lb_per_pb_exp); - return sysfs_emit(buf, "%d\n%s", - virt_dev->lb_per_pb_exp, - virt_dev->lb_per_pb_exp == DEF_LB_PER_PB_EXP ? "" : - SCST_SYSFS_KEY_MARK "\n"); + if (virt_dev->lb_per_pb_exp != DEF_LB_PER_PB_EXP) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + + return ret; } static struct kobj_attribute vdev_active_attr = diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index 510dc0f..38e08a2 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -3715,10 +3715,10 @@ static ssize_t scst_cm_allow_not_conn_copy_show(struct kobject *kobj, struct kob TRACE_ENTRY(); - ret = sysfs_emit(buf, "%d\n%s", - scst_cm_allow_not_connected_copy, - scst_cm_allow_not_connected_copy == SCST_ALLOW_NOT_CONN_COPY_DEF ? - "" : SCST_SYSFS_KEY_MARK "\n"); + ret = sysfs_emit(buf, "%d\n", scst_cm_allow_not_connected_copy); + + if (scst_cm_allow_not_connected_copy != SCST_ALLOW_NOT_CONN_COPY_DEF) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index d780b89..a2dc881 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -2303,9 +2303,10 @@ static ssize_t scst_rel_tgt_id_show(struct kobject *kobj, struct kobj_attribute tgt = container_of(kobj, struct scst_tgt, tgt_kobj); - ret = sysfs_emit(buf, "%d\n%s", - tgt->rel_tgt_id, - tgt->rel_tgt_id != 0 ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n", tgt->rel_tgt_id); + + if (tgt->rel_tgt_id) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -2407,10 +2408,14 @@ static ssize_t scst_tgt_forward_src_show(struct kobject *kobj, struct kobj_attri char *buf) { struct scst_tgt *tgt = container_of(kobj, struct scst_tgt, tgt_kobj); + ssize_t ret; + + ret = sysfs_emit(buf, "%d\n", tgt->tgt_forward_src); - return sysfs_emit(buf, "%d\n%s", - tgt->tgt_forward_src, - tgt->tgt_forward_src ? SCST_SYSFS_KEY_MARK "\n" : ""); + if (tgt->tgt_forward_src) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + + return ret; } static ssize_t scst_tgt_forward_src_store(struct kobject *kobj, struct kobj_attribute *attr, @@ -2451,9 +2456,10 @@ static ssize_t scst_tgt_forward_dst_show(struct kobject *kobj, struct kobj_attri tgt = container_of(kobj, struct scst_tgt, tgt_kobj); - ret = sysfs_emit(buf, "%d\n%s", - tgt->tgt_forward_dst, - tgt->tgt_forward_dst ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n", tgt->tgt_forward_dst); + + if (tgt->tgt_forward_dst) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -2552,9 +2558,10 @@ static ssize_t scst_tgt_aen_disabled_show(struct kobject *kobj, struct kobj_attr tgt = container_of(kobj, struct scst_tgt, tgt_kobj); - ret = sysfs_emit(buf, "%d\n%s", - tgt->tgt_aen_disabled, - tgt->tgt_aen_disabled ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n", tgt->tgt_aen_disabled); + + if (tgt->tgt_aen_disabled) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -3101,9 +3108,12 @@ static ssize_t scst_dev_sysfs_pr_file_name_show(struct kobject *kobj, res = mutex_lock_interruptible(&dev->dev_pr_mutex); if (res != 0) goto out; - res = sysfs_emit(buf, "%s\n%s", - dev->pr_file_name ? : "", - dev->pr_file_name_is_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + + res = sysfs_emit(buf, "%s\n", dev->pr_file_name ? : ""); + + if (dev->pr_file_name_is_set) + res += sysfs_emit_at(buf, res, "%s\n", SCST_SYSFS_KEY_MARK); + mutex_unlock(&dev->dev_pr_mutex); out: @@ -3342,10 +3352,10 @@ static ssize_t scst_dev_sysfs_threads_num_show(struct kobject *kobj, struct kobj dev = container_of(kobj, struct scst_device, dev_kobj); - ret = sysfs_emit(buf, "%d\n%s", - dev->threads_num, - dev->threads_num != dev->handler->threads_num ? - SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n", dev->threads_num); + + if (dev->threads_num != dev->handler->threads_num) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -3421,16 +3431,16 @@ static ssize_t scst_dev_sysfs_threads_pool_type_show(struct kobject *kobj, switch (dev->threads_pool_type) { case SCST_THREADS_POOL_PER_INITIATOR: - ret = sysfs_emit(buf, "%s\n%s", - SCST_THREADS_POOL_PER_INITIATOR_STR, - dev->threads_pool_type != dev->handler->threads_pool_type ? - SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%s\n", SCST_THREADS_POOL_PER_INITIATOR_STR); + + if (dev->threads_pool_type != dev->handler->threads_pool_type) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); break; case SCST_THREADS_POOL_SHARED: - ret = sysfs_emit(buf, "%s\n%s", - SCST_THREADS_POOL_SHARED_STR, - dev->threads_pool_type != dev->handler->threads_pool_type ? - SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%s\n", SCST_THREADS_POOL_SHARED_STR); + + if (dev->threads_pool_type != dev->handler->threads_pool_type) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); break; default: ret = sysfs_emit(buf, "Unknown\n"); @@ -3501,10 +3511,10 @@ static ssize_t scst_dev_sysfs_max_tgt_dev_commands_show(struct kobject *kobj, dev = container_of(kobj, struct scst_device, dev_kobj); - ret = sysfs_emit(buf, "%d\n%s", - dev->max_tgt_dev_commands, - dev->max_tgt_dev_commands != dev->handler->max_tgt_dev_commands ? - SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n", dev->max_tgt_dev_commands); + + if (dev->max_tgt_dev_commands != dev->handler->max_tgt_dev_commands) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -3561,9 +3571,10 @@ static ssize_t scst_dev_numa_node_id_show(struct kobject *kobj, struct kobj_attr dev = container_of(kobj, struct scst_device, dev_kobj); - ret = sysfs_emit(buf, "%d\n%s", - dev->dev_numa_node_id, - dev->dev_numa_node_id != NUMA_NO_NODE ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n", dev->dev_numa_node_id); + + if (dev->dev_numa_node_id != NUMA_NO_NODE) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -4004,9 +4015,10 @@ static ssize_t scst_dev_dif_type_show(struct kobject *kobj, struct kobj_attribut dev = container_of(kobj, struct scst_device, dev_kobj); - ret = sysfs_emit(buf, "%d\n%s", - dev->dev_dif_type, - dev->dev_dif_type != 0 ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n", dev->dev_dif_type); + + if (dev->dev_dif_type) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -4060,9 +4072,10 @@ static ssize_t scst_dev_sysfs_dif_static_app_tag_show(struct kobject *kobj, a = scst_dev_get_dif_static_app_tag_combined(dev); - ret = sysfs_emit(buf, "0x%llx\n%s", - (unsigned long long)be64_to_cpu(a), - a != SCST_DIF_NO_CHECK_APP_TAG ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "0x%llx\n", (unsigned long long)be64_to_cpu(a)); + + if (a != SCST_DIF_NO_CHECK_APP_TAG) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -6390,12 +6403,15 @@ static ssize_t scst_tg_preferred_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - struct scst_target_group *tg; + struct scst_target_group *tg = container_of(kobj, struct scst_target_group, kobj); + ssize_t ret; - tg = container_of(kobj, struct scst_target_group, kobj); + ret = sysfs_emit(buf, "%u\n", tg->preferred); - return sysfs_emit(buf, "%u\n%s", tg->preferred, - tg->preferred ? SCST_SYSFS_KEY_MARK "\n" : ""); + if (tg->preferred) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + + return ret; } static int scst_tg_preferred_store_work_fn(struct scst_sysfs_work_item *w) @@ -6965,10 +6981,10 @@ static ssize_t scst_threads_show(struct kobject *kobj, struct kobj_attribute *at TRACE_ENTRY(); - ret = sysfs_emit(buf, "%d\n%s", - scst_main_cmd_threads.nr_threads, - (scst_main_cmd_threads.nr_threads != scst_threads) ? - SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n", scst_main_cmd_threads.nr_threads); + + if (scst_main_cmd_threads.nr_threads != scst_threads) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT(); @@ -7072,9 +7088,10 @@ static ssize_t scst_setup_id_show(struct kobject *kobj, TRACE_ENTRY(); - ret = sysfs_emit(buf, "0x%x\n%s", - scst_setup_id, - scst_setup_id == 0 ? "" : SCST_SYSFS_KEY_MARK "\n"); + ret = sysfs_emit(buf, "0x%x\n", scst_setup_id); + + if (scst_setup_id) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT(); @@ -7115,10 +7132,10 @@ static ssize_t scst_max_tasklet_cmd_show(struct kobject *kobj, struct kobj_attri TRACE_ENTRY(); - ret = sysfs_emit(buf, "%d\n%s", - scst_max_tasklet_cmd, - scst_max_tasklet_cmd == SCST_DEF_MAX_TASKLET_CMD ? - "" : SCST_SYSFS_KEY_MARK "\n"); + ret = sysfs_emit(buf, "%d\n", scst_max_tasklet_cmd); + + if (scst_max_tasklet_cmd != SCST_DEF_MAX_TASKLET_CMD) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT(); @@ -7160,9 +7177,11 @@ static ssize_t scst_poll_us_show(struct kobject *kobj, struct kobj_attribute *at TRACE_ENTRY(); do_div(t, 1000); - ret = sysfs_emit(buf, "%lld\n%s", - t, - scst_poll_ns == SCST_DEF_POLL_NS ? "" : SCST_SYSFS_KEY_MARK "\n"); + + ret = sysfs_emit(buf, "%lld\n", t); + + if (scst_poll_ns != SCST_DEF_POLL_NS) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT(); @@ -7284,9 +7303,14 @@ static struct kobj_attribute scst_main_trace_level_attr = static ssize_t scst_force_global_sgv_pool_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return sysfs_emit(buf, "%d\n%s", - scst_force_global_sgv_pool, - scst_force_global_sgv_pool ? SCST_SYSFS_KEY_MARK "\n" : ""); + ssize_t ret; + + ret = sysfs_emit(buf, "%d\n", scst_force_global_sgv_pool); + + if (scst_force_global_sgv_pool) + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); + + return ret; } static ssize_t scst_force_global_sgv_pool_store(struct kobject *kobj, struct kobj_attribute *attr, @@ -7470,8 +7494,7 @@ static ssize_t scst_cluster_name_show(struct kobject *kobj, struct kobj_attribut TRACE_ENTRY(); if (scst_cluster_name) - res = sysfs_emit(buf, "%s\n%s", - scst_cluster_name, SCST_SYSFS_KEY_MARK "\n"); + res = sysfs_emit(buf, "%s\n%s\n", scst_cluster_name, SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(res); return res; diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index c170116..723962c 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -376,9 +376,10 @@ static ssize_t scst_local_phys_transport_version_show(struct kobject *kobj, if (!tgt) goto out_up; - res = sysfs_emit(buf, "0x%x\n%s", - tgt->phys_transport_version, - tgt->phys_transport_version != 0 ? SCST_SYSFS_KEY_MARK "\n" : ""); + res = sysfs_emit(buf, "0x%x\n", tgt->phys_transport_version); + + if (tgt->phys_transport_version != 0) + res += sysfs_emit_at(buf, res, "%s\n", SCST_SYSFS_KEY_MARK); out_up: up_read(&scst_local_exit_rwsem); diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 7286365..07d628c 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -4073,10 +4073,12 @@ static ssize_t show_port_id(struct kobject *kobj, struct kobj_attribute *attr, c goto out; mutex_lock(&sport->mutex); - res = sysfs_emit(buf, "%s\n%s", - sport->port_id, - strcmp(sport->port_id, DEFAULT_SRPT_ID_STRING) ? - SCST_SYSFS_KEY_MARK "\n" : ""); + + res = sysfs_emit(buf, "%s\n", sport->port_id); + + if (strcmp(sport->port_id, DEFAULT_SRPT_ID_STRING)) + res += sysfs_emit_at(buf, res, "%s\n", SCST_SYSFS_KEY_MARK); + mutex_unlock(&sport->mutex); out: |
From: Gleb C. <lna...@ya...> - 2025-05-19 17:49:32
|
Commit: 0e8fdad GitHub URL: https://github.com/SCST-project/scst/commit/0e8fdad5e48c15b98c29470a991aaa71a4147b56 Author: Gleb Chesnokov Date: 2025-05-19T20:46:54+03:00 Log Message: ----------- scst: Use sysfs_emit/sysfs_emit_at instead of scnprintf() Replace scnprintf() with sysfs_emit() and sysfs_emit_at() in sysfs show handlers. These helper functions are specifically designed for sysfs output, providing safer handling of buffer lengths and consistency across kernel sysfs interfaces. This patch does not change any functionality. Modified Paths: -------------- iscsi-scst/kernel/config.c | 20 +- iscsi-scst/kernel/conn.c | 66 +- iscsi-scst/kernel/session.c | 26 +- iscsi-scst/kernel/target.c | 6 +- qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c | 33 +- qla2x00t/qla2x00-target/qla2x00t.c | 35 +- scst/include/backport.h | 76 ++ scst/src/dev_handlers/scst_disk.c | 6 +- scst/src/dev_handlers/scst_user.c | 28 +- scst/src/dev_handlers/scst_vdisk.c | 187 +++-- scst/src/scst_copy_mgr.c | 8 +- scst/src/scst_mem.c | 60 +- scst/src/scst_sysfs.c | 567 +++++++-------- scst_local/scst_local.c | 34 +- srpt/src/ib_srpt.c | 54 +- 15 files changed, 621 insertions(+), 585 deletions(-) =================================================================== diff --git a/iscsi-scst/kernel/config.c b/iscsi-scst/kernel/config.c index d86c349..e17fa24 100644 --- a/iscsi-scst/kernel/config.c +++ b/iscsi-scst/kernel/config.c @@ -29,22 +29,22 @@ static ssize_t iscsi_version_show(struct kobject *kobj, struct kobj_attribute *a TRACE_ENTRY(); - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%s\n", ISCSI_VERSION_STRING); + ret += sysfs_emit_at(buf, ret, "%s\n", ISCSI_VERSION_STRING); #ifdef CONFIG_SCST_EXTRACHECKS - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "EXTRACHECKS\n"); + ret += sysfs_emit_at(buf, ret, "EXTRACHECKS\n"); #endif #ifdef CONFIG_SCST_TRACING - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "TRACING\n"); + ret += sysfs_emit_at(buf, ret, "TRACING\n"); #endif #ifdef CONFIG_SCST_DEBUG - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "DEBUG\n"); + ret += sysfs_emit_at(buf, ret, "DEBUG\n"); #endif #ifdef CONFIG_SCST_ISCSI_DEBUG_DIGEST_FAILURES - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "DEBUG_DIGEST_FAILURES\n"); + ret += sysfs_emit_at(buf, ret, "DEBUG_DIGEST_FAILURES\n"); #endif TRACE_EXIT(); @@ -60,16 +60,16 @@ static ssize_t iscsi_open_state_show(struct kobject *kobj, struct kobj_attribute switch (ctr_open_state) { case ISCSI_CTR_OPEN_STATE_CLOSED: - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "closed\n"); + ret = sysfs_emit(buf, "closed\n"); break; case ISCSI_CTR_OPEN_STATE_OPEN: - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "open\n"); + ret = sysfs_emit(buf, "open\n"); break; case ISCSI_CTR_OPEN_STATE_CLOSING: - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "closing\n"); + ret = sysfs_emit(buf, "closing\n"); break; default: - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "unknown\n"); + ret = sysfs_emit(buf, "unknown\n"); break; } @@ -442,7 +442,7 @@ static ssize_t iscsi_attr_show(struct kobject *kobj, struct kobj_attribute *attr if (pos != 0) goto out; - pos = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", (char *)value); + pos = sysfs_emit(buf, "%s\n", (char *)value); kfree(value); diff --git a/iscsi-scst/kernel/conn.c b/iscsi-scst/kernel/conn.c index dcc6a0f..8c087b0 100644 --- a/iscsi-scst/kernel/conn.c +++ b/iscsi-scst/kernel/conn.c @@ -35,43 +35,43 @@ static struct lockdep_map scst_conn_dep_map = STATIC_LOCKDEP_MAP_INIT("iscsi_conn_kref", &scst_conn_key); #endif -static int print_conn_state(char *p, size_t size, struct iscsi_conn *conn) +static ssize_t print_conn_state(char *buf, size_t size, struct iscsi_conn *conn) { - int pos = 0; + ssize_t ret = 0; if (conn->closing) { - pos += scnprintf(p, size, "closing"); + ret += scnprintf(buf, size, "closing"); goto out; } switch (conn->rd_state) { case ISCSI_CONN_RD_STATE_PROCESSING: - pos += scnprintf(&p[pos], size - pos, "read_processing "); + ret += scnprintf(buf + ret, size - ret, "read_processing "); break; case ISCSI_CONN_RD_STATE_IN_LIST: - pos += scnprintf(&p[pos], size - pos, "in_read_list "); + ret += scnprintf(buf + ret, size - ret, "in_read_list "); break; } switch (conn->wr_state) { case ISCSI_CONN_WR_STATE_PROCESSING: - pos += scnprintf(&p[pos], size - pos, "write_processing "); + ret += scnprintf(buf + ret, size - ret, "write_processing "); break; case ISCSI_CONN_WR_STATE_IN_LIST: - pos += scnprintf(&p[pos], size - pos, "in_write_list "); + ret += scnprintf(buf + ret, size - ret, "in_write_list "); break; case ISCSI_CONN_WR_STATE_SPACE_WAIT: - pos += scnprintf(&p[pos], size - pos, "space_waiting "); + ret += scnprintf(buf + ret, size - ret, "space_waiting "); break; } if (test_bit(ISCSI_CONN_REINSTATING, &conn->conn_aflags)) - pos += scnprintf(&p[pos], size - pos, "reinstating "); - else if (pos == 0) - pos += scnprintf(&p[pos], size - pos, "established idle "); + ret += scnprintf(buf + ret, size - ret, "reinstating "); + else if (ret == 0) + ret += scnprintf(buf + ret, size - ret, "established idle "); out: - return pos; + return ret; } static void iscsi_conn_release(struct kobject *kobj) @@ -98,17 +98,17 @@ static ssize_t iscsi_get_initiator_ip(struct iscsi_conn *conn, char *buf, int si static ssize_t iscsi_conn_ip_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - int pos; struct iscsi_conn *conn; + ssize_t ret; TRACE_ENTRY(); conn = container_of(kobj, struct iscsi_conn, conn_kobj); - pos = iscsi_get_initiator_ip(conn, buf, SCST_SYSFS_BLOCK_SIZE); + ret = iscsi_get_initiator_ip(conn, buf, SCST_SYSFS_BLOCK_SIZE); - TRACE_EXIT_RES(pos); - return pos; + TRACE_EXIT_RES(ret); + return ret; } static struct kobj_attribute iscsi_conn_ip_attr = @@ -116,8 +116,8 @@ static struct kobj_attribute iscsi_conn_ip_attr = static ssize_t iscsi_get_target_ip(struct iscsi_conn *conn, char *buf, int size) { - int pos; struct sock *sk; + ssize_t ret; TRACE_ENTRY(); @@ -127,40 +127,40 @@ static ssize_t iscsi_get_target_ip(struct iscsi_conn *conn, char *buf, int size) sk = conn->sock->sk; switch (sk->sk_family) { case AF_INET: - pos = scnprintf(buf, size, "%pI4", &inet_sk(sk)->inet_saddr); + ret = scnprintf(buf, size, "%pI4", &inet_sk(sk)->inet_saddr); break; #ifdef CONFIG_IPV6 case AF_INET6: #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) - pos = scnprintf(buf, size, "[%pI6]", &inet6_sk(sk)->saddr); + ret = scnprintf(buf, size, "[%pI6]", &inet6_sk(sk)->saddr); #else - pos = scnprintf(buf, size, "[%pI6]", &sk->sk_v6_rcv_saddr); + ret = scnprintf(buf, size, "[%pI6]", &sk->sk_v6_rcv_saddr); #endif #endif break; default: - pos = scnprintf(buf, size, "Unknown family %d", sk->sk_family); + ret = scnprintf(buf, size, "Unknown family %d", sk->sk_family); break; } - TRACE_EXIT_RES(pos); - return pos; + TRACE_EXIT_RES(ret); + return ret; } static ssize_t iscsi_conn_target_ip_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - int pos; struct iscsi_conn *conn; + ssize_t ret; TRACE_ENTRY(); conn = container_of(kobj, struct iscsi_conn, conn_kobj); - pos = iscsi_get_target_ip(conn, buf, SCST_SYSFS_BLOCK_SIZE); + ret = iscsi_get_target_ip(conn, buf, SCST_SYSFS_BLOCK_SIZE); - TRACE_EXIT_RES(pos); - return pos; + TRACE_EXIT_RES(ret); + return ret; } static struct kobj_attribute iscsi_conn_target_ip_attr = @@ -176,7 +176,7 @@ static ssize_t iscsi_conn_transport_show(struct kobject *kobj, struct kobj_attri conn = container_of(kobj, struct iscsi_conn, conn_kobj); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", conn->transport->name); + ret = sysfs_emit(buf, "%s\n", conn->transport->name); TRACE_EXIT_RES(ret); return ret; @@ -194,7 +194,7 @@ static ssize_t iscsi_conn_cid_show(struct kobject *kobj, struct kobj_attribute * conn = container_of(kobj, struct iscsi_conn, conn_kobj); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%u", conn->cid); + ret = sysfs_emit(buf, "%u", conn->cid); TRACE_EXIT_RES(ret); return ret; @@ -205,17 +205,17 @@ static struct kobj_attribute iscsi_conn_cid_attr = static ssize_t iscsi_conn_state_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - int pos; struct iscsi_conn *conn; + ssize_t ret; TRACE_ENTRY(); conn = container_of(kobj, struct iscsi_conn, conn_kobj); - pos = print_conn_state(buf, SCST_SYSFS_BLOCK_SIZE, conn); + ret = print_conn_state(buf, SCST_SYSFS_BLOCK_SIZE, conn); - TRACE_EXIT_RES(pos); - return pos; + TRACE_EXIT_RES(ret); + return ret; } static struct kobj_attribute iscsi_conn_state_attr = diff --git a/iscsi-scst/kernel/session.c b/iscsi-scst/kernel/session.c index 9bfe05c..d77081a 100644 --- a/iscsi-scst/kernel/session.c +++ b/iscsi-scst/kernel/session.c @@ -388,8 +388,8 @@ static ssize_t iscsi_sess_show_##name(struct kobject *kobj, \ scst_sess = container_of(kobj, struct scst_session, sess_kobj); \ sess = (struct iscsi_session *)scst_sess_get_tgt_priv(scst_sess); \ \ - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", \ - iscsi_get_bool_value(sess->sess_params.name)); \ + return sysfs_emit(buf, "%s\n", \ + iscsi_get_bool_value(sess->sess_params.name)); \ } \ \ static struct kobj_attribute iscsi_sess_attr_##name = \ @@ -405,8 +405,8 @@ static ssize_t iscsi_sess_show_##name(struct kobject *kobj, \ scst_sess = container_of(kobj, struct scst_session, sess_kobj); \ sess = (struct iscsi_session *)scst_sess_get_tgt_priv(scst_sess); \ \ - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", \ - sess->sess_params.name); \ + return sysfs_emit(buf, "%d\n", \ + sess->sess_params.name); \ } \ \ static struct kobj_attribute iscsi_sess_attr_##name = \ @@ -423,8 +423,8 @@ static ssize_t iscsi_sess_show_##name(struct kobject *kobj, \ scst_sess = container_of(kobj, struct scst_session, sess_kobj); \ sess = (struct iscsi_session *)scst_sess_get_tgt_priv(scst_sess); \ \ - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", \ - iscsi_get_digest_name(sess->sess_params.name, digest_name)); \ + return sysfs_emit(buf, "%s\n", \ + iscsi_get_digest_name(sess->sess_params.name, digest_name)); \ } \ \ static struct kobj_attribute iscsi_sess_attr_##name = \ @@ -451,7 +451,7 @@ static ssize_t iscsi_sess_sid_show(struct kobject *kobj, struct kobj_attribute * scst_sess = container_of(kobj, struct scst_session, sess_kobj); sess = (struct iscsi_session *)scst_sess_get_tgt_priv(scst_sess); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%llx\n", sess->sid); + ret = sysfs_emit(buf, "%llx\n", sess->sid); TRACE_EXIT_RES(ret); return ret; @@ -472,7 +472,7 @@ static ssize_t iscsi_sess_reinstating_show(struct kobject *kobj, struct kobj_att scst_sess = container_of(kobj, struct scst_session, sess_kobj); sess = (struct iscsi_session *)scst_sess_get_tgt_priv(scst_sess); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", sess->sess_reinstating ? 1 : 0); + ret = sysfs_emit(buf, "%d\n", sess->sess_reinstating ? 1 : 0); TRACE_EXIT_RES(ret); return ret; @@ -497,11 +497,11 @@ static ssize_t iscsi_sess_thread_pid_show(struct kobject *kobj, struct kobj_attr mutex_lock(&thr_pool->tp_mutex); list_for_each_entry(t, &thr_pool->threads_list, threads_list_entry) - res += scnprintf(buf + res, SCST_SYSFS_BLOCK_SIZE - res, "%d%s", - task_pid_vnr(t->thr), - list_is_last(&t->threads_list_entry, - &thr_pool->threads_list) ? - "\n" : " "); + res += sysfs_emit_at(buf, res, "%d%s", + task_pid_vnr(t->thr), + list_is_last(&t->threads_list_entry, + &thr_pool->threads_list) ? + "\n" : " "); mutex_unlock(&thr_pool->tp_mutex); out: diff --git a/iscsi-scst/kernel/target.c b/iscsi-scst/kernel/target.c index 84d86ec..b1ec29e 100644 --- a/iscsi-scst/kernel/target.c +++ b/iscsi-scst/kernel/target.c @@ -404,7 +404,7 @@ static ssize_t iscsi_tgt_tid_show(struct kobject *kobj, struct kobj_attribute *a if (!tgt) goto out; - res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%u\n", tgt->tid); + res = sysfs_emit(buf, "%u\n", tgt->tid); out: TRACE_EXIT_RES(res); @@ -577,8 +577,8 @@ static ssize_t iscsi_acg_sess_dedicated_threads_show(struct kobject *kobj, acg = container_of(kobj, struct scst_acg, acg_kobj); dedicated = scst_get_acg_tgt_priv(acg); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - dedicated, dedicated ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n%s", + dedicated, dedicated ? SCST_SYSFS_KEY_MARK "\n" : ""); TRACE_EXIT_RES(ret); return ret; diff --git a/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c b/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c index 4f86e6a..53b54e9 100644 --- a/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c +++ b/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c @@ -895,28 +895,27 @@ static ssize_t sqa_version_show(struct kobject *kobj, { ssize_t ret = 0; - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - "INTERFACE=%s\nSCST=%s\nQLOGIC=%s\n", - SQA_VERSION, SCST_VERSION_NAME, QLA2XXX_VERSION); + ret += sysfs_emit_at(buf, ret, "INTERFACE=%s\nSCST=%s\nQLOGIC=%s\n", + SQA_VERSION, SCST_VERSION_NAME, QLA2XXX_VERSION); #ifdef CONFIG_SCST_EXTRACHECKS - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "EXTRACHECKS\n"); + ret += sysfs_emit_at(buf, ret, "EXTRACHECKS\n"); #endif #ifdef CONFIG_SCST_TRACING - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "TRACING\n"); + ret += sysfs_emit_at(buf, ret, "TRACING\n"); #endif #ifdef CONFIG_SCST_DEBUG - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "DEBUG\n"); + ret += sysfs_emit_at(buf, ret, "DEBUG\n"); #endif #ifdef CONFIG_QLA_TGT_DEBUG_WORK_IN_THREAD - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "QLA_TGT_DEBUG_WORK_IN_THREAD\n"); + ret += sysfs_emit_at(buf, ret, "QLA_TGT_DEBUG_WORK_IN_THREAD\n"); #endif #ifdef CONFIG_QLA_TGT_DEBUG_SRR - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "DEBUG_SRR\n"); + ret += sysfs_emit_at(buf, ret, "DEBUG_SRR\n"); #endif TRACE_EXIT(); @@ -935,8 +934,7 @@ static ssize_t sqa_hw_target_show(struct kobject *kobj, tgt = sqa_tgt->qla_tgt; - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", - tgt->vha->vp_idx == 0 ? 1 : 0); + return sysfs_emit(buf, "%d\n", tgt->vha->vp_idx == 0 ? 1 : 0); } static ssize_t sqa_node_name_show(struct kobject *kobj, @@ -973,11 +971,10 @@ static ssize_t sqa_node_name_show(struct kobject *kobj, if (res != 0) goto out; - res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", wwn); + res = sysfs_emit(buf, "%s\n", wwn); if (ha->tgt.node_name_set) - res += scnprintf(buf + res, SCST_SYSFS_BLOCK_SIZE - res, "%s\n", - SCST_SYSFS_KEY_MARK); + res += sysfs_emit_at(buf, res, "%s\n", SCST_SYSFS_KEY_MARK); kfree(wwn); @@ -1072,7 +1069,7 @@ static ssize_t sqa_vp_parent_host_show(struct kobject *kobj, if (res != 0) goto out; - res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s\n", wwn, SCST_SYSFS_KEY_MARK); + res = sysfs_emit(buf, "%s\n%s\n", wwn, SCST_SYSFS_KEY_MARK); kfree(wwn); @@ -1095,10 +1092,10 @@ static ssize_t sqa_show_expl_conf_enabled(struct kobject *kobj, tgt = sqa_tgt->qla_tgt; ha = tgt->ha; - return scnprintf(buffer, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - ha->base_qpair->enable_explicit_conf, - ha->base_qpair->enable_explicit_conf ? - SCST_SYSFS_KEY_MARK "\n" : ""); + return sysfs_emit(buffer, "%d\n%s", + ha->base_qpair->enable_explicit_conf, + ha->base_qpair->enable_explicit_conf ? + SCST_SYSFS_KEY_MARK "\n" : ""); } static ssize_t sqa_store_expl_conf_enabled(struct kobject *kobj, diff --git a/qla2x00t/qla2x00-target/qla2x00t.c b/qla2x00t/qla2x00-target/qla2x00t.c index 1282e27..8717b12 100644 --- a/qla2x00t/qla2x00-target/qla2x00t.c +++ b/qla2x00t/qla2x00-target/qla2x00t.c @@ -6601,8 +6601,8 @@ out: } -static ssize_t q2t_show_expl_conf_enabled(struct kobject *kobj, - struct kobj_attribute *attr, char *buffer) +static ssize_t q2t_show_expl_conf_enabled(struct kobject *kobj, struct kobj_attribute *attr, + char *buffer) { struct scst_tgt *scst_tgt; struct q2t_tgt *tgt; @@ -6613,11 +6613,12 @@ static ssize_t q2t_show_expl_conf_enabled(struct kobject *kobj, tgt = scst_tgt_get_tgt_priv(scst_tgt); if (!tgt) goto out; + vha = tgt->vha; - res = scnprintf(buffer, PAGE_SIZE, "%d\n%s", - vha->hw->enable_explicit_conf, - vha->hw->enable_explicit_conf ? SCST_SYSFS_KEY_MARK "\n" : ""); + res = sysfs_emit(buffer, "%d\n%s", + vha->hw->enable_explicit_conf, + vha->hw->enable_explicit_conf ? SCST_SYSFS_KEY_MARK "\n" : ""); out: return res; @@ -6709,22 +6710,22 @@ static ssize_t q2t_version_show(struct kobject *kobj, struct kobj_attribute *att { size_t ret = 0; - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%s\n", Q2T_VERSION_STRING); + ret += sysfs_emit_at(buf, ret, "%s\n", Q2T_VERSION_STRING); #ifdef CONFIG_SCST_EXTRACHECKS - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "EXTRACHECKS\n"); + ret += sysfs_emit_at(buf, ret, "EXTRACHECKS\n"); #endif #ifdef CONFIG_SCST_TRACING - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "TRACING\n"); + ret += sysfs_emit_at(buf, ret, "TRACING\n"); #endif #ifdef CONFIG_SCST_DEBUG - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "DEBUG\n"); + ret += sysfs_emit_at(buf, ret, "DEBUG\n"); #endif #ifdef CONFIG_QLA_TGT_DEBUG_WORK_IN_THREAD - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "QLA_TGT_DEBUG_WORK_IN_THREAD\n"); + ret += sysfs_emit_at(buf, ret, "QLA_TGT_DEBUG_WORK_IN_THREAD\n"); #endif TRACE_EXIT(); @@ -6733,7 +6734,7 @@ static ssize_t q2t_version_show(struct kobject *kobj, struct kobj_attribute *att static ssize_t q2t_hw_target_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", 1); + return sysfs_emit(buf, "%d\n", 1); } static ssize_t q2t_node_name_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) @@ -6757,12 +6758,11 @@ static ssize_t q2t_node_name_show(struct kobject *kobj, struct kobj_attribute *a if (res != 0) goto out; - res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", wwn); + res = sysfs_emit(buf, "%s\n", wwn); /* For virtual ports it's always key */ if (vha->node_name_set || (vha->vp_idx != 0)) - res += scnprintf(buf + res, SCST_SYSFS_BLOCK_SIZE - res, "%s\n", - SCST_SYSFS_KEY_MARK); + res += sysfs_emit_at(buf, res, "%s\n", SCST_SYSFS_KEY_MARK); kfree(wwn); @@ -6860,12 +6860,11 @@ static ssize_t q2t_port_name_show(struct kobject *kobj, struct kobj_attribute *a if (res != 0) goto out; - res = scnprintf(buf, "%s\n", wwn); + res = sysfs_emit(buf, "%s\n", wwn); /* For virtual ports it's always key */ if ((vha->vp_idx != 0) || vha->port_name_set) - res += scnprintf(buf + res, SCST_SYSFS_BLOCK_SIZE - res, "%s\n", - SCST_SYSFS_KEY_MARK); + res += sysfs_emit_at(buf, res, "%s\n", SCST_SYSFS_KEY_MARK); kfree(wwn); @@ -6958,7 +6957,7 @@ static ssize_t q2t_vp_parent_host_show(struct kobject *kobj, struct kobj_attribu if (res != 0) goto out; - res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s\n", wwn, SCST_SYSFS_KEY_MARK); + res = sysfs_emit(buf, "%s\n%s\n", wwn, SCST_SYSFS_KEY_MARK); kfree(wwn); diff --git a/scst/include/backport.h b/scst/include/backport.h index 20f276d..aa60068 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -37,8 +37,11 @@ #include <linux/iocontext.h> #include <linux/kobject_ns.h> #include <linux/scatterlist.h> /* struct scatterlist */ +#include <linux/shrinker.h> #include <linux/slab.h> /* kmalloc() */ #include <linux/stddef.h> /* sizeof_field() */ +#include <linux/string.h> +#include <linux/sysfs.h> #include <linux/timer.h> #include <linux/vmalloc.h> #include <linux/workqueue.h> @@ -1565,6 +1568,79 @@ static inline ssize_t strscpy(char *dest, const char *src, size_t count) #define __ATTR_RW(_name) __ATTR(_name, 0644, _name##_show, _name##_store) #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0) && \ + (LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(4, 9, 0) >> 8 || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 260)) && \ + (LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(4, 14, 0) >> 8 || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 224)) && \ + (LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(4, 19, 0) >> 8 || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 179)) && \ + (LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(5, 4, 0) >> 8 || \ + LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 103)) +/* + * See also commit 2efc459d06f1 ("sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output") + * # v5.10. + * See also commit f3c3dcf35532 # v4.9.260. + * See also commit 390881843b4f # v4.14.224. + * See also commit cb1f69d53ac8 # v4.19.179. + * See also commit 5f4243642873 # v5.4.103. + */ +static inline __printf(2, 3) +int sysfs_emit(char *buf, const char *fmt, ...) +{ + va_list args; + int len; + + if (WARN(!buf || +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) + /* + * For kernel releases older than 4.20, using the SLUB allocator will cause + * this alignment check to fail as that allocator did NOT align kmalloc + * allocations on a PAGE_SIZE boundary. + */ + false, +#else + offset_in_page(buf), +#endif + "invalid sysfs_emit: buf:%p\n", buf)) + return 0; + + va_start(args, fmt); + len = vscnprintf(buf, PAGE_SIZE, fmt, args); + va_end(args); + + return len; +} + +static inline __printf(3, 4) +int sysfs_emit_at(char *buf, int at, const char *fmt, ...) +{ + va_list args; + int len; + + if (WARN(!buf || +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 20, 0) + /* + * For kernel releases older than 4.20, using the SLUB allocator will cause + * this alignment check to fail as that allocator did NOT align kmalloc + * allocations on a PAGE_SIZE boundary. + */ + false || +#else + offset_in_page(buf) || +#endif + at < 0 || at >= PAGE_SIZE, + "invalid sysfs_emit_at: buf:%p at:%d\n", buf, at)) + return 0; + + va_start(args, fmt); + len = vscnprintf(buf + at, PAGE_SIZE - at, fmt, args); + va_end(args); + + return len; +} +#endif + /* <linux/t10-pi.h> */ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) diff --git a/scst/src/dev_handlers/scst_disk.c b/scst/src/dev_handlers/scst_disk.c index a892e2a..6b891cf 100644 --- a/scst/src/dev_handlers/scst_disk.c +++ b/scst/src/dev_handlers/scst_disk.c @@ -565,9 +565,9 @@ static ssize_t disk_sysfs_cluster_mode_show(struct kobject *kobj, struct kobj_at struct scst_device *dev = container_of(kobj, struct scst_device, dev_kobj); - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - dev->cluster_mode, - dev->cluster_mode ? SCST_SYSFS_KEY_MARK "\n" : ""); + return sysfs_emit(buf, "%d\n%s", + dev->cluster_mode, + dev->cluster_mode ? SCST_SYSFS_KEY_MARK "\n" : ""); } static int disk_sysfs_process_cluster_mode_store(struct scst_sysfs_work_item *work) diff --git a/scst/src/dev_handlers/scst_user.c b/scst/src/dev_handlers/scst_user.c index 7d3de9c..cfd9ce2 100644 --- a/scst/src/dev_handlers/scst_user.c +++ b/scst/src/dev_handlers/scst_user.c @@ -3897,10 +3897,10 @@ out: static ssize_t dev_user_sysfs_commands_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - int pos = 0, ppos, i; struct scst_device *dev; struct scst_user_dev *udev; unsigned long flags; + int i, ret = 0, pos; TRACE_ENTRY(); @@ -3913,26 +3913,24 @@ static ssize_t dev_user_sysfs_commands_show(struct kobject *kobj, struct kobj_at struct scst_user_cmd *ucmd; list_for_each_entry(ucmd, head, hash_list_entry) { - ppos = pos; - pos += scnprintf(&buf[pos], - SCST_SYSFS_BLOCK_SIZE - pos, - "ucmd %p (state %x, ref %d), sent_to_user %d, seen_by_user %d, aborted %d, jammed %d, scst_cmd %p\n", - ucmd, ucmd->state, - atomic_read(&ucmd->ucmd_ref), - ucmd->sent_to_user, ucmd->seen_by_user, - ucmd->aborted, ucmd->jammed, ucmd->cmd); - if (pos >= SCST_SYSFS_BLOCK_SIZE - 1) { - ppos += scnprintf(&buf[ppos], - SCST_SYSFS_BLOCK_SIZE - ppos, "...\n"); - pos = ppos; + pos = ret; + ret += sysfs_emit_at(buf, ret, + "ucmd %p (state %x, ref %d), sent_to_user %d, seen_by_user %d, aborted %d, jammed %d, scst_cmd %p\n", + ucmd, ucmd->state, + atomic_read(&ucmd->ucmd_ref), + ucmd->sent_to_user, ucmd->seen_by_user, + ucmd->aborted, ucmd->jammed, ucmd->cmd); + if (ret >= SCST_SYSFS_BLOCK_SIZE - 1) { + pos += sysfs_emit_at(buf, pos, "...\n"); + ret = pos; break; } } } spin_unlock_irqrestore(&udev->udev_cmd_threads.cmd_list_lock, flags); - TRACE_EXIT_RES(pos); - return pos; + TRACE_EXIT_RES(ret); + return ret; } static inline int test_cleanup_list(void) diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 2c31761..87c7e26 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -7734,8 +7734,8 @@ static ssize_t vdev_size_show(struct kobject *kobj, struct kobj_attribute *attr, */ key = !(virt_dev->nullio && size == VDISK_NULLIO_SIZE) && !size_shift; - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%llu\n%s", - size >> size_shift, key ? SCST_SYSFS_KEY_MARK "\n" : ""); + return sysfs_emit(buf, "%llu\n%s", + size >> size_shift, key ? SCST_SYSFS_KEY_MARK "\n" : ""); } static ssize_t vdev_sysfs_size_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) @@ -7764,9 +7764,9 @@ static ssize_t vdisk_sysfs_blocksize_show(struct kobject *kobj, struct kobj_attr dev = container_of(kobj, struct scst_device, dev_kobj); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - dev->block_size, dev->block_size == (1 << DEF_DISK_BLOCK_SHIFT) ? "" : - SCST_SYSFS_KEY_MARK "\n"); + ret = sysfs_emit(buf, "%d\n%s", + dev->block_size, dev->block_size == (1 << DEF_DISK_BLOCK_SHIFT) ? "" : + SCST_SYSFS_KEY_MARK "\n"); TRACE_EXIT_RES(ret); return ret; @@ -7807,9 +7807,9 @@ static ssize_t vdisk_opt_trans_len_show(struct kobject *kobj, container_of(kobj, struct scst_device, dev_kobj); struct scst_vdisk_dev *virt_dev = dev->dh_priv; - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - virt_dev->opt_trans_len, - virt_dev->opt_trans_len_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + return sysfs_emit(buf, "%d\n%s", + virt_dev->opt_trans_len, + virt_dev->opt_trans_len_set ? SCST_SYSFS_KEY_MARK "\n" : ""); } static ssize_t vdisk_sysfs_rd_only_show(struct kobject *kobj, struct kobj_attribute *attr, @@ -7824,9 +7824,9 @@ static ssize_t vdisk_sysfs_rd_only_show(struct kobject *kobj, struct kobj_attrib dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - virt_dev->rd_only, - virt_dev->rd_only == DEF_RD_ONLY ? "" : SCST_SYSFS_KEY_MARK "\n"); + ret = sysfs_emit(buf, "%d\n%s", + virt_dev->rd_only, + virt_dev->rd_only == DEF_RD_ONLY ? "" : SCST_SYSFS_KEY_MARK "\n"); TRACE_EXIT_RES(ret); return ret; @@ -7843,9 +7843,9 @@ static ssize_t vdisk_sysfs_wt_show(struct kobject *kobj, struct kobj_attribute * dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - virt_dev->wt_flag, - virt_dev->wt_flag == DEF_WRITE_THROUGH ? "" : SCST_SYSFS_KEY_MARK "\n"); + ret = sysfs_emit(buf, "%d\n%s", + virt_dev->wt_flag, + virt_dev->wt_flag == DEF_WRITE_THROUGH ? "" : SCST_SYSFS_KEY_MARK "\n"); TRACE_EXIT_RES(ret); return ret; @@ -7862,9 +7862,9 @@ static ssize_t vdisk_sysfs_tp_show(struct kobject *kobj, struct kobj_attribute * dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - virt_dev->thin_provisioned, - virt_dev->thin_provisioned_manually_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n%s", + virt_dev->thin_provisioned, + virt_dev->thin_provisioned_manually_set ? SCST_SYSFS_KEY_MARK "\n" : ""); TRACE_EXIT_RES(ret); return ret; @@ -7902,9 +7902,9 @@ static ssize_t vdisk_sysfs_expl_alua_show(struct kobject *kobj, struct scst_device *dev = container_of(kobj, struct scst_device, dev_kobj); - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - dev->expl_alua, - dev->expl_alua != DEF_EXPL_ALUA ? SCST_SYSFS_KEY_MARK "\n" : ""); + return sysfs_emit(buf, "%d\n%s", + dev->expl_alua, + dev->expl_alua != DEF_EXPL_ALUA ? SCST_SYSFS_KEY_MARK "\n" : ""); } static ssize_t vdisk_sysfs_expl_alua_store(struct kobject *kobj, @@ -7939,9 +7939,9 @@ static ssize_t vdisk_sysfs_nv_cache_show(struct kobject *kobj, struct kobj_attri dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - virt_dev->nv_cache, - virt_dev->nv_cache == DEF_NV_CACHE ? "" : SCST_SYSFS_KEY_MARK "\n"); + ret = sysfs_emit(buf, "%d\n%s", + virt_dev->nv_cache, + virt_dev->nv_cache == DEF_NV_CACHE ? "" : SCST_SYSFS_KEY_MARK "\n"); TRACE_EXIT_RES(ret); return ret; @@ -7959,9 +7959,9 @@ static ssize_t vdisk_sysfs_o_direct_show(struct kobject *kobj, struct kobj_attri dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - virt_dev->o_direct_flag, - virt_dev->o_direct_flag == DEF_O_DIRECT ? "" : SCST_SYSFS_KEY_MARK "\n"); + ret = sysfs_emit(buf, "%d\n%s", + virt_dev->o_direct_flag, + virt_dev->o_direct_flag == DEF_O_DIRECT ? "" : SCST_SYSFS_KEY_MARK "\n"); TRACE_EXIT_RES(ret); return ret; @@ -7974,9 +7974,9 @@ static ssize_t vdev_sysfs_dummy_show(struct kobject *kobj, dev_kobj); struct scst_vdisk_dev *virt_dev = dev->dh_priv; - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - virt_dev->dummy, - virt_dev->dummy != DEF_DUMMY ? SCST_SYSFS_KEY_MARK "\n" : ""); + return sysfs_emit(buf, "%d\n%s", + virt_dev->dummy, + virt_dev->dummy != DEF_DUMMY ? SCST_SYSFS_KEY_MARK "\n" : ""); } static ssize_t vdev_sysfs_rz_show(struct kobject *kobj, @@ -7987,9 +7987,9 @@ static ssize_t vdev_sysfs_rz_show(struct kobject *kobj, struct scst_vdisk_dev *virt_dev = dev->dh_priv; bool read_zero = virt_dev->read_zero; - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - read_zero, - read_zero != DEF_READ_ZERO ? SCST_SYSFS_KEY_MARK "\n" : ""); + return sysfs_emit(buf, "%d\n%s", + read_zero, + read_zero != DEF_READ_ZERO ? SCST_SYSFS_KEY_MARK "\n" : ""); } static ssize_t vdev_sysfs_rz_store(struct kobject *kobj, @@ -8033,11 +8033,10 @@ static ssize_t vdisk_sysfs_removable_show(struct kobject *kobj, struct kobj_attr dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", virt_dev->removable); + ret = sysfs_emit(buf, "%d\n", virt_dev->removable); if (virt_dev->dev->type != TYPE_ROM && virt_dev->removable != DEF_REMOVABLE) - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%s\n", - SCST_SYSFS_KEY_MARK); + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -8054,11 +8053,10 @@ static ssize_t vdisk_sysfs_tst_show(struct kobject *kobj, struct kobj_attribute dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", virt_dev->tst); + ret = sysfs_emit(buf, "%d\n", virt_dev->tst); if (virt_dev->tst != DEF_TST) - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%s\n", - SCST_SYSFS_KEY_MARK); + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -8076,11 +8074,10 @@ static ssize_t vdisk_sysfs_rotational_show(struct kobject *kobj, struct kobj_att dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", virt_dev->rotational); + ret = sysfs_emit(buf, "%d\n", virt_dev->rotational); if (virt_dev->rotational != DEF_ROTATIONAL) - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%s\n", - SCST_SYSFS_KEY_MARK); + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); TRACE_EXIT_RES(ret); return ret; @@ -8175,7 +8172,7 @@ static ssize_t vdev_sysfs_filename_show(struct kobject *kobj, struct kobj_attrib if (res != 0) goto out_put; - res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", work->res_buf); + res = sysfs_emit(buf, "%s\n", work->res_buf); out_put: scst_sysfs_work_put(work); @@ -8291,9 +8288,9 @@ static ssize_t vdev_sysfs_cluster_mode_show(struct kobject *kobj, struct kobj_at { struct scst_device *dev = container_of(kobj, struct scst_device, dev_kobj); - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - dev->cluster_mode, - dev->cluster_mode ? SCST_SYSFS_KEY_MARK "\n" : ""); + return sysfs_emit(buf, "%d\n%s", + dev->cluster_mode, + dev->cluster_mode ? SCST_SYSFS_KEY_MARK "\n" : ""); } static int vdev_sysfs_process_cluster_mode_store(struct scst_sysfs_work_item *work) @@ -8477,9 +8474,9 @@ static ssize_t vdev_sysfs_t10_vend_id_show(struct kobject *kobj, virt_dev = dev->dh_priv; read_lock(&vdisk_serial_rwlock); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s", - virt_dev->t10_vend_id, - virt_dev->t10_vend_id_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%s\n%s", + virt_dev->t10_vend_id, + virt_dev->t10_vend_id_set ? SCST_SYSFS_KEY_MARK "\n" : ""); read_unlock(&vdisk_serial_rwlock); TRACE_EXIT_RES(ret); @@ -8537,9 +8534,9 @@ static ssize_t vdev_sysfs_vend_specific_id_show(struct kobject *kobj, virt_dev = dev->dh_priv; read_lock(&vdisk_serial_rwlock); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s", - virt_dev->vend_specific_id, - virt_dev->vend_specific_id_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%s\n%s", + virt_dev->vend_specific_id, + virt_dev->vend_specific_id_set ? SCST_SYSFS_KEY_MARK "\n" : ""); read_unlock(&vdisk_serial_rwlock); TRACE_EXIT_RES(ret); @@ -8597,9 +8594,9 @@ static ssize_t vdev_sysfs_prod_id_show(struct kobject *kobj, virt_dev = dev->dh_priv; read_lock(&vdisk_serial_rwlock); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s", - virt_dev->prod_id, - virt_dev->prod_id_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%s\n%s", + virt_dev->prod_id, + virt_dev->prod_id_set ? SCST_SYSFS_KEY_MARK "\n" : ""); read_unlock(&vdisk_serial_rwlock); TRACE_EXIT_RES(ret); @@ -8657,9 +8654,9 @@ static ssize_t vdev_sysfs_prod_rev_lvl_show(struct kobject *kobj, virt_dev = dev->dh_priv; read_lock(&vdisk_serial_rwlock); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s", - virt_dev->prod_rev_lvl, - virt_dev->prod_rev_lvl_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%s\n%s", + virt_dev->prod_rev_lvl, + virt_dev->prod_rev_lvl_set ? SCST_SYSFS_KEY_MARK "\n" : ""); read_unlock(&vdisk_serial_rwlock); TRACE_EXIT_RES(ret); @@ -8718,9 +8715,9 @@ static ssize_t vdev_sysfs_scsi_device_name_show(struct kobject *kobj, struct kob virt_dev = dev->dh_priv; read_lock(&vdisk_serial_rwlock); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s", - virt_dev->scsi_device_name, - virt_dev->scsi_device_name_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%s\n%s", + virt_dev->scsi_device_name, + virt_dev->scsi_device_name_set ? SCST_SYSFS_KEY_MARK "\n" : ""); read_unlock(&vdisk_serial_rwlock); TRACE_EXIT_RES(ret); @@ -8777,9 +8774,9 @@ static ssize_t vdev_sysfs_t10_dev_id_show(struct kobject *kobj, struct kobj_attr virt_dev = dev->dh_priv; read_lock(&vdisk_serial_rwlock); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s", - virt_dev->t10_dev_id, - virt_dev->t10_dev_id_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%s\n%s", + virt_dev->t10_dev_id, + virt_dev->t10_dev_id_set ? SCST_SYSFS_KEY_MARK "\n" : ""); read_unlock(&vdisk_serial_rwlock); TRACE_EXIT_RES(ret); @@ -8846,14 +8843,13 @@ static ssize_t vdev_sysfs_eui64_id_show(struct kobject *kobj, read_lock(&vdisk_serial_rwlock); if (virt_dev->eui64_id_len) - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "0x"); + ret += sysfs_emit_at(buf, ret, "0x"); for (i = 0; i < virt_dev->eui64_id_len; i++) - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%02x", - virt_dev->eui64_id[i]); + ret += sysfs_emit_at(buf, ret, "%02x", virt_dev->eui64_id[i]); - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "\n%s", - virt_dev->eui64_id_len ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret += sysfs_emit_at(buf, ret, "\n%s", + virt_dev->eui64_id_len ? SCST_SYSFS_KEY_MARK "\n" : ""); read_unlock(&vdisk_serial_rwlock); return ret; @@ -8925,14 +8921,13 @@ static ssize_t vdev_sysfs_naa_id_show(struct kobject *kobj, struct kobj_attribut read_lock(&vdisk_serial_rwlock); if (virt_dev->naa_id_len) - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "0x"); + ret += sysfs_emit_at(buf, ret, "0x"); for (i = 0; i < virt_dev->naa_id_len; i++) - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%02x", - virt_dev->naa_id[i]); + ret += sysfs_emit_at(buf, ret, "%02x", virt_dev->naa_id[i]); - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "\n%s", - virt_dev->naa_id_len ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret += sysfs_emit_at(buf, ret, "\n%s", + virt_dev->naa_id_len ? SCST_SYSFS_KEY_MARK "\n" : ""); read_unlock(&vdisk_serial_rwlock); return ret; @@ -9000,9 +8995,9 @@ static ssize_t vdev_sysfs_usn_show(struct kobject *kobj, struct kobj_attribute * virt_dev = dev->dh_priv; read_lock(&vdisk_serial_rwlock); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s", - virt_dev->usn, - virt_dev->usn_set ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%s\n%s", + virt_dev->usn, + virt_dev->usn_set ? SCST_SYSFS_KEY_MARK "\n" : ""); read_unlock(&vdisk_serial_rwlock); TRACE_EXIT_RES(ret); @@ -9050,10 +9045,10 @@ static ssize_t vdev_sysfs_inq_vend_specific_show(struct kobject *kobj, virt_dev = dev->dh_priv; read_lock(&vdisk_serial_rwlock); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%.*s\n%s", - virt_dev->inq_vend_specific_len, - virt_dev->inq_vend_specific, - virt_dev->inq_vend_specific_len ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%.*s\n%s", + virt_dev->inq_vend_specific_len, + virt_dev->inq_vend_specific, + virt_dev->inq_vend_specific_len ? SCST_SYSFS_KEY_MARK "\n" : ""); read_unlock(&vdisk_serial_rwlock); return ret; @@ -9069,9 +9064,9 @@ static ssize_t vdev_sysfs_active_show(struct kobject *kobj, dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - virt_dev->dev_active, - virt_dev->dev_active != DEF_DEV_ACTIVE ? SCST_SYSFS_KEY_MARK "\n" : ""); + return sysfs_emit(buf, "%d\n%s", + virt_dev->dev_active, + virt_dev->dev_active != DEF_DEV_ACTIVE ? SCST_SYSFS_KEY_MARK "\n" : ""); } static int vdev_sysfs_process_active_store(struct scst_sysfs_work_item *work) @@ -9188,9 +9183,9 @@ static ssize_t vdev_sysfs_bind_alua_state_show(struct kobject *kobj, bind_alua_state = virt_dev->bind_alua_state; spin_unlock(&virt_dev->flags_lock); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - bind_alua_state, - bind_alua_state != DEF_BIND_ALUA_STATE ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n%s", + bind_alua_state, + bind_alua_state != DEF_BIND_ALUA_STATE ? SCST_SYSFS_KEY_MARK "\n" : ""); TRACE_EXIT_RES(ret); return ret; @@ -9255,9 +9250,9 @@ static ssize_t vdev_async_show(struct kobject *kobj, container_of(kobj, struct scst_device, dev_kobj); struct scst_vdisk_dev *virt_dev = dev->dh_priv; - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - virt_dev->async, - virt_dev->async ? SCST_SYSFS_KEY_MARK "\n" : ""); + return sysfs_emit(buf, "%d\n%s", + virt_dev->async, + virt_dev->async ? SCST_SYSFS_KEY_MARK "\n" : ""); } static ssize_t vdev_dif_filename_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) @@ -9271,9 +9266,9 @@ static ssize_t vdev_dif_filename_show(struct kobject *kobj, struct kobj_attribut dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s", - virt_dev->dif_filename, - virt_dev->dif_filename ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%s\n%s", + virt_dev->dif_filename, + virt_dev->dif_filename ? SCST_SYSFS_KEY_MARK "\n" : ""); TRACE_EXIT_RES(ret); return ret; @@ -9308,10 +9303,10 @@ static ssize_t vdev_lb_per_pb_exp_show(struct kobject *kobj, struct kobj_attribu container_of(kobj, struct scst_device, dev_kobj); struct scst_vdisk_dev *virt_dev = dev->dh_priv; - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - virt_dev->lb_per_pb_exp, - virt_dev->lb_per_pb_exp == DEF_LB_PER_PB_EXP ? "" : - SCST_SYSFS_KEY_MARK "\n"); + return sysfs_emit(buf, "%d\n%s", + virt_dev->lb_per_pb_exp, + virt_dev->lb_per_pb_exp == DEF_LB_PER_PB_EXP ? "" : + SCST_SYSFS_KEY_MARK "\n"); } static struct kobj_attribute vdev_active_attr = diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index d7bb44e..510dc0f 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -3715,10 +3715,10 @@ static ssize_t scst_cm_allow_not_conn_copy_show(struct kobject *kobj, struct kob TRACE_ENTRY(); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - scst_cm_allow_not_connected_copy, - scst_cm_allow_not_connected_copy == SCST_ALLOW_NOT_CONN_COPY_DEF ? - "" : SCST_SYSFS_KEY_MARK "\n"); + ret = sysfs_emit(buf, "%d\n%s", + scst_cm_allow_not_connected_copy, + scst_cm_allow_not_connected_copy == SCST_ALLOW_NOT_CONN_COPY_DEF ? + "" : SCST_SYSFS_KEY_MARK "\n"); TRACE_EXIT_RES(ret); return ret; diff --git a/scst/src/scst_mem.c b/scst/src/scst_mem.c index 056afaa..537b90c 100644 --- a/scst/src/scst_mem.c +++ b/scst/src/scst_mem.c @@ -1925,15 +1925,15 @@ static ssize_t sgv_sysfs_stat_show(struct kobject *kobj, struct kobj_attribute * merged += atomic_read(&pool->cache_acc[i].merged); } - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%-30s %-11s %-11s %-11s %-11s", - "Name", "Hit", "Total", "% merged", "Cached (P/I/O)"); + ret = sysfs_emit(buf, "%-30s %-11s %-11s %-11s %-11s", + "Name", "Hit", "Total", "% merged", "Cached (P/I/O)"); - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - "\n%-30s %-11d %-11d %-11d %d/%d/%d\n", - pool->name, hit, total, - allocated != 0 ? merged * 100 / allocated : 0, - pool->cached_pages, pool->inactive_cached_pages, - pool->cached_entries); + ret += sysfs_emit_at(buf, ret, + "\n%-30s %-11d %-11d %-11d %d/%d/%d\n", + pool->name, hit, total, + allocated != 0 ? merged * 100 / allocated : 0, + pool->cached_pages, pool->inactive_cached_pages, + pool->cached_entries); for (i = 0; i < SGV_POOL_ELEMENTS; i++) { int t = atomic_read(&pool->cache_acc[i].total_alloc) - @@ -1941,12 +1941,12 @@ static ssize_t sgv_sysfs_stat_show(struct kobject *kobj, struct kobj_attribute * allocated = t * (1 << i); merged = atomic_read(&pool->cache_acc[i].merged); - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - " %-28s %-11d %-11d %d\n", - pool->cache_names[i], - atomic_read(&pool->cache_acc[i].hit_alloc), - atomic_read(&pool->cache_acc[i].total_alloc), - allocated != 0 ? merged * 100 / allocated : 0); + ret += sysfs_emit_at(buf, ret, + " %-28s %-11d %-11d %d\n", + pool->cache_names[i], + atomic_read(&pool->cache_acc[i].hit_alloc), + atomic_read(&pool->cache_acc[i].total_alloc), + allocated != 0 ? merged * 100 / allocated : 0); } allocated = atomic_read(&pool->big_pages); @@ -1954,11 +1954,11 @@ static ssize_t sgv_sysfs_stat_show(struct kobject *kobj, struct kobj_attribute * oa = atomic_read(&pool->other_pages); om = atomic_read(&pool->other_merged); - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - " %-40s %d/%-9d %d/%d\n", "big/other", - atomic_read(&pool->big_alloc), atomic_read(&pool->other_alloc), - allocated != 0 ? merged * 100 / allocated : 0, - oa != 0 ? om / oa : 0); + ret += sysfs_emit_at(buf, ret, + " %-40s %d/%-9d %d/%d\n", "big/other", + atomic_read(&pool->big_alloc), atomic_read(&pool->other_alloc), + allocated != 0 ? merged * 100 / allocated : 0, + oa != 0 ? om / oa : 0); return ret; } @@ -2008,18 +2008,18 @@ static ssize_t sgv_sysfs_global_stat_show(struct kobject *kobj, struct kobj_attr spin_unlock_bh(&sgv_pools_lock); #ifdef CONFIG_SCST_NO_TOTAL_MEM_CHECKS - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%-42s %d\n", "Inactive pages", - inactive_pages); + ret = sysfs_emit(buf, "%-42s %d\n", "Inactive pages", + inactive_pages); #else - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%-42s %d/%d\n%-42s %d/%d\n%-42s %d/%d\n" - "%-42s %-11d\n", - "Inactive/active pages", inactive_pages, - atomic_read(&sgv_pages_total) - inactive_pages, - "Hi/lo watermarks [pages]", sgv_hi_wmk, sgv_lo_wmk, - "Hi watermark releases/failures", - atomic_read(&sgv_releases_on_hiwmk), - atomic_read(&sgv_releases_on_hiwmk_failed), - "Other allocs", atomic_read(&sgv_other_total_alloc)); + ret = sysfs_emit(buf, "%-42s %d/%d\n%-42s %d/%d\n%-42s %d/%d\n" + "%-42s %-11d\n", + "Inactive/active pages", inactive_pages, + atomic_read(&sgv_pages_total) - inactive_pages, + "Hi/lo watermarks [pages]", sgv_hi_wmk, sgv_lo_wmk, + "Hi watermark releases/failures", + atomic_read(&sgv_releases_on_hiwmk), + atomic_read(&sgv_releases_on_hiwmk_failed), + "Other allocs", atomic_read(&sgv_other_total_alloc)); #endif TRACE_EXIT(); diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index bf4b31e..d780b89 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -142,8 +142,8 @@ static ssize_t scst_read_trace_tbl(const struct scst_trace_log *tbl, char *buf, while (t->token) { if (log_level & t->val) - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "%s%s", - ret == 0 ? "" : " | ", t->token); + ret += sysfs_emit_at(buf, ret, "%s%s", + ret == 0 ? "" : " | ", t->token); t++; } @@ -159,26 +159,26 @@ static ssize_t scst_trace_level_show(const struct scst_trace_log *local_tbl, ret += scst_read_trace_tbl(scst_trace_tbl, buf, log_level, ret); ret += scst_read_trace_tbl(local_tbl, buf, log_level, ret); - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - "\n\n\nUsage:\n" - " echo \"all|none|default\" >trace_level\n" - " echo \"value DEC|0xHEX|0OCT\" >trace_level\n" - " echo \"add|del TOKEN\" >trace_level\n" + ret += sysfs_emit_at(buf, ret, + "\n\n\nUsage:\n" + " echo \"all|none|default\" >trace_level\n" + " echo \"value DEC|0xHEX|0OCT\" >trace_level\n" + " echo \"add|del TOKEN\" >trace_level\n" #ifdef CONFIG_SCST_DEBUG - "\nwhere TOKEN is one of [debug, function, line, pid,\n" + "\nwhere TOKEN is one of [debug, function, line, pid,\n" #ifndef GENERATING_UPSTREAM_PATCH - " entryexit, buff, mem, sg, out_of_mem,\n" + " entryexit, buff, mem, sg, out_of_mem,\n" #else - " buff, mem, sg, out_of_mem,\n" + " buff, mem, sg, out_of_mem,\n" #endif - " special, scsi, mgmt, minor,\n" - " mgmt_dbg, scsi_serializing,\n" - " retry, pr, block%s]\n", + " special, scsi, mgmt, minor,\n" + " mgmt_dbg, scsi_serializing,\n" + " retry, pr, block%s]\n", #else /* CONFIG_SCST_DEBUG */ - "\nwhere TOKEN is one of [function, line, pid, out_of_mem, special, scsi, mgmt, minor, scsi_serializing, retry, pr%s]\n", + "\nwhere TOKEN is one of [function, line, pid, out_of_mem, special, scsi, mgmt, minor, scsi_serializing, retry, pr%s]\n", #endif /* CONFIG_SCST_DEBUG */ - help ? help : ""); + help ? help : ""); return ret; } @@ -849,27 +849,27 @@ static ssize_t scst_tgtt_mgmt_show(struct kobject *kobj, struct kobj_attribute * tgtt = container_of(kobj, struct scst_tgt_template, tgtt_kobj); - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, help, - tgtt->tgtt_optional_attributes ? - " echo \"add_attribute <attribute> <value>\" >mgmt\n" - " echo \"del_attribute <attribute> <value>\" >mgmt\n" : "", - tgtt->tgt_optional_attributes ? - " echo \"add_target_attribute target_name <attribute> <value>\" >mgmt\n" - " echo \"del_target_attribute target_name <attribute> <value>\" >mgmt\n" : "", - tgtt->mgmt_cmd_help ? tgtt->mgmt_cmd_help : "", - tgtt->mgmt_cmd_help ? "\n" : "", - tgtt->add_target_parameters ? - "The following parameters available: " : "", - tgtt->add_target_parameters ? tgtt->add_target_parameters : "", - tgtt->add_target_parameters ? "\n" : "", - tgtt->tgtt_optional_attributes ? - "The following target driver attributes available: " : "", - tgtt->tgtt_optional_attributes ? tgtt->tgtt_optional_attributes : "", - tgtt->tgtt_optional_attributes ? "\n" : "", - tgtt->tgt_optional_attributes ? - "The following target attributes available: " : "", - tgtt->tgt_optional_attributes ? tgtt->tgt_optional_attributes : "", - tgtt->tgt_optional_attributes ? "\n" : ""); + return sysfs_emit(buf, help, + tgtt->tgtt_optional_attributes ? + " echo \"add_attribute <attribute> <value>\" >mgmt\n" + " echo \"del_attribute <attribute> <value>\" >mgmt\n" : "", + tgtt->tgt_optional_attributes ? + " echo \"add_target_attribute target_name <attribute> <value>\" >mgmt\n" + " echo \"del_target_attribute target_name <attribute> <value>\" >mgmt\n" : "", + tgtt->mgmt_cmd_help ? tgtt->mgmt_cmd_help : "", + tgtt->mgmt_cmd_help ? "\n" : "", + tgtt->add_target_parameters ? + "The following parameters available: " : "", + tgtt->add_target_parameters ? tgtt->add_target_parameters : "", + tgtt->add_target_parameters ? "\n" : "", + tgtt->tgtt_optional_attributes ? + "The following target driver attributes available: " : "", + tgtt->tgtt_optional_attributes ? tgtt->tgtt_optional_attributes : "", + tgtt->tgtt_optional_attributes ? "\n" : "", + tgtt->tgt_optional_attributes ? + "The following target attributes available: " : "", + tgtt->tgt_optional_attributes ? tgtt->tgt_optional_attributes : "", + tgtt->tgt_optional_attributes ? "\n" : ""); } static int scst_process_tgtt_mgmt_store(char *buffer, struct scst_tgt_template *tgtt) @@ -989,42 +989,35 @@ static ssize_t scst_tgtt_dif_capable_show(struct kobject *kobj, struct kobj_attr EXTRACHECKS_BUG_ON(!tgtt->dif_supported); - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - "dif_supported"); + ret += sysfs_emit_at(buf, ret, "dif_supported"); if (tgtt->hw_dif_type1_supported) - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - ", hw_dif_type1_supported"); + ret += sysfs_emit_at(buf, ret, ", hw_dif_type1_supported"); if (tgtt->hw_dif_type2_supported) - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - ", hw_dif_type2_supported"); + ret += sysfs_emit_at(buf, ret, ", hw_dif_type2_supported"); if (tgtt->hw_dif_type3_supported) - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - ", hw_dif_type3_supported"); + ret += sysfs_emit_at(buf, ret, ", hw_dif_type3_supported"); if (tgtt->hw_dif_ip_supported) - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - ", hw_dif_ip_supported"); + ret += sysfs_emit_at(buf, ret, ", hw_dif_ip_supported"); if (tgtt->hw_dif_same_sg_layout_required) - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - ", hw_dif_same_sg_layout_required"); + ret += sysfs_emit_at(buf, ret, ", hw_dif_same_sg_layout_required"); - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "\n"); + ret += sysfs_emit_at(buf, ret, "\n"); if (tgtt->supported_dif_block_sizes) { const int *p = tgtt->supported_dif_block_sizes; ssize_t pos; - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - "Supported blocks: "); + ret += sysfs_emit_at(buf, ret, "Supported blocks: "); pos = ret; while (*p != 0) { - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - "%s%d", ret == pos ? "" : ", ", *p); + ret += sysfs_emit_at(buf, ret, "%s%d", + ret == pos ? "" : ", ", *p); p++; } } @@ -1492,9 +1485,9 @@ static ssize_t scst_luns_mgmt_show(struct kobject *kobj, " echo \"clear\" >mgmt\n" "\n" "where parameters are one or more param_name=value pairs separated by ';'\n" - "\nThe following parameters available: read_only\n"; + "\nThe following parameters available: read_only"; - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s", help); + return sysfs_emit(buf, "%s\n", help); } static ssize_t scst_luns_mgmt_store(struct kobject *kobj, @@ -1525,22 +1518,21 @@ static ssize_t __scst_acg_addr_method_show(struct scst_acg *acg, char *buf) switch (acg->addr_method) { case SCST_LUN_ADDR_METHOD_FLAT: - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "FLAT\n"); + ret = sysfs_emit(buf, "FLAT\n"); break; case SCST_LUN_ADDR_METHOD_PERIPHERAL: - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "PERIPHERAL\n"); + ret = sysfs_emit(buf, "PERIPHERAL\n"); break; case SCST_LUN_ADDR_METHOD_LUN: - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "LUN\n"); + ret = sysfs_emit(buf, "LUN\n"); break; default: - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "UNKNOWN\n"); + ret = sysfs_emit(buf, "UNKNOWN\n"); break; } if (acg->addr_method != acg->tgt->tgtt->preferred_addr_method) - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - "%s\n", SCST_SYSFS_KEY_MARK); + ret += sysfs_emit_at(buf, ret, "%s\n", SCST_SYSFS_KEY_MARK); return ret; } @@ -1604,19 +1596,19 @@ static ssize_t __scst_acg_io_grouping_type_show(struct scst_acg *acg, char *buf) switch (acg->acg_io_grouping_type) { case SCST_IO_GROUPING_AUTO: - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", SCST_IO_GROUPING_AUTO_STR); + ret = sysfs_emit(buf, "%s\n", SCST_IO_GROUPING_AUTO_STR); break; case SCST_IO_GROUPING_THIS_GROUP_ONLY: - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s\n", - SCST_IO_GROUPING_THIS_GROUP_ONLY_STR, SCST_SYSFS_KEY_MARK); + ret = sysfs_emit(buf, "%s\n%s\n", + SCST_IO_GROUPING_THIS_GROUP_ONLY_STR, SCST_SYSFS_KEY_MARK); break; case SCST_IO_GROUPING_NEVER: - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s\n", - SCST_IO_GROUPING_NEVER_STR, SCST_SYSFS_KEY_MARK); + ret = sysfs_emit(buf, "%s\n%s\n", + SCST_IO_GROUPING_NEVER_STR, SCST_SYSFS_KEY_MARK); break; default: - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s\n", - acg->acg_io_grouping_type, SCST_SYSFS_KEY_MARK); + ret = sysfs_emit(buf, "%d\n%s\n", + acg->acg_io_grouping_type, SCST_SYSFS_KEY_MARK); break; } @@ -1758,7 +1750,7 @@ static ssize_t __scst_acg_black_hole_show(struct scst_acg *acg, char *buf) { int t = acg->acg_black_hole_type; - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", t); + return sysfs_emit(buf, "%d\n", t); } static ssize_t __scst_acg_black_hole_store(struct scst_acg *acg, const char *buf, size_t count) @@ -1882,13 +1874,12 @@ static ssize_t __scst_acg_cpu_mask_show(struct scst_acg *acg, char *buf) #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0) ret = cpumask_scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, &acg->acg_cpu_mask); #else - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%*pb", cpumask_pr_args(&acg->acg_cpu_mask)); + ret = sysfs_emit(buf, "%*pb", cpumask_pr_args(&acg->acg_cpu_mask)); #endif if (!cpumask_equal(&acg->acg_cpu_mask, &default_cpu_mask)) - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - "\n%s\n", SCST_SYSFS_KEY_MARK); + ret += sysfs_emit_at(buf, ret, "\n%s\n", SCST_SYSFS_KEY_MARK); else - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "\n"); + ret += sysfs_emit_at(buf, ret, "\n"); return ret; } @@ -2047,9 +2038,9 @@ static ssize_t scst_ini_group_mgmt_show(struct kobject *kobj, struct kobj_attrib { static const char help[] = "Usage: echo \"create GROUP_NAME\" >mgmt\n" - " echo \"del GROUP_NAME\" >mgmt\n"; + " echo \"del GROUP_NAME\" >mgmt"; - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s", help); + return sysfs_emit(buf, "%s\n", help); } static int scst_process_ini_group_mgmt_store(char *buffer, struct scst_tgt *tgt) @@ -2202,7 +2193,7 @@ static ssize_t scst_tgt_enable_show(struct kobject *kobj, struct kobj_attribute enabled = tgt->tgtt->is_target_enabled(tgt); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n", enabled ? 1 : 0); + ret = sysfs_emit(buf, "%d\n", enabled ? 1 : 0); TRACE_EXIT_RES(ret); return ret; @@ -2312,9 +2303,9 @@ static ssize_t scst_rel_tgt_id_show(struct kobject *kobj, struct kobj_attribute tgt = container_of(kobj, struct scst_tgt, tgt_kobj); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - tgt->rel_tgt_id, - tgt->rel_tgt_id != 0 ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n%s", + tgt->rel_tgt_id, + tgt->rel_tgt_id != 0 ? SCST_SYSFS_KEY_MARK "\n" : ""); TRACE_EXIT_RES(ret); return ret; @@ -2417,9 +2408,9 @@ static ssize_t scst_tgt_forward_src_show(struct kobject *kobj, struct kobj_attri { struct scst_tgt *tgt = container_of(kobj, struct scst_tgt, tgt_kobj); - return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - tgt->tgt_forward_src, - tgt->tgt_forward_src ? SCST_SYSFS_KEY_MARK "\n" : ""); + return sysfs_emit(buf, "%d\n%s", + tgt->tgt_forward_src, + tgt->tgt_forward_src ? SCST_SYSFS_KEY_MARK "\n" : ""); } static ssize_t scst_tgt_forward_src_store(struct kobject *kobj, struct kobj_attribute *attr, @@ -2460,9 +2451,9 @@ static ssize_t scst_tgt_forward_dst_show(struct kobject *kobj, struct kobj_attri tgt = container_of(kobj, struct scst_tgt, tgt_kobj); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - tgt->tgt_forward_dst, - tgt->tgt_forward_dst ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n%s", + tgt->tgt_forward_dst, + tgt->tgt_forward_dst ? SCST_SYSFS_KEY_MARK "\n" : ""); TRACE_EXIT_RES(ret); return ret; @@ -2561,9 +2552,9 @@ static ssize_t scst_tgt_aen_disabled_show(struct kobject *kobj, struct kobj_attr tgt = container_of(kobj, struct scst_tgt, tgt_kobj); - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - tgt->tgt_aen_disabled, - tgt->tgt_aen_disabled ? SCST_SYSFS_KEY_MARK "\n" : ""); + ret = sysfs_emit(buf, "%d\n%s", + tgt->tgt_aen_disabled, + tgt->tgt_aen_disabled ? SCST_SYSFS_KEY_MARK "\n" : ""); TRACE_EXIT_RES(ret); return ret; @@ -2659,8 +2650,8 @@ static ssize_t scst_tgt_comment_show(struct kobject *kobj, struct kobj_attribute tgt = container_of(kobj, struct scst_tgt, tgt_kobj); if (tgt->tgt_comment) - ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s", - tgt->tgt_comment, SCST_SYSFS_KEY_MARK "\n"); + ret = sysfs_emit(buf, "%s\n%s\n", + tgt->tgt_comment, SCST_SYSFS_KEY_MARK); else ret = 0; @@ -2752,40 +2743,34 @@ static ssize_t scst_tgt_dif_capable_show(struct kobject *kobj, struct kobj_attri EXTRACHECKS_BUG_ON(!tgt->tgt_dif_supported); - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "dif_supported"); + ret += sysfs_emit_at(buf, ret, "dif_supported"); if (tgt->tgt_hw_dif_type1_supported) - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - ... [truncated message content] |
From: Gleb C. <lna...@ya...> - 2025-05-19 17:48:52
|
Commit: 989802f GitHub URL: https://github.com/SCST-project/scst/commit/989802f48dbd40dbe84d22298a1a9554afa7f6f1 Author: Gleb Chesnokov Date: 2025-05-19T20:46:54+03:00 Log Message: ----------- scst: Replace snprintf() with scnprintf() Replace snprintf() with scnprintf() in two places: - code paths that build up a buffer incrementally - sysfs attribute “show” handlers scnprintf() guarantees its return value is the number of bytes actually written (never exceeding the buffer), preventing potential overruns. This patch does not change any functionality. Modified Paths: -------------- iscsi-scst/kernel/conn.c | 8 +- iscsi-scst/kernel/session.c | 4 +- scst/src/dev_handlers/scst_vdisk.c | 105 +++++++-------- scst/src/scst_debug.c | 40 +++--- scst_local/scst_local.c | 11 +- srpt/src/ib_srpt.c | 23 ++-- 6 files changed, 93 insertions(+), 98 deletions(-) =================================================================== diff --git a/iscsi-scst/kernel/conn.c b/iscsi-scst/kernel/conn.c index 73c7eae..dcc6a0f 100644 --- a/iscsi-scst/kernel/conn.c +++ b/iscsi-scst/kernel/conn.c @@ -169,17 +169,17 @@ static struct kobj_attribute iscsi_conn_target_ip_attr = static ssize_t iscsi_conn_transport_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - int pos; struct iscsi_conn *conn; + ssize_t ret; TRACE_ENTRY(); conn = container_of(kobj, struct iscsi_conn, conn_kobj); - pos = snprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", conn->transport->name); + ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", conn->transport->name); - TRACE_EXIT_RES(pos); - return pos; + TRACE_EXIT_RES(ret); + return ret; } static struct kobj_attribute iscsi_conn_transport_attr = diff --git a/iscsi-scst/kernel/session.c b/iscsi-scst/kernel/session.c index 1a428ce..9bfe05c 100644 --- a/iscsi-scst/kernel/session.c +++ b/iscsi-scst/kernel/session.c @@ -488,7 +488,7 @@ static ssize_t iscsi_sess_thread_pid_show(struct kobject *kobj, struct kobj_attr struct iscsi_session *sess = scst_sess_get_tgt_priv(scst_sess); struct iscsi_thread_pool *thr_pool = sess->sess_thr_pool; struct iscsi_thread *t; - int res = -ENOENT; + ssize_t res = -ENOENT; if (!thr_pool) goto out; @@ -497,7 +497,7 @@ static ssize_t iscsi_sess_thread_pid_show(struct kobject *kobj, struct kobj_attr mutex_lock(&thr_pool->tp_mutex); list_for_each_entry(t, &thr_pool->threads_list, threads_list_entry) - res += scnprintf(buf + res, PAGE_SIZE - res, "%d%s", + res += scnprintf(buf + res, SCST_SYSFS_BLOCK_SIZE - res, "%d%s", task_pid_vnr(t->thr), list_is_last(&t->threads_list_entry, &thr_pool->threads_list) ? diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 6aa5764..2c31761 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -6376,82 +6376,84 @@ out_done: static void vdisk_report_registering(const struct scst_vdisk_dev *virt_dev) { enum { buf_size = 256 }; - char *buf = kmalloc(buf_size, GFP_KERNEL); - int i, j; + char *buf; + int ret, pos; + buf = kmalloc(buf_size, GFP_KERNEL); if (!buf) { PRINT_ERROR("%s: out of memory", __func__); return; } - i = snprintf(buf, buf_size, "Registering virtual %s device %s ", - virt_dev->vdev_devt->name, virt_dev->name); - j = i; + ret = scnprintf(buf, buf_size, "Registering virtual %s device %s ", + virt_dev->vdev_devt->name, virt_dev->name); + pos = ret; if (virt_dev->wt_flag) - i += snprintf(&buf[i], buf_size - i, "(WRITE_THROUGH"); + ret += scnprintf(buf + ret, buf_size - ret, "(WRITE_THROUGH"); if (virt_dev->nv_cache) - i += snprintf(&buf[i], buf_size - i, "%sNV_CACHE", - (j == i) ? "(" : ", "); + ret += scnprintf(buf + ret, buf_size - ret, "%sNV_CACHE", + ret == pos ? "(" : ", "); if (virt_dev->rd_only) - i += snprintf(&buf[i], buf_size - i, "%sREAD_ONLY", - (j == i) ? "(" : ", "); + ret += scnprintf(buf + ret, buf_size - ret, "%sREAD_ONLY", + ret == pos ? "(" : ", "); if (virt_dev->o_direct_flag) - i += snprintf(&buf[i], buf_size - i, "%sO_DIRECT", - (j == i) ? "(" : ", "); + ret += scnprintf(buf + ret, buf_size - ret, "%sO_DIRECT", + ret == pos ? "(" : ", "); if (virt_dev->nullio) - i += snprintf(&buf[i], buf_size - i, "%sNULLIO", - (j == i) ? "(" : ", "); + ret += scnprintf(buf + ret, buf_size - ret, "%sNULLIO", + ret == pos ? "(" : ", "); if (virt_dev->blockio) - i += snprintf(&buf[i], buf_size - i, "%sBLOCKIO", - (j == i) ? "(" : ", "); + ret += scnprintf(buf + ret, buf_size - ret, "%sBLOCKIO", + ret == pos ? "(" : ", "); if (virt_dev->removable) - i += snprintf(&buf[i], buf_size - i, "%sREMOVABLE", - (j == i) ? "(" : ", "); + ret += scnprintf(buf + ret, buf_size - ret, "%sREMOVABLE", + ret == pos ? "(" : ", "); if (!virt_dev->dev_active) - i += snprintf(&buf[i], buf_size - i, "%sINACTIVE", - (j == i) ? "(" : ", "); + ret += scnprintf(buf + ret, buf_size - ret, "%sINACTIVE", + ret == pos ? "(" : ", "); if (virt_dev->tst != DEF_TST) - i += snprintf(&buf[i], buf_size - i, "%sTST %d", - (j == i) ? "(" : ", ", virt_dev->tst); + ret += scnprintf(buf + ret, buf_size - ret, "%sTST %d", + ret == pos ? "(" : ", ", virt_dev->tst); if (virt_dev->rotational) - i += snprintf(&buf[i], buf_size - i, "%sROTATIONAL", - (j == i) ? "(" : ", "); + ret += scnprintf(buf + ret, buf_size - ret, "%sROTATIONAL", + ret == pos ? "(" : ", "); if (virt_dev->thin_provisioned) - i += snprintf(&buf[i], buf_size - i, "%sTHIN_PROVISIONED", - (j == i) ? "(" : ", "); + ret += scnprintf(buf + ret, buf_size - ret, "%sTHIN_PROVISIONED", + ret == pos ? "(" : ", "); if (virt_dev->dif_mode != SCST_DIF_MODE_NONE) { - i += snprintf(&buf[i], buf_size - i, "%sDIF MODE %x, DIF TYPE %d", - (j == i) ? "(" : ", ", - virt_dev->dif_mode, virt_dev->dif_type); + ret += scnprintf(buf + ret, buf_size - ret, "%sDIF MODE %x, DIF TYPE %d", + ret == pos ? "(" : ", ", + virt_dev->dif_mode, virt_dev->dif_type); + if (virt_dev->dif_filename) - i += snprintf(&buf[i], buf_size - i, ", DIF FILENAME %s", - virt_dev->dif_filename); + ret += scnprintf(buf + ret, buf_size - ret, ", DIF FILENAME %s", + virt_dev->dif_filename); else if (virt_dev->dif_static_app_tag_combined != SCST_DIF_NO_CHECK_APP_TAG) - i += snprintf(&buf[i], buf_size - i, ", DIF STATIC APP TAG %llx", - (long long)be64_to_cpu(virt_dev->dif_static_app_tag_combined)); + ret += scnprintf(buf + ret, buf_size - ret, ", DIF STATIC APP TAG %llx", + (long long)be64_to_cpu(virt_dev->dif_static_app_tag_combined)); } if (virt_dev->async) - i += snprintf(&buf[i], buf_size - i, "%sASYNC", - (j == i) ? "(" : ", "); + ret += scnprintf(buf + ret, buf_size - ret, "%sASYNC", + ret == pos ? "(" : ", "); if (virt_dev->dummy) - i += snprintf(&buf[i], buf_size - i, "%sDUMMY", - (j == i) ? "(" : ", "); + ret += scnprintf(buf + ret, buf_size - ret, "%sDUMMY", + ret == pos ? "(" : ", "); - PRINT_INFO("%s%s", buf, j == i ? "" : ")"); + PRINT_INFO("%s%s", buf, ret == pos ? "" : ")"); kfree(buf); } @@ -8150,9 +8152,9 @@ out_put: static ssize_t vdev_sysfs_filename_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - int res = 0; struct scst_device *dev; struct scst_sysfs_work_item *work; + ssize_t res = 0; TRACE_ENTRY(); @@ -8173,7 +8175,7 @@ static ssize_t vdev_sysfs_filename_show(struct kobject *kobj, struct kobj_attrib if (res != 0) goto out_put; - res = snprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", work->res_buf); + res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n", work->res_buf); out_put: scst_sysfs_work_put(work); @@ -9040,41 +9042,36 @@ static ssize_t vdev_sysfs_inq_vend_specific_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - int pos; struct scst_device *dev; struct scst_vdisk_dev *virt_dev; + ssize_t ret; dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; read_lock(&vdisk_serial_rwlock); - pos = snprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%.*s\n%s", - virt_dev->inq_vend_specific_len, - virt_dev->inq_vend_specific, - virt_dev->inq_vend_specific_len ? - SCST_SYSFS_KEY_MARK "\n" : ""); + ret = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%.*s\n%s", + virt_dev->inq_vend_specific_len, + virt_dev->inq_vend_specific, + virt_dev->inq_vend_specific_len ? SCST_SYSFS_KEY_MARK "\n" : ""); read_unlock(&vdisk_serial_rwlock); - return pos; + return ret; } static ssize_t vdev_sysfs_active_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - int pos; struct scst_device *dev; struct scst_vdisk_dev *virt_dev; dev = container_of(kobj, struct scst_device, dev_kobj); virt_dev = dev->dh_priv; - pos = snprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", - virt_dev->dev_active, - virt_dev->dev_active != DEF_DEV_ACTIVE ? - SCST_SYSFS_KEY_MARK "\n" : ""); - - return pos; + return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%d\n%s", + virt_dev->dev_active, + virt_dev->dev_active != DEF_DEV_ACTIVE ? SCST_SYSFS_KEY_MARK "\n" : ""); } static int vdev_sysfs_process_active_store(struct scst_sysfs_work_item *work) diff --git a/scst/src/scst_debug.c b/scst/src/scst_debug.c index 562fbb4..1d71559 100644 --- a/scst/src/scst_debug.c +++ b/scst/src/scst_debug.c @@ -63,27 +63,26 @@ static inline int get_current_tid(void) int debug_print_with_prefix(unsigned long trace_flag, const char *severity, const char *prefix, const char *func, int line, const char *fmt, ...) { - int i; - unsigned long flags; int pid = get_current_tid(); + unsigned long flags; va_list args; + int ret; spin_lock_irqsave(&trace_buf_lock, flags); strscpy(trace_buf, severity, TRACE_BUF_SIZE); - i = strlen(trace_buf); + ret = strlen(trace_buf); if (trace_flag & TRACE_PID) - i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, "[%d]: ", pid); + ret += scnprintf(trace_buf + ret, TRACE_BUF_SIZE - ret, "[%d]: ", pid); if (prefix) - i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, "%s: ", - prefix); + ret += scnprintf(trace_buf + ret, TRACE_BUF_SIZE - ret, "%s: ", prefix); if (trace_flag & TRACE_FUNCTION) - i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, "%s:", func); + ret += scnprintf(trace_buf + ret, TRACE_BUF_SIZE - ret, "%s:", func); if (trace_flag & TRACE_LINE) - i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, "%i:", line); + ret += scnprintf(trace_buf + ret, TRACE_BUF_SIZE - ret, "%i:", line); - i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, "%s\n", fmt); + ret += scnprintf(trace_buf + ret, TRACE_BUF_SIZE - ret, "%s\n", fmt); va_start(args, fmt); vprintk(trace_buf, args); @@ -91,7 +90,7 @@ int debug_print_with_prefix(unsigned long trace_flag, const char *severity, cons spin_unlock_irqrestore(&trace_buf_lock, flags); - return i; + return ret; } EXPORT_SYMBOL(debug_print_with_prefix); @@ -102,9 +101,9 @@ EXPORT_SYMBOL(debug_print_with_prefix); */ void debug_print_buffer(const void *data, int len) { - int z, z1, i; const unsigned char *buf = (const unsigned char *)data; unsigned long flags; + int z, z1, i; if (!buf) return; @@ -115,28 +114,27 @@ void debug_print_buffer(const void *data, int len) for (z = 0, z1 = 0, i = 0; z < len; z++) { if (z % 16 == 0) { if (z != 0) { - i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, - " "); - for (; (z1 < z) && (i < TRACE_BUF_SIZE - 1); - z1++) { + i += scnprintf(trace_buf + i, TRACE_BUF_SIZE - i, " "); + + for (; z1 < z && i < TRACE_BUF_SIZE - 1; z1++) { if (buf[z1] >= 0x20 && buf[z1] < 0x80) trace_buf[i++] = buf[z1]; else trace_buf[i++] = '.'; } trace_buf[i] = '\0'; + PRINT(KERN_INFO, "%s", trace_buf); i = 0; } - i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, - "%4x: ", z); + i += scnprintf(trace_buf + i, TRACE_BUF_SIZE - i, "%4x: ", z); } - i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, "%02x ", - buf[z]); + i += scnprintf(trace_buf + i, TRACE_BUF_SIZE - i, "%02x ", buf[z]); } - i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, " "); - for (; (z1 < z) && (i < TRACE_BUF_SIZE - 1); z1++) { + i += scnprintf(trace_buf + i, TRACE_BUF_SIZE - i, " "); + + for (; z1 < z && i < TRACE_BUF_SIZE - 1; z1++) { if (buf[z1] > 0x20 && buf[z1] < 0x80) trace_buf[i++] = buf[z1]; else diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index 3c1e1e8..82c16f7 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -438,12 +438,15 @@ static const struct attribute *scst_local_tgt_attrs[] = { static ssize_t host_no_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - struct scst_session *scst_sess = - container_of(kobj, struct scst_session, sess_kobj); + struct scst_session *scst_sess = container_of(kobj, struct scst_session, sess_kobj); struct scst_local_sess *sess = scst_sess_get_tgt_priv(scst_sess); - struct Scsi_Host *host = sess->shost; + struct Scsi_Host *host; - return host ? snprintf(buf, PAGE_SIZE, "%u\n", host->host_no) : -EINVAL; + host = sess->shost; + if (!host) + return -EINVAL; + + return scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%u\n", host->host_no); } static struct kobj_attribute scst_local_host_no_attr = __ATTR_RO(host_no); diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 03f3272..27aece6 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -3954,12 +3954,12 @@ static ssize_t show_comp_v_mask(struct kobject *kobj, if (!sport) goto out; #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0) - res = cpumask_scnprintf(buf, PAGE_SIZE, &sport->comp_v_mask); + res = cpumask_scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, &sport->comp_v_mask); #else - res = scnprintf(buf, PAGE_SIZE, "%*pb", + res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%*pb", cpumask_pr_args(&sport->comp_v_mask)); #endif - res += scnprintf(&buf[res], PAGE_SIZE - res, "\n%s\n", + res += scnprintf(buf + res, SCST_SYSFS_BLOCK_SIZE - res, "\n%s\n", SCST_SYSFS_KEY_MARK); out: @@ -4064,25 +4064,22 @@ out: static struct kobj_attribute srpt_link_layer_attr = __ATTR(link_layer, S_IRUGO, srpt_show_link_layer, NULL); -static ssize_t show_port_id(struct kobject *kobj, struct kobj_attribute *attr, - char *buf) +static ssize_t show_port_id(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { - struct scst_tgt *scst_tgt = container_of(kobj, struct scst_tgt, - tgt_kobj); + struct scst_tgt *scst_tgt = container_of(kobj, struct scst_tgt, tgt_kobj); struct srpt_port *sport = scst_tgt_get_tgt_priv(scst_tgt); - int res = -E_TGT_PRIV_NOT_YET_SET; + ssize_t res = -E_TGT_PRIV_NOT_YET_SET; if (!sport) goto out; mutex_lock(&sport->mutex); - snprintf(buf, PAGE_SIZE, "%s\n%s", sport->port_id, - strcmp(sport->port_id, DEFAULT_SRPT_ID_STRING) ? - SCST_SYSFS_KEY_MARK "\n" : ""); + res = scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, "%s\n%s", + sport->port_id, + strcmp(sport->port_id, DEFAULT_SRPT_ID_STRING) ? + SCST_SYSFS_KEY_MARK "\n" : ""); mutex_unlock(&sport->mutex); - res = strlen(buf); - out: return res; } |
From: Gleb C. <lna...@ya...> - 2025-05-19 17:47:22
|
Commit: 7cdf85e GitHub URL: https://github.com/SCST-project/scst/commit/7cdf85e66399705ad4f548fdfabb4bfb750bcf4c Author: Gleb Chesnokov Date: 2025-05-19T20:46:54+03:00 Log Message: ----------- scst_debug: Fix multiple checkpatch warnings This patch does not change any functionality. Modified Paths: -------------- scst/include/scst_debug.h | 23 +++-- scst/src/scst_debug.c | 68 +++++++-------- 2 files changed, 43 insertions(+), 48 deletions(-) =================================================================== diff --git a/scst/include/scst_debug.h b/scst/include/scst_debug.h index 0b1f348..2d8487e 100644 --- a/scst/include/scst_debug.h +++ b/scst/include/scst_debug.h @@ -106,7 +106,7 @@ #define TRACE_ALL 0xffffffff /* Flags 0xXXXXXXXXXX000000 are local for users */ -#define TRACE_MINOR_AND_MGMT_DBG (TRACE_MINOR|TRACE_MGMT_DEBUG) +#define TRACE_MINOR_AND_MGMT_DBG (TRACE_MINOR | TRACE_MGMT_DEBUG) /* * Note: in the next two printk() statements the KERN_CONT macro is only @@ -132,20 +132,19 @@ #endif int __printf(6, 7) -debug_print_with_prefix(unsigned long trace_flag, - const char *severity, const char *prefix, const char *func, int line, - const char *fmt, ...); +debug_print_with_prefix(unsigned long trace_flag, const char *severity, const char *prefix, + const char *func, int line, const char *fmt, ...); void debug_print_buffer(const void *data, int len); const char *debug_transport_id_to_initiator_name(const uint8_t *transport_id); #define TRACING_MINOR() (trace_flag & TRACE_MINOR) -#define TRACE(trace, format, args...) \ -do { \ - if (___unlikely(trace_flag & (trace))) { \ - debug_print_with_prefix(trace_flag, KERN_INFO, \ - __LOG_PREFIX, __func__, __LINE__, format, ## args); \ - } \ +#define TRACE(trace, format, args...) \ +do { \ + if (___unlikely(trace_flag & (trace))) { \ + debug_print_with_prefix(trace_flag, KERN_INFO, \ + __LOG_PREFIX, __func__, __LINE__, format, ## args); \ + } \ } while (0) #define TRACE_PR(format, args...) TRACE(TRACE_PRES, format, ## args) @@ -275,11 +274,11 @@ do { \ #define TRACE_DBG(format, args...) \ TRACE_DBG_FLAG(TRACE_DEBUG, format, ## args) #define TRACE_DBG_SPECIAL(format, args...) \ - TRACE_DBG_FLAG(TRACE_DEBUG|TRACE_SPECIAL, format, ## args) + TRACE_DBG_FLAG(TRACE_DEBUG | TRACE_SPECIAL, format, ## args) #define TRACE_MGMT_DBG(format, args...) \ TRACE_DBG_FLAG(TRACE_MGMT_DEBUG, format, ## args) #define TRACE_MGMT_DBG_SPECIAL(args...) \ - TRACE_DBG_FLAG(TRACE_MGMT_DEBUG|TRACE_SPECIAL, format, ## args) + TRACE_DBG_FLAG(TRACE_MGMT_DEBUG | TRACE_SPECIAL, format, ## args) #define TRACE_BLOCK(format, args...) \ TRACE_DBG_FLAG(TRACE_BLOCKING, format, ## args) diff --git a/scst/src/scst_debug.c b/scst/src/scst_debug.c index 5e67618..562fbb4 100644 --- a/scst/src/scst_debug.c +++ b/scst/src/scst_debug.c @@ -60,8 +60,8 @@ static inline int get_current_tid(void) * * Adds, if requested by trace_flag, debug prefix in the beginning */ -int debug_print_with_prefix(unsigned long trace_flag, const char *severity, - const char *prefix, const char *func, int line, const char *fmt, ...) +int debug_print_with_prefix(unsigned long trace_flag, const char *severity, const char *prefix, + const char *func, int line, const char *fmt, ...) { int i; unsigned long flags; @@ -75,7 +75,7 @@ int debug_print_with_prefix(unsigned long trace_flag, const char *severity, if (trace_flag & TRACE_PID) i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, "[%d]: ", pid); - if (prefix != NULL) + if (prefix) i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, "%s: ", prefix); if (trace_flag & TRACE_FUNCTION) @@ -103,10 +103,10 @@ EXPORT_SYMBOL(debug_print_with_prefix); void debug_print_buffer(const void *data, int len) { int z, z1, i; - const unsigned char *buf = (const unsigned char *) data; + const unsigned char *buf = (const unsigned char *)data; unsigned long flags; - if (buf == NULL) + if (!buf) return; spin_lock_irqsave(&trace_buf_lock, flags); @@ -119,8 +119,7 @@ void debug_print_buffer(const void *data, int len) " "); for (; (z1 < z) && (i < TRACE_BUF_SIZE - 1); z1++) { - if ((buf[z1] >= 0x20) && - (buf[z1] < 0x80)) + if (buf[z1] >= 0x20 && buf[z1] < 0x80) trace_buf[i++] = buf[z1]; else trace_buf[i++] = '.'; @@ -138,7 +137,7 @@ void debug_print_buffer(const void *data, int len) i += snprintf(&trace_buf[i], TRACE_BUF_SIZE - i, " "); for (; (z1 < z) && (i < TRACE_BUF_SIZE - 1); z1++) { - if ((buf[z1] > 0x20) && (buf[z1] < 0x80)) + if (buf[z1] > 0x20 && buf[z1] < 0x80) trace_buf[i++] = buf[z1]; else trace_buf[i++] = '.'; @@ -148,7 +147,6 @@ void debug_print_buffer(const void *data, int len) PRINT(KERN_INFO, "%s", trace_buf); spin_unlock_irqrestore(&trace_buf_lock, flags); - return; } EXPORT_SYMBOL(debug_print_buffer); @@ -175,7 +173,7 @@ const char *debug_transport_id_to_initiator_name(const uint8_t *transport_id) char *name_buf; unsigned long flags; - sBUG_ON(transport_id == NULL); /* better to catch it not under lock */ + sBUG_ON(!transport_id); /* better to catch it not under lock */ spin_lock_irqsave(&trace_buf_lock, flags); @@ -190,50 +188,48 @@ const char *debug_transport_id_to_initiator_name(const uint8_t *transport_id) switch (transport_id[0] & 0x0f) { case SCSI_TRANSPORTID_PROTOCOLID_ISCSI: - scnprintf(name_buf, SIZEOF_NAME_BUF, "%s", - &transport_id[4]); + scnprintf(name_buf, SIZEOF_NAME_BUF, "%s", &transport_id[4]); break; case SCSI_TRANSPORTID_PROTOCOLID_FCP2: scnprintf(name_buf, SIZEOF_NAME_BUF, - "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", - transport_id[8], transport_id[9], - transport_id[10], transport_id[11], - transport_id[12], transport_id[13], - transport_id[14], transport_id[15]); + "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", + transport_id[8], transport_id[9], + transport_id[10], transport_id[11], + transport_id[12], transport_id[13], + transport_id[14], transport_id[15]); break; case SCSI_TRANSPORTID_PROTOCOLID_SPI5: scnprintf(name_buf, SIZEOF_NAME_BUF, - "%x:%x", be16_to_cpu((__force __be16)transport_id[2]), - be16_to_cpu((__force __be16)transport_id[6])); + "%x:%x", be16_to_cpu((__force __be16)transport_id[2]), + be16_to_cpu((__force __be16)transport_id[6])); break; case SCSI_TRANSPORTID_PROTOCOLID_SRP: scnprintf(name_buf, SIZEOF_NAME_BUF, - "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x" - ":%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", - transport_id[8], transport_id[9], - transport_id[10], transport_id[11], - transport_id[12], transport_id[13], - transport_id[14], transport_id[15], - transport_id[16], transport_id[17], - transport_id[18], transport_id[19], - transport_id[20], transport_id[21], - transport_id[22], transport_id[23]); + "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", + transport_id[8], transport_id[9], + transport_id[10], transport_id[11], + transport_id[12], transport_id[13], + transport_id[14], transport_id[15], + transport_id[16], transport_id[17], + transport_id[18], transport_id[19], + transport_id[20], transport_id[21], + transport_id[22], transport_id[23]); break; case SCSI_TRANSPORTID_PROTOCOLID_SAS: scnprintf(name_buf, SIZEOF_NAME_BUF, - "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", - transport_id[4], transport_id[5], - transport_id[6], transport_id[7], - transport_id[8], transport_id[9], - transport_id[10], transport_id[11]); + "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", + transport_id[4], transport_id[5], + transport_id[6], transport_id[7], + transport_id[8], transport_id[9], + transport_id[10], transport_id[11]); break; case SCST_TRANSPORTID_PROTOCOLID_COPY_MGR: scnprintf(name_buf, SIZEOF_NAME_BUF, - "%s", &transport_id[2]); + "%s", &transport_id[2]); break; default: scnprintf(name_buf, SIZEOF_NAME_BUF, - "(Not known protocol ID %x)", transport_id[0] & 0x0f); + "(Not known protocol ID %x)", transport_id[0] & 0x0f); break; } |
From: Gleb C. <lna...@ya...> - 2025-05-16 14:33:58
|
Commit: ac1e7f8 GitHub URL: https://github.com/SCST-project/scst/commit/ac1e7f82b7fc3fbeffea2e882d123d76ed608f62 Author: Gleb Chesnokov Date: 2025-05-16T17:33:33+03:00 Log Message: ----------- scst: Fix SCST_KVER to use semantic version only Previously, SCST_KVER included the full kernel release string. This patch limits it to the semantic version (e.g. "6.9.0") for cleaner and more consistent output in dmesg, sysfs, and modinfo. Fixes: 6782003bfc7d ("scst: Extend build metadata passed to the SCST") Modified Paths: -------------- Makefile | 3 ++- scst/include/scst_const.h | 12 ++++++------ scst/src/Kbuild | 2 +- scst/src/scst_main.c | 4 ++-- scst/src/scst_sysfs.c | 8 ++++---- 5 files changed, 15 insertions(+), 14 deletions(-) =================================================================== diff --git a/Makefile b/Makefile index 9cfbaea..04100b1 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,7 @@ ISCSI_DIR = iscsi-scst BUILD_DATE := $(shell date -u '+%Y/%m/%d-%H:%M:%S-%Z%:z') GIT_COMMIT := $(shell git rev-parse --short=12 HEAD 2>/dev/null) +KVER_SEMVER := $(shell echo ${KVER} | cut -d'-' -f1) ifndef BUILD_NUMBER BUILD_NUMBER := $(shell git rev-list --count HEAD 2>/dev/null || echo 0) @@ -80,7 +81,7 @@ ifndef ARCH_TYPE ARCH_TYPE := $(shell uname -m) endif -export KVER BUILD_DATE GIT_COMMIT BUILD_NUMBER ARCH_TYPE +export KVER BUILD_DATE GIT_COMMIT KVER_SEMVER BUILD_NUMBER ARCH_TYPE RELEASE_VERSION := $(shell echo -n "$$(sed -n 's/^\#define[[:blank:]]SCST_VERSION_NAME[[:blank:]]*\"\([^-]*\).*\"/\1/p' scst/include/scst_const.h)") diff --git a/scst/include/scst_const.h b/scst/include/scst_const.h index 7b65dc5..7bbb85c 100644 --- a/scst/include/scst_const.h +++ b/scst/include/scst_const.h @@ -53,12 +53,6 @@ #define SCST_VERSION_STRING_SUFFIX #define SCST_VERSION_STRING SCST_VERSION_NAME SCST_VERSION_STRING_SUFFIX -#ifdef SCST_KVER -#define SCST_KVER_STRING SCST_STRINGIFY(SCST_KVER) -#else -#define SCST_KVER_STRING "" -#endif - #ifdef SCST_BUILD_DATE #define SCST_BUILD_DATE_STRING SCST_STRINGIFY(SCST_BUILD_DATE) #else @@ -71,6 +65,12 @@ #define SCST_GIT_COMMIT_STRING "" #endif +#ifdef SCST_KVER +#define SCST_KVER_STRING SCST_STRINGIFY(SCST_KVER) +#else +#define SCST_KVER_STRING "" +#endif + #ifdef SCST_BUILD_NUMBER #define SCST_BUILD_NUMBER_STRING SCST_STRINGIFY(SCST_BUILD_NUMBER) #else diff --git a/scst/src/Kbuild b/scst/src/Kbuild index caf1a64..a91679c 100644 --- a/scst/src/Kbuild +++ b/scst/src/Kbuild @@ -16,9 +16,9 @@ ccflags-y := -I$(src)/../include \ -Wstrict-prototypes ccflags-y += $(shell [ -n "${CONFIG_SCST_NO_DLM}" ] && echo -DCONFIG_SCST_NO_DLM) \ - $(shell [ -n "${KVER}" ] && echo -DSCST_KVER=${KVER}) \ $(shell [ -n "${BUILD_DATE}" ] && echo -DSCST_BUILD_DATE=${BUILD_DATE}) \ $(shell [ -n "${GIT_COMMIT}" ] && echo -DSCST_GIT_COMMIT=${GIT_COMMIT}) \ + $(shell [ -n "${KVER}" ] && echo -DSCST_KVER=${KVER_SEMVER}) \ $(shell [ -n "${BUILD_NUMBER}" ] && echo -DSCST_BUILD_NUMBER=${BUILD_NUMBER}) \ $(shell [ -n "${ARCH_TYPE}" ] && echo -DSCST_ARCH_TYPE=${ARCH_TYPE}) diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 62b760a..c7655e6 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -2475,9 +2475,9 @@ static int __init init_scst(void) scst_max_cmd_mem, scst_max_dev_cmd_mem); #endif PRINT_INFO("SCST version: %s", SCST_VERSION_STRING); - PRINT_INFO("SCST kver: %s", SCST_KVER_STRING); PRINT_INFO("SCST build date: %s", SCST_BUILD_DATE_STRING); PRINT_INFO("SCST git commit sha1: %s", SCST_GIT_COMMIT_STRING); + PRINT_INFO("SCST kver: %s", SCST_KVER_STRING); PRINT_INFO("SCST build number: %s", SCST_BUILD_NUMBER_STRING); PRINT_INFO("SCST arch type: %s", SCST_ARCH_TYPE_STRING); scst_print_config(); @@ -2632,8 +2632,8 @@ MODULE_AUTHOR("Vladislav Bolkhovitin"); MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("SCSI target core"); MODULE_VERSION(SCST_VERSION_STRING); -MODULE_INFO(kver, SCST_KVER_STRING); MODULE_INFO(build_date, SCST_BUILD_DATE_STRING); MODULE_INFO(git_commit, SCST_GIT_COMMIT_STRING); +MODULE_INFO(kver, SCST_KVER_STRING); MODULE_INFO(build_number, SCST_BUILD_NUMBER_STRING); MODULE_INFO(arch_type, SCST_ARCH_TYPE_STRING); diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index 92a13c2..bf4b31e 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -3987,7 +3987,7 @@ static ssize_t scst_dev_dif_mode_show(struct kobject *kobj, struct kobj_attribut if (dev->dev_dif_mode & SCST_DIF_MODE_TGT) ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, - "%s%s", ret == pos ? "" : "|", SCST_DIF_MODE_TGT_STR); + "%s", SCST_DIF_MODE_TGT_STR); if (dev->dev_dif_mode & SCST_DIF_MODE_SCST) ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, @@ -7446,15 +7446,15 @@ static ssize_t scst_version_show(struct kobject *kobj, ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST version: %s\n", SCST_VERSION_STRING); - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST kver: %s\n", - SCST_KVER_STRING); - ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST build date: %s\n", SCST_BUILD_DATE_STRING); ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST git commit sha1: %s\n", SCST_GIT_COMMIT_STRING); + ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST kver: %s\n", + SCST_KVER_STRING); + ret += scnprintf(buf + ret, SCST_SYSFS_BLOCK_SIZE - ret, "SCST build number: %s\n", SCST_BUILD_NUMBER_STRING); |
From: Gleb C. <lna...@ya...> - 2025-05-16 13:38:18
|
Commit: e81277e GitHub URL: https://github.com/SCST-project/scst/commit/e81277e8dcf125c231862ee9a9ca80203304b014 Author: Gleb Chesnokov Date: 2025-05-16T16:37:43+03:00 Log Message: ----------- scst_const.h, scst_priv.h: Fix multiple checkpatch warnings This patch does not change any functionality. Modified Paths: -------------- scst/include/scst_const.h | 79 +++--- scst/src/scst_priv.h | 198 +++++++-------- 2 files changed, 130 insertions(+), 147 deletions(-) =================================================================== diff --git a/scst/include/scst_const.h b/scst/include/scst_const.h index 36147ea..25520a9 100644 --- a/scst/include/scst_const.h +++ b/scst/include/scst_const.h @@ -46,46 +46,46 @@ * Changing it don't forget to change SCST_FIO_REV in scst_vdisk.c * and FIO_REV in usr/fileio/common.h as well. */ -#define SCST_VERSION(a, b, c, d) (((a) << 24) + ((b) << 16) + ((c) << 8) + d) -#define SCST_VERSION_CODE SCST_VERSION(3, 10, 0, 0) +#define SCST_VERSION(a, b, c, d) (((a) << 24) + ((b) << 16) + ((c) << 8) + (d)) +#define SCST_VERSION_CODE SCST_VERSION(3, 10, 0, 0) +#define SCST_VERSION_NAME "3.10.0-pre" #define SCST_VERSION_STRING_SUFFIX -#define SCST_VERSION_NAME "3.10.0-pre" -#define SCST_VERSION_STRING SCST_VERSION_NAME SCST_VERSION_STRING_SUFFIX +#define SCST_VERSION_STRING SCST_VERSION_NAME SCST_VERSION_STRING_SUFFIX #ifdef SCST_REVISION -#define SCST_REVISION_STRING SCST_STRINGIFY(SCST_REVISION) +#define SCST_REVISION_STRING SCST_STRINGIFY(SCST_REVISION) #else -#define SCST_REVISION_STRING "" +#define SCST_REVISION_STRING "" #endif -#define SCST_CONST_VERSION SCST_CONST_INTF_VER +#define SCST_CONST_VERSION SCST_CONST_INTF_VER /*** Shared constants between user and kernel spaces ***/ /* Max size of CDB */ -#define SCST_MAX_CDB_SIZE 16 +#define SCST_MAX_CDB_SIZE 16 /* Max size of long CDB */ -#define SCST_MAX_LONG_CDB_SIZE 65536 +#define SCST_MAX_LONG_CDB_SIZE 65536 /* Max size of various names */ -#define SCST_MAX_NAME 50 +#define SCST_MAX_NAME 50 /* Max size of external names, like initiator name */ -#define SCST_MAX_EXTERNAL_NAME 256 +#define SCST_MAX_EXTERNAL_NAME 256 /* Max LUN. 2 bits are used for addressing method. */ -#define SCST_MAX_LUN ((1 << (16-2)) - 1) +#define SCST_MAX_LUN ((1 << (16 - 2)) - 1) /* * Size of sense sufficient to carry standard sense data. * Warning! It's allocated on stack! */ -#define SCST_STANDARD_SENSE_LEN 18 +#define SCST_STANDARD_SENSE_LEN 18 /* Max size of sense */ -#define SCST_SENSE_BUFFERSIZE 252 +#define SCST_SENSE_BUFFERSIZE 252 /************************************************************* ** Allowed delivery statuses for cmd's delivery_status @@ -202,47 +202,47 @@ enum scst_cdb_flags { * !! Both timeouts must be the lowest bits to match * !! scst_generic_parse() expectations! */ - SCST_SMALL_TIMEOUT = 0x0001, - SCST_LONG_TIMEOUT = 0x0002, + SCST_SMALL_TIMEOUT = 0x0001, + SCST_LONG_TIMEOUT = 0x0002, #define SCST_BOTH_TIMEOUTS (SCST_SMALL_TIMEOUT | SCST_LONG_TIMEOUT) - SCST_TRANSFER_LEN_TYPE_FIXED = 0x0004, - SCST_UNKNOWN_LBA = 0x0008, - SCST_UNKNOWN_LENGTH = 0x0010, - SCST_INFO_VALID = 0x0020, + SCST_TRANSFER_LEN_TYPE_FIXED = 0x0004, + SCST_UNKNOWN_LBA = 0x0008, + SCST_UNKNOWN_LENGTH = 0x0010, + SCST_INFO_VALID = 0x0020, /* * Set if LBA not defined for this CDB. The "NOT" approach * was used to make sure that all dev handlers either init * cmd->lba or set this flag (for backward compatibility) */ - SCST_LBA_NOT_VALID = 0x0040, + SCST_LBA_NOT_VALID = 0x0040, - SCST_IMPLICIT_HQ = 0x0080, - SCST_SKIP_UA = 0x0100, - SCST_WRITE_MEDIUM = 0x0200, + SCST_IMPLICIT_HQ = 0x0080, + SCST_SKIP_UA = 0x0100, + SCST_WRITE_MEDIUM = 0x0200, /* * Set if a command should be executed by the SCST core instead * of by the device handler. */ - SCST_LOCAL_CMD = 0x0400, + SCST_LOCAL_CMD = 0x0400, /* * Set if CDB is fully locally handled by SCST. Dev handlers * parse() and dev_done() not called for such commands */ - SCST_FULLY_LOCAL_CMD = 0x0800, + SCST_FULLY_LOCAL_CMD = 0x0800, - SCST_REG_RESERVE_ALLOWED = 0x1000, - SCST_WRITE_EXCL_ALLOWED = 0x2000, - SCST_EXCL_ACCESS_ALLOWED = 0x4000, + SCST_REG_RESERVE_ALLOWED = 0x1000, + SCST_WRITE_EXCL_ALLOWED = 0x2000, + SCST_EXCL_ACCESS_ALLOWED = 0x4000, #ifdef CONFIG_SCST_TEST_IO_IN_SIRQ - SCST_TEST_IO_IN_SIRQ_ALLOWED = 0x8000, + SCST_TEST_IO_IN_SIRQ_ALLOWED = 0x8000, #endif - SCST_SERIALIZED = 0x10000, - SCST_STRICTLY_SERIALIZED = 0x20000|SCST_SERIALIZED, - SCST_CAN_GEN_3PARTY_COMMANDS = 0x40000, - SCST_DESCRIPTORS_BASED = 0x80000, - SCST_SCSI_ATOMIC = 0x100000, + SCST_SERIALIZED = 0x10000, + SCST_STRICTLY_SERIALIZED = 0x20000 | SCST_SERIALIZED, + SCST_CAN_GEN_3PARTY_COMMANDS = 0x40000, + SCST_DESCRIPTORS_BASED = 0x80000, + SCST_SCSI_ATOMIC = 0x100000, }; /************************************************************* @@ -257,8 +257,7 @@ typedef enum scst_data_direction { SCST_DATA_NONE = 4, } scst_data_direction; -#define SCST_DATA_DIR_MAX (SCST_DATA_NONE+1) - +#define SCST_DATA_DIR_MAX (SCST_DATA_NONE + 1) /************************************************************* ** Default suffix for targets with NULL names @@ -272,12 +271,12 @@ typedef enum scst_data_direction { static inline int scst_sense_valid(const uint8_t *sense) { - return (sense != NULL) && ((sense[0] & 0x70) == 0x70); + return sense && ((sense[0] & 0x70) == 0x70); } static inline int scst_no_sense(const uint8_t *sense) { - return (sense != NULL) && (sense[2] == 0); + return sense && (sense[2] == 0); } static inline int scst_sense_response_code(const uint8_t *sense) @@ -359,7 +358,6 @@ static inline int scst_sense_response_code(const uint8_t *sense) /* MISCOMPARE is 0xe */ #define scst_sense_miscompare_error MISCOMPARE, 0x1D, 0 - /************************************************************* * SCSI opcodes not listed anywhere else *************************************************************/ @@ -718,5 +716,4 @@ enum { /* Size of the lock value block in the DLM PR lockspace */ #define PR_DLM_LVB_LEN 256 - #endif /* __SCST_CONST_H */ diff --git a/scst/src/scst_priv.h b/scst/src/scst_priv.h index 8854564..98acdc7 100644 --- a/scst/src/scst_priv.h +++ b/scst/src/scst_priv.h @@ -55,7 +55,7 @@ extern unsigned long scst_trace_flag; #define TRACE_RETRY(args...) TRACE_DBG_FLAG(TRACE_RTRY, args) #define TRACE_SN(args...) TRACE_DBG_FLAG(TRACE_SCSI_SERIALIZING, args) -#define TRACE_SN_SPECIAL(args...) TRACE_DBG_FLAG(TRACE_SCSI_SERIALIZING|TRACE_SPECIAL, args) +#define TRACE_SN_SPECIAL(args...) TRACE_DBG_FLAG(TRACE_SCSI_SERIALIZING | TRACE_SPECIAL, args) #else /* CONFIG_SCST_DEBUG */ @@ -90,7 +90,7 @@ static inline void scst_set_cmd_state(struct scst_cmd *cmd, **/ #define SCST_CMD_STATE_RES_CONT_NEXT SCST_EXEC_COMPLETED #define SCST_CMD_STATE_RES_CONT_SAME SCST_EXEC_NOT_COMPLETED -#define SCST_CMD_STATE_RES_NEED_THREAD (SCST_EXEC_NOT_COMPLETED+1) +#define SCST_CMD_STATE_RES_NEED_THREAD (SCST_EXEC_NOT_COMPLETED + 1) /** ** Maximum count of uncompleted commands that an initiator could @@ -116,7 +116,7 @@ static inline void scst_set_cmd_state(struct scst_cmd *cmd, /* Used to prevent overflow of int cmd->bufflen. Assumes max blocksize is 4K */ #define SCST_MAX_VALID_BUFFLEN_MASK (~((1 << (32 - 12)) - 1)) -#define SCST_MAX_EACH_INTERNAL_IO_SIZE (128*1024) +#define SCST_MAX_EACH_INTERNAL_IO_SIZE (128 * 1024) #define SCST_MAX_IN_FLIGHT_INTERNAL_COMMANDS 32 /* @@ -231,7 +231,7 @@ static inline bool scst_set_io_context(struct scst_cmd *cmd, #else bool res; - EXTRACHECKS_BUG_ON(old == NULL); + EXTRACHECKS_BUG_ON(!old); if (cmd->cmd_threads == &scst_main_cmd_threads && cmd->tgt_dev->async_io_context) { @@ -243,9 +243,9 @@ static inline bool scst_set_io_context(struct scst_cmd *cmd, *old = current->io_context; current->io_context = cmd->tgt_dev->async_io_context; res = true; - TRACE_DBG("io_context %p (tgt_dev %p)", current->io_context, - cmd->tgt_dev); - EXTRACHECKS_BUG_ON(current->io_context == NULL); + TRACE_DBG("io_context %p (tgt_dev %p)", + current->io_context, cmd->tgt_dev); + EXTRACHECKS_BUG_ON(!current->io_context); } else { res = false; } @@ -254,23 +254,20 @@ static inline bool scst_set_io_context(struct scst_cmd *cmd, #endif } -static inline void scst_reset_io_context(struct scst_tgt_dev *tgt_dev, - struct io_context *old) +static inline void scst_reset_io_context(struct scst_tgt_dev *tgt_dev, struct io_context *old) { current->io_context = old; TRACE_DBG("io_context %p reset", current->io_context); - return; } /* * Converts string presentation of threads pool type to enum. * Returns SCST_THREADS_POOL_TYPE_INVALID if the string is invalid. */ -extern enum scst_dev_type_threads_pool_type scst_parse_threads_pool_type( - const char *p, int len); +extern enum scst_dev_type_threads_pool_type scst_parse_threads_pool_type(const char *p, int len); -extern int scst_add_threads(struct scst_cmd_threads *cmd_threads, - struct scst_device *dev, struct scst_tgt_dev *tgt_dev, int num); +extern int scst_add_threads(struct scst_cmd_threads *cmd_threads, struct scst_device *dev, + struct scst_tgt_dev *tgt_dev, int num); extern void scst_del_threads(struct scst_cmd_threads *cmd_threads, int num); extern int scst_create_dev_threads(struct scst_device *dev); @@ -285,45 +282,40 @@ char *scst_get_cmd_state_name(char *name, int len, unsigned int state); char *scst_get_mcmd_state_name(char *name, int len, unsigned int state); char *scst_get_tm_fn_name(char *name, int len, unsigned int fn); -extern struct scst_cmd *__scst_check_deferred_commands_locked( - struct scst_order_data *order_data, bool return_first); -extern struct scst_cmd *__scst_check_deferred_commands( - struct scst_order_data *order_data, bool return_first); +extern struct scst_cmd *__scst_check_deferred_commands_locked(struct scst_order_data *order_data, + bool return_first); +extern struct scst_cmd *__scst_check_deferred_commands(struct scst_order_data *order_data, + bool return_first); /* Used to save the function call on the fast path */ -static inline struct scst_cmd *scst_check_deferred_commands( - struct scst_order_data *order_data, bool return_first) +static inline struct scst_cmd *scst_check_deferred_commands(struct scst_order_data *order_data, + bool return_first) { if (order_data->def_cmd_count == 0) return NULL; - else - return __scst_check_deferred_commands(order_data, return_first); + + return __scst_check_deferred_commands(order_data, return_first); } -static inline void scst_make_deferred_commands_active( - struct scst_order_data *order_data) +static inline void scst_make_deferred_commands_active(struct scst_order_data *order_data) { scst_check_deferred_commands(order_data, false); - return; } /* * sn_lock supposed to be locked and IRQs off. Might drop then reacquire * it inside. */ -static inline void scst_make_deferred_commands_active_locked( - struct scst_order_data *order_data) +static inline void scst_make_deferred_commands_active_locked(struct scst_order_data *order_data) { if (order_data->def_cmd_count != 0) __scst_check_deferred_commands_locked(order_data, false); - return; } bool scst_inc_expected_sn(const struct scst_cmd *cmd); int scst_check_hq_cmd(struct scst_cmd *cmd); -void scst_unblock_deferred(struct scst_order_data *order_data, - struct scst_cmd *cmd_sn); +void scst_unblock_deferred(struct scst_order_data *order_data, struct scst_cmd *cmd_sn); void scst_on_hq_cmd_response(struct scst_cmd *cmd); void scst_xmit_process_aborted_cmd(struct scst_cmd *cmd); @@ -351,8 +343,8 @@ int scst_alloc_device(gfp_t gfp_mask, int nodeid, struct scst_device **out_dev); void scst_free_device(struct scst_device *dev); bool scst_device_is_exported(struct scst_device *dev); -int scst_alloc_add_acg(struct scst_tgt *tgt, const char *acg_name, - bool tgt_acg, struct scst_acg **out_acg); +int scst_alloc_add_acg(struct scst_tgt *tgt, const char *acg_name, bool tgt_acg, + struct scst_acg **out_acg); int scst_del_free_acg(struct scst_acg *acg, bool close_sessions); void scst_get_acg(struct scst_acg *acg); void scst_put_acg(struct scst_acg *acg); @@ -373,11 +365,9 @@ void scst_nexus_loss(struct scst_tgt_dev *tgt_dev, bool queue_UA); #define SCST_ADD_LUN_CM 4 #define SCST_REPL_LUN_GEN_UA 8 -int scst_acg_add_lun(struct scst_acg *acg, struct kobject *parent, - struct scst_device *dev, uint64_t lun, unsigned int flags, - struct scst_acg_dev **out_acg_dev); -int scst_acg_del_lun(struct scst_acg *acg, uint64_t lun, - bool gen_report_luns_changed); +int scst_acg_add_lun(struct scst_acg *acg, struct kobject *parent, struct scst_device *dev, + uint64_t lun, unsigned int flags, struct scst_acg_dev **out_acg_dev); +int scst_acg_del_lun(struct scst_acg *acg, uint64_t lun, bool gen_report_luns_changed); int scst_acg_repl_lun(struct scst_acg *acg, struct kobject *parent, struct scst_device *dev, uint64_t lun, unsigned int flags); @@ -395,17 +385,15 @@ static inline bool scst_acg_sess_is_empty(struct scst_acg *acg) int scst_prepare_request_sense(struct scst_cmd *orig_cmd); int scst_finish_internal_cmd(struct scst_cmd *cmd); -int scst_set_cmd_error_sense(struct scst_cmd *cmd, uint8_t *sense, - unsigned int len); +int scst_set_cmd_error_sense(struct scst_cmd *cmd, uint8_t *sense, unsigned int len); void scst_store_sense(struct scst_cmd *cmd); int scst_process_check_condition(struct scst_cmd *cmd); -int scst_assign_dev_handler(struct scst_device *dev, - struct scst_dev_type *handler); +int scst_assign_dev_handler(struct scst_device *dev, struct scst_dev_type *handler); struct scst_session *scst_alloc_session(struct scst_tgt *tgt, gfp_t gfp_mask, - const char *initiator_name); + const char *initiator_name); void scst_free_session(struct scst_session *sess); void scst_free_session_callback(struct scst_session *sess); @@ -430,7 +418,9 @@ void scst_free_mgmt_cmd(struct scst_mgmt_cmd *mcmd); void scst_done_cmd_mgmt(struct scst_cmd *cmd); void scst_finish_cmd_mgmt(struct scst_cmd *cmd); -static inline void scst_devt_cleanup(struct scst_dev_type *devt) { } +static inline void scst_devt_cleanup(struct scst_dev_type *devt) +{ +} void scst_tg_init(void); void scst_tg_cleanup(void); @@ -456,15 +446,13 @@ void scst_tgt_sysfs_put(struct scst_tgt *tgt); int scst_dg_dev_sysfs_add(struct scst_dev_group *dg, struct scst_dg_dev *dgdev); void scst_dg_dev_sysfs_del(struct scst_dev_group *dg, struct scst_dg_dev *dgdev); -int scst_tg_sysfs_add(struct scst_dev_group *dg, - struct scst_target_group *tg); +int scst_tg_sysfs_add(struct scst_dev_group *dg, struct scst_target_group *tg); void scst_tg_sysfs_del(struct scst_target_group *tg); int scst_tg_tgt_sysfs_add(struct scst_target_group *tg, struct scst_tg_tgt *tg_tgt); void scst_tg_tgt_sysfs_del(struct scst_target_group *tg, struct scst_tg_tgt *tg_tgt); - extern const struct sysfs_ops scst_sysfs_ops; int scst_sysfs_init(void); void scst_sysfs_cleanup(void); @@ -487,16 +475,13 @@ int scst_tgt_dev_sysfs_create(struct scst_tgt_dev *tgt_dev); void scst_tgt_dev_sysfs_del(struct scst_tgt_dev *tgt_dev); int scst_devt_dev_sysfs_create(struct scst_device *dev); void scst_devt_dev_sysfs_del(struct scst_device *dev); -int scst_acg_sysfs_create(struct scst_tgt *tgt, - struct scst_acg *acg); +int scst_acg_sysfs_create(struct scst_tgt *tgt, struct scst_acg *acg); void scst_acg_sysfs_del(struct scst_acg *acg); -int scst_acg_dev_sysfs_create(struct scst_acg_dev *acg_dev, - struct kobject *parent); +int scst_acg_dev_sysfs_create(struct scst_acg_dev *acg_dev, struct kobject *parent); void scst_acg_dev_sysfs_del(struct scst_acg_dev *acg_dev); int scst_acn_sysfs_create(struct scst_acn *acn); void scst_acn_sysfs_del(struct scst_acn *acn); - /* * Check SPC-2 reservation state. * Must not be called from atomic context. @@ -506,7 +491,6 @@ static inline bool scst_dev_reserved(struct scst_device *dev) return dev->cl_ops->reserved(dev); } - /* Protect SPC-2 reservation state against concurrent modifications. */ static inline void scst_res_lock(struct scst_device *dev, struct scst_lksb *pr_lksb) @@ -529,7 +513,7 @@ static inline void scst_res_unlock(struct scst_device *dev, static inline bool scst_is_reservation_holder(struct scst_device *dev, struct scst_session *sess) { - EXTRACHECKS_BUG_ON(sess == NULL); + EXTRACHECKS_BUG_ON(!sess); return dev->cl_ops->is_rsv_holder(dev, sess); } @@ -540,7 +524,7 @@ static inline bool scst_is_reservation_holder(struct scst_device *dev, static inline bool scst_is_not_reservation_holder(struct scst_device *dev, struct scst_session *sess) { - EXTRACHECKS_BUG_ON(sess == NULL); + EXTRACHECKS_BUG_ON(!sess); return dev->cl_ops->is_not_rsv_holder(dev, sess); } @@ -548,7 +532,7 @@ static inline void scst_reserve_dev(struct scst_device *dev, struct scst_session *sess) { lockdep_assert_held(&dev->dev_lock); - EXTRACHECKS_BUG_ON(sess == NULL); + EXTRACHECKS_BUG_ON(!sess); dev->cl_ops->reserve(dev, sess); } @@ -560,40 +544,37 @@ static inline void scst_clear_dev_reservation(struct scst_device *dev) void scst_tgt_dev_del_free_UA(struct scst_tgt_dev *tgt_dev, struct scst_tgt_dev_UA *ua); -void scst_dev_check_set_UA(struct scst_device *dev, - struct scst_cmd *exclude, const uint8_t *sense, int sense_len); -void scst_dev_check_set_local_UA(struct scst_device *dev, - struct scst_cmd *exclude, const uint8_t *sense, int sense_len); +void scst_dev_check_set_UA(struct scst_device *dev, struct scst_cmd *exclude, + const uint8_t *sense, int sense_len); +void scst_dev_check_set_local_UA(struct scst_device *dev, struct scst_cmd *exclude, + const uint8_t *sense, int sense_len); #define SCST_SET_UA_FLAG_AT_HEAD 1 #define SCST_SET_UA_FLAG_GLOBAL 2 -void scst_check_set_UA(struct scst_tgt_dev *tgt_dev, - const uint8_t *sense, int sense_len, int flags); +void scst_check_set_UA(struct scst_tgt_dev *tgt_dev, const uint8_t *sense, int sense_len, + int flags); int scst_set_pending_UA(struct scst_cmd *cmd, uint8_t *buf, int *size); void scst_report_luns_changed(struct scst_acg *acg); -void scst_abort_cmd(struct scst_cmd *cmd, struct scst_mgmt_cmd *mcmd, - bool other_ini, bool call_dev_task_mgmt_fn); -void scst_process_reset(struct scst_device *dev, - struct scst_session *originator, struct scst_cmd *exclude_cmd, - struct scst_mgmt_cmd *mcmd, bool setUA); -void __scst_unblock_aborted_cmds(const struct scst_tgt *tgt, - const struct scst_session *sess, const struct scst_device *device); -void scst_unblock_aborted_cmds(const struct scst_tgt *tgt, - const struct scst_session *sess, const struct scst_device *device); +void scst_abort_cmd(struct scst_cmd *cmd, struct scst_mgmt_cmd *mcmd, bool other_ini, + bool call_dev_task_mgmt_fn); +void scst_process_reset(struct scst_device *dev, struct scst_session *originator, + struct scst_cmd *exclude_cmd, struct scst_mgmt_cmd *mcmd, bool setUA); +void __scst_unblock_aborted_cmds(const struct scst_tgt *tgt, const struct scst_session *sess, + const struct scst_device *device); +void scst_unblock_aborted_cmds(const struct scst_tgt *tgt, const struct scst_session *sess, + const struct scst_device *device); void scst_clear_aca(struct scst_tgt_dev *tgt_dev, bool other_ini); bool scst_is_ua_global(const uint8_t *sense, int len); void scst_requeue_ua(struct scst_cmd *cmd, const uint8_t *buf, int size); -struct scst_aen *scst_alloc_aen(struct scst_session *sess, - uint64_t unpacked_lun); +struct scst_aen *scst_alloc_aen(struct scst_session *sess, uint64_t unpacked_lun); void scst_free_aen(struct scst_aen *aen); -void scst_gen_aen_or_ua(struct scst_tgt_dev *tgt_dev, - int key, int asc, int ascq); +void scst_gen_aen_or_ua(struct scst_tgt_dev *tgt_dev, int key, int asc, int ascq); /* * Some notes on devices "blocking". Blocking means that no @@ -692,24 +673,25 @@ static inline void scst_sess_put(struct scst_session *sess) percpu_ref_put(&sess->refcnt); } -struct scst_cmd *scst_alloc_cmd(const uint8_t *cdb, - unsigned int cdb_len, gfp_t gfp_mask); -int scst_pre_init_cmd(struct scst_cmd *cmd, const uint8_t *cdb, - unsigned int cdb_len, gfp_t gfp_mask); +struct scst_cmd *scst_alloc_cmd(const uint8_t *cdb, unsigned int cdb_len, gfp_t gfp_mask); +int scst_pre_init_cmd(struct scst_cmd *cmd, const uint8_t *cdb, unsigned int cdb_len, + gfp_t gfp_mask); void scst_free_cmd(struct scst_cmd *cmd); static inline void __scst_cmd_get(struct scst_cmd *cmd) { atomic_inc(&cmd->cmd_ref); smp_mb__after_atomic_inc(); + TRACE_DBG("Incrementing cmd %p ref (new value %d)", - cmd, atomic_read(&cmd->cmd_ref)); + cmd, atomic_read(&cmd->cmd_ref)); } static inline void __scst_cmd_put(struct scst_cmd *cmd) { TRACE_DBG("Decrementing cmd %p ref (new value %d)", - cmd, atomic_read(&cmd->cmd_ref)-1); + cmd, atomic_read(&cmd->cmd_ref) - 1); + if (atomic_dec_and_test(&cmd->cmd_ref)) scst_free_cmd(cmd); } @@ -729,19 +711,19 @@ void scst_vfs_unlink_and_put(struct path *path); int scst_copy_file(const char *src, const char *dest); -struct scst_cmd *__scst_create_prepare_internal_cmd(const uint8_t *cdb, - unsigned int cdb_len, enum scst_cmd_queue_type queue_type, - struct scst_tgt_dev *tgt_dev, gfp_t gfp_mask, bool fantom); +struct scst_cmd *__scst_create_prepare_internal_cmd(const uint8_t *cdb, unsigned int cdb_len, + enum scst_cmd_queue_type queue_type, + struct scst_tgt_dev *tgt_dev, gfp_t gfp_mask, + bool fantom); -static inline bool scst_lba1_inside_lba2(int64_t lba1, - int64_t lba2, int64_t lba2_blocks) +static inline bool scst_lba1_inside_lba2(int64_t lba1, int64_t lba2, int64_t lba2_blocks) { bool res; - TRACE_DBG("lba1 %lld, lba2 %lld, lba2_blocks %lld", (long long)lba1, - (long long)lba2, (long long)lba2_blocks); + TRACE_DBG("lba1 %lld, lba2 %lld, lba2_blocks %lld", + (long long)lba1, (long long)lba2, (long long)lba2_blocks); - if ((lba1 >= lba2) && (lba1 < (lba2 + lba2_blocks))) + if (lba1 >= lba2 && (lba1 < (lba2 + lba2_blocks))) res = true; else res = false; @@ -750,17 +732,14 @@ static inline bool scst_lba1_inside_lba2(int64_t lba1, return res; } - void scst_cm_update_dev(struct scst_device *dev); int scst_cm_on_dev_register(struct scst_device *dev); void scst_cm_on_dev_unregister(struct scst_device *dev); int scst_cm_on_add_acg(struct scst_acg *acg); void scst_cm_on_del_acg(struct scst_acg *acg); -int scst_cm_on_add_lun(struct scst_acg_dev *acg_dev, uint64_t lun, - unsigned int *flags); -bool scst_cm_on_del_lun(struct scst_acg_dev *acg_dev, - bool gen_report_luns_changed); +int scst_cm_on_add_lun(struct scst_acg_dev *acg_dev, uint64_t lun, unsigned int *flags); +bool scst_cm_on_del_lun(struct scst_acg_dev *acg_dev, bool gen_report_luns_changed); int scst_cm_parse_descriptors(struct scst_cmd *cmd); void scst_cm_free_descriptors(struct scst_cmd *cmd); @@ -779,23 +758,30 @@ bool scst_cm_ec_cmd_overlap(struct scst_cmd *ec_cmd, struct scst_cmd *cmd); int scst_cm_init(void); void scst_cm_exit(void); - #ifdef CONFIG_SCST_DEBUG_TM extern void tm_dbg_check_released_cmds(void); extern int tm_dbg_check_cmd(struct scst_cmd *cmd); extern void tm_dbg_release_cmd(struct scst_cmd *cmd); -extern void tm_dbg_task_mgmt(struct scst_device *dev, const char *fn, - int force); +extern void tm_dbg_task_mgmt(struct scst_device *dev, const char *fn, int force); extern int tm_dbg_is_release(void); #else -static inline void tm_dbg_check_released_cmds(void) {} +static inline void tm_dbg_check_released_cmds(void) +{ +} + static inline int tm_dbg_check_cmd(struct scst_cmd *cmd) { return 0; } -static inline void tm_dbg_release_cmd(struct scst_cmd *cmd) {} -static inline void tm_dbg_task_mgmt(struct scst_device *dev, const char *fn, - int force) {} + +static inline void tm_dbg_release_cmd(struct scst_cmd *cmd) +{ +} + +static inline void tm_dbg_task_mgmt(struct scst_device *dev, const char *fn, int force) +{ +} + static inline int tm_dbg_is_release(void) { return 0; @@ -805,24 +791,24 @@ static inline int tm_dbg_is_release(void) #ifdef CONFIG_SCST_DEBUG_SN void scst_check_debug_sn(struct scst_cmd *cmd); #else -static inline void scst_check_debug_sn(struct scst_cmd *cmd) {} +static inline void scst_check_debug_sn(struct scst_cmd *cmd) +{ +} #endif static inline int scst_sn_before(uint32_t seq1, uint32_t seq2) { - return (int32_t)(seq1-seq2) < 0; + return (int32_t)(seq1 - seq2) < 0; } int gen_relative_target_port_id(uint16_t *id); -bool scst_is_relative_target_port_id_unique(uint16_t id, - const struct scst_tgt *t); +bool scst_is_relative_target_port_id_unique(uint16_t id, const struct scst_tgt *t); int scst_event_init(void); void scst_event_exit(void); int scst_event_queue_lun_not_found(const struct scst_cmd *cmd); -int scst_event_queue_negative_luns_inquiry(const struct scst_tgt *tgt, - const char *initiator_name); +int scst_event_queue_negative_luns_inquiry(const struct scst_tgt *tgt, const char *initiator_name); int scst_event_queue_ext_blocking_done(struct scst_device *dev, void *data, int len); int scst_event_queue_tm_fn_received(struct scst_mgmt_cmd *mcmd); int scst_event_queue_reg_vdev(const char *dev_name); |
From: Gleb C. <lna...@ya...> - 2025-05-16 13:38:08
|
Commit: 949f5ef GitHub URL: https://github.com/SCST-project/scst/commit/949f5ef99c5e63334ef95d2a253363eca0666a8b Author: Gleb Chesnokov Date: 2025-05-16T16:37:43+03:00 Log Message: ----------- scst_main: Fix multiple checkpatch warnings This patch does not change any functionality. Modified Paths: -------------- scst/src/scst_main.c | 481 +++++++-------- 1 file changed, 209 insertions(+), 272 deletions(-) =================================================================== diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 4d494ef..81378c4 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -165,30 +165,28 @@ spinlock_t scst_measure_latency_lock; atomic_t scst_measure_latency; int scst_threads; -module_param_named(scst_threads, scst_threads, int, S_IRUGO); +module_param_named(scst_threads, scst_threads, int, 0444); MODULE_PARM_DESC(scst_threads, "SCSI target threads count"); static unsigned int scst_max_cmd_mem; -module_param_named(scst_max_cmd_mem, scst_max_cmd_mem, int, S_IRUGO); -MODULE_PARM_DESC(scst_max_cmd_mem, "Maximum memory allowed to be consumed by " - "all SCSI commands of all devices at any given time in MB"); +module_param_named(scst_max_cmd_mem, scst_max_cmd_mem, int, 0444); +MODULE_PARM_DESC(scst_max_cmd_mem, + "Maximum memory allowed to be consumed by all SCSI commands of all devices at any given time in MB"); unsigned int scst_max_dev_cmd_mem; -module_param_named(scst_max_dev_cmd_mem, scst_max_dev_cmd_mem, int, S_IRUGO); -MODULE_PARM_DESC(scst_max_dev_cmd_mem, "Maximum memory allowed to be consumed " - "by all SCSI commands of a device at any given time in MB"); +module_param_named(scst_max_dev_cmd_mem, scst_max_dev_cmd_mem, int, 0444); +MODULE_PARM_DESC(scst_max_dev_cmd_mem, + "Maximum memory allowed to be consumed by all SCSI commands of a device at any given time in MB"); bool scst_forcibly_close_sessions; -module_param_named(forcibly_close_sessions, scst_forcibly_close_sessions, bool, - S_IWUSR | S_IRUGO); +module_param_named(forcibly_close_sessions, scst_forcibly_close_sessions, bool, 0644); MODULE_PARM_DESC(forcibly_close_sessions, -"If enabled, close the sessions associated with an access control group (ACG)" -" when an ACG is deleted via sysfs instead of returning -EBUSY. (default: false)"); + "If enabled, close the sessions associated with an access control group (ACG) when an ACG is deleted via sysfs instead of returning -EBUSY. (default: false)"); bool scst_auto_cm_assignment = true; -module_param_named(auto_cm_assignment, scst_auto_cm_assignment, bool, - S_IWUSR | S_IRUGO); -MODULE_PARM_DESC(auto_cm_assignment, "Enables the copy managers auto registration. (default: true)"); +module_param_named(auto_cm_assignment, scst_auto_cm_assignment, bool, 0644); +MODULE_PARM_DESC(auto_cm_assignment, + "Enables the copy managers auto registration. (default: true)"); struct scst_dev_type scst_null_devtype = { .name = "none", @@ -211,8 +209,7 @@ static void __scst_resume_activity(void); * Target drivers supposed to behave sanely and not call register() * and unregister() randomly simultaneously. */ -int __scst_register_target_template(struct scst_tgt_template *vtt, - const char *version) +int __scst_register_target_template(struct scst_tgt_template *vtt, const char *version) { int res = 0; struct scst_tgt_template *t; @@ -228,48 +225,43 @@ int __scst_register_target_template(struct scst_tgt_template *vtt, } if (!vtt->release) { - PRINT_ERROR("Target driver %s must have " - "release() method.", vtt->name); + PRINT_ERROR("Target driver %s must have release() method.", + vtt->name); res = -EINVAL; goto out; } if (!vtt->xmit_response) { - PRINT_ERROR("Target driver %s must have " - "xmit_response() method.", vtt->name); + PRINT_ERROR("Target driver %s must have xmit_response() method.", + vtt->name); res = -EINVAL; goto out; } - if (vtt->get_initiator_port_transport_id == NULL) - PRINT_WARNING("Target driver %s doesn't support Persistent " - "Reservations", vtt->name); + if (!vtt->get_initiator_port_transport_id) + PRINT_WARNING("Target driver %s doesn't support Persistent Reservations", + vtt->name); if (vtt->threads_num < 0) { - PRINT_ERROR("Wrong threads_num value %d for " - "target \"%s\"", vtt->threads_num, - vtt->name); + PRINT_ERROR("Wrong threads_num value %d for target \"%s\"", + vtt->threads_num, vtt->name); res = -EINVAL; goto out; } if ((!vtt->enable_target || !vtt->is_target_enabled) && !vtt->enabled_attr_not_needed) - PRINT_WARNING("Target driver %s doesn't have enable_target() " - "and/or is_target_enabled() method(s). This is unsafe " - "and can lead that initiators connected on the " - "initialization time can see an unexpected set of " - "devices or no devices at all!", vtt->name); - - if (((vtt->add_target != NULL) && (vtt->del_target == NULL)) || - ((vtt->add_target == NULL) && (vtt->del_target != NULL))) { - PRINT_ERROR("Target driver %s must either define both " - "add_target() and del_target(), or none.", vtt->name); + PRINT_WARNING("Target driver %s doesn't have enable_target() and/or is_target_enabled() method(s). This is unsafe and can lead that initiators connected on the initialization time can see an unexpected set of devices or no devices at all!", + vtt->name); + + if ((vtt->add_target && !vtt->del_target) || (!vtt->add_target && vtt->del_target)) { + PRINT_ERROR("Target driver %s must either define both add_target() and del_target(), or none.", + vtt->name); res = -EINVAL; goto out; } - if (vtt->rdy_to_xfer == NULL) + if (!vtt->rdy_to_xfer) vtt->rdy_to_xfer_atomic = 1; res = mutex_lock_interruptible(&scst_mutex); @@ -278,7 +270,7 @@ int __scst_register_target_template(struct scst_tgt_template *vtt, list_for_each_entry(t, &scst_template_list, scst_template_list_entry) { if (strcmp(t->name, vtt->name) == 0) { PRINT_ERROR("Target driver %s already registered", - vtt->name); + vtt->name); goto out_unlock; } } @@ -314,8 +306,8 @@ static int scst_check_non_gpl_target_template(struct scst_tgt_template *vtt) if (vtt->task_mgmt_affected_cmds_done || vtt->threads_num || vtt->on_hw_pending_cmd_timeout) { - PRINT_ERROR("Not allowed functionality in non-GPL version for " - "target template %s", vtt->name); + PRINT_ERROR("Not allowed functionality in non-GPL version for target template %s", + vtt->name); res = -EPERM; goto out; } @@ -341,8 +333,7 @@ out: * * Note: *vtt must be static! */ -int __scst_register_target_template_non_gpl(struct scst_tgt_template *vtt, - const char *version) +int __scst_register_target_template_non_gpl(struct scst_tgt_template *vtt, const char *version) { int res; @@ -430,8 +421,7 @@ EXPORT_SYMBOL(scst_unregister_target_template); * Registers a target for template vtt and returns new target structure on * success or NULL otherwise. */ -struct scst_tgt *scst_register_target(struct scst_tgt_template *vtt, - const char *target_name) +struct scst_tgt *scst_register_target(struct scst_tgt_template *vtt, const char *target_name) { struct scst_tgt *tgt, *t; int rc = 0; @@ -445,7 +435,7 @@ struct scst_tgt *scst_register_target(struct scst_tgt_template *vtt, goto out; tgt->tgt_name = kstrdup(target_name, GFP_KERNEL); - if (tgt->tgt_name == NULL) { + if (!tgt->tgt_name) { PRINT_ERROR("Allocation of tgt name %s failed", target_name); rc = -ENOMEM; @@ -479,7 +469,7 @@ struct scst_tgt *scst_register_target(struct scst_tgt_template *vtt, mutex_unlock(&scst_mutex); PRINT_INFO("Target %s for template %s registered successfully", - tgt->tgt_name, vtt->name); + tgt->tgt_name, vtt->name); TRACE_DBG("tgt %p", tgt); @@ -526,9 +516,9 @@ void scst_unregister_target(struct scst_tgt *tgt) */ scst_tgt_sysfs_del(tgt); - TRACE_DBG("%s", "Calling target driver's release()"); + TRACE_DBG("Calling target driver's release()"); tgt->tgtt->release(tgt); - TRACE_DBG("%s", "Target driver's release() returned"); + TRACE_DBG("Target driver's release() returned"); /* * Testing tgt->sysfs_sess_list below without holding scst_mutex @@ -542,9 +532,8 @@ void scst_unregister_target(struct scst_tgt *tgt) * waits until scst_free_session() has finished accessing the 'tgt' * object. */ - TRACE_DBG("%s", "Waiting for sessions shutdown"); - while (!wait_event_timeout(tgt->unreg_waitQ, - list_empty(&tgt->sysfs_sess_list), 60 * HZ)) { + TRACE_DBG("Waiting for sessions shutdown"); + while (!wait_event_timeout(tgt->unreg_waitQ, list_empty(&tgt->sysfs_sess_list), 60 * HZ)) { struct scst_session *sess; mutex_lock(&scst_mutex); @@ -556,7 +545,7 @@ void scst_unregister_target(struct scst_tgt *tgt) } mutex_unlock(&scst_mutex); } - TRACE_DBG("%s", "wait_event() returned"); + TRACE_DBG("wait_event() returned"); res = scst_suspend_activity(SCST_SUSPEND_TIMEOUT_UNLIMITED); WARN_ON_ONCE(res); @@ -573,10 +562,8 @@ void scst_unregister_target(struct scst_tgt *tgt) scst_del_free_acg(tgt->default_acg, false); - list_for_each_entry_safe(acg, acg_tmp, &tgt->tgt_acg_list, - acg_list_entry) { + list_for_each_entry_safe(acg, acg_tmp, &tgt->tgt_acg_list, acg_list_entry) scst_del_free_acg(acg, false); - } mutex_unlock(&scst_mutex); scst_resume_activity(); @@ -584,14 +571,13 @@ void scst_unregister_target(struct scst_tgt *tgt) scst_tgt_sysfs_put(tgt); PRINT_INFO("Target %s for template %s unregistered successfully", - tgt->tgt_name, vtt->name); + tgt->tgt_name, vtt->name); scst_free_tgt(tgt); TRACE_DBG("Unregistering tgt %p finished", tgt); TRACE_EXIT(); - return; } EXPORT_SYMBOL(scst_unregister_target); @@ -665,42 +651,36 @@ void scst_trace_cmds(scst_show_fn show, void *arg) sess_cmd_list_entry) { tgt_dev = cmd->tgt_dev; scst_dump_cdb(cdb, sizeof(cdb), cmd); - scst_get_cmd_state_name(state_name, - sizeof(state_name), - cmd->state); - show(arg, "cmd %p: state %s; op %s; " - "proc time %ld sec; tgtt %s; " - "tgt %s; session %s; grp %s; " - "LUN %lld; ini %s; cdb %s\n", - cmd, state_name, - scst_get_opcode_name(cmd), - (long)(jiffies - cmd->start_time) / HZ, - t->name, tgt->tgt_name, sess->sess_name, - tgt_dev ? (tgt_dev->acg_dev->acg->acg_name ? - : "(default)") : "?", - cmd->lun, sess->initiator_name, cdb); + scst_get_cmd_state_name(state_name, sizeof(state_name), + cmd->state); + show(arg, + "cmd %p: state %s; op %s; proc time %ld sec; tgtt %s; tgt %s; session %s; grp %s; LUN %lld; ini %s; cdb %s\n", + cmd, state_name, scst_get_opcode_name(cmd), + (long)(jiffies - cmd->start_time) / HZ, + t->name, tgt->tgt_name, sess->sess_name, + tgt_dev ? (tgt_dev->acg_dev->acg->acg_name ?: "(default)") : "?", + cmd->lun, sess->initiator_name, cdb); } spin_unlock_irq(&sess->sess_list_lock); } } } mutex_unlock(&scst_mutex); - return; } static const char *const scst_tm_fn_name[] = { - [SCST_ABORT_TASK] = "ABORT_TASK", - [SCST_ABORT_TASK_SET] = "ABORT_TASK_SET", - [SCST_CLEAR_ACA] = "CLEAR_ACA", - [SCST_CLEAR_TASK_SET] = "CLEAR_TASK_SET", - [SCST_LUN_RESET] = "LUN_RESET", - [SCST_TARGET_RESET] = "TARGET_RESET", - [SCST_NEXUS_LOSS_SESS] = "NEXUS_LOSS_SESS", - [SCST_ABORT_ALL_TASKS_SESS] = "ABORT_ALL_TASKS_SESS", - [SCST_NEXUS_LOSS] = "NEXUS_LOSS", - [SCST_ABORT_ALL_TASKS] = "ABORT_ALL_TASKS", - [SCST_UNREG_SESS_TM] = "UNREG_SESS_TM", - [SCST_PR_ABORT_ALL] = "PR_ABORT_ALL", + [SCST_ABORT_TASK] = "ABORT_TASK", + [SCST_ABORT_TASK_SET] = "ABORT_TASK_SET", + [SCST_CLEAR_ACA] = "CLEAR_ACA", + [SCST_CLEAR_TASK_SET] = "CLEAR_TASK_SET", + [SCST_LUN_RESET] = "LUN_RESET", + [SCST_TARGET_RESET] = "TARGET_RESET", + [SCST_NEXUS_LOSS_SESS] = "NEXUS_LOSS_SESS", + [SCST_ABORT_ALL_TASKS_SESS] = "ABORT_ALL_TASKS_SESS", + [SCST_NEXUS_LOSS] = "NEXUS_LOSS", + [SCST_ABORT_ALL_TASKS] = "ABORT_ALL_TASKS", + [SCST_UNREG_SESS_TM] = "UNREG_SESS_TM", + [SCST_PR_ABORT_ALL] = "PR_ABORT_ALL", }; char *scst_get_tm_fn_name(char *name, int len, unsigned int fn) @@ -713,13 +693,13 @@ char *scst_get_tm_fn_name(char *name, int len, unsigned int fn) } static const char *const scst_mcmd_state_name[] = { - [SCST_MCMD_STATE_INIT] = "INIT", - [SCST_MCMD_STATE_EXEC] = "EXEC", - [SCST_MCMD_STATE_WAITING_AFFECTED_CMDS_DONE] = "WAITING_AFFECTED_CMDS_DONE", - [SCST_MCMD_STATE_AFFECTED_CMDS_DONE] = "AFFECTED_CMDS_DONE", - [SCST_MCMD_STATE_WAITING_AFFECTED_CMDS_FINISHED] = "WAITING_AFFECTED_CMDS_FINISHED", - [SCST_MCMD_STATE_DONE] = "DONE", - [SCST_MCMD_STATE_FINISHED] = "FINISHED", + [SCST_MCMD_STATE_INIT] = "INIT", + [SCST_MCMD_STATE_EXEC] = "EXEC", + [SCST_MCMD_STATE_WAITING_AFFECTED_CMDS_DONE] = "WAITING_AFFECTED_CMDS_DONE", + [SCST_MCMD_STATE_AFFECTED_CMDS_DONE] = "AFFECTED_CMDS_DONE", + [SCST_MCMD_STATE_WAITING_AFFECTED_CMDS_FINISHED] = "WAITING_AFFECTED_CMDS_FINISHED", + [SCST_MCMD_STATE_DONE] = "DONE", + [SCST_MCMD_STATE_FINISHED] = "FINISHED", }; char *scst_get_mcmd_state_name(char *name, int len, unsigned int state) @@ -738,19 +718,16 @@ void scst_trace_mcmds(scst_show_fn show, void *arg) char fn_name[16], state_name[32]; spin_lock_irq(&scst_mcmd_lock); - list_for_each_entry(mcmd, &scst_active_mgmt_cmd_list, - mgmt_cmd_list_entry) { + list_for_each_entry(mcmd, &scst_active_mgmt_cmd_list, mgmt_cmd_list_entry) { scst_get_tm_fn_name(fn_name, sizeof(fn_name), mcmd->fn); - scst_get_mcmd_state_name(state_name, sizeof(state_name), - mcmd->state); - show(arg, "mcmd %p: state %s; tgtt %s; tgt %s; session %s; fn %s;" - " LUN %lld; tag %lld; cmd_done_wait_count %d\n", + scst_get_mcmd_state_name(state_name, sizeof(state_name), mcmd->state); + show(arg, + "mcmd %p: state %s; tgtt %s; tgt %s; session %s; fn %s; LUN %lld; tag %lld; cmd_done_wait_count %d\n", mcmd, state_name, mcmd->sess->tgt->tgtt->name, mcmd->sess->tgt->tgt_name, mcmd->sess->sess_name, fn_name, mcmd->lun, mcmd->tag, mcmd->cmd_done_wait_count); } spin_unlock_irq(&scst_mcmd_lock); - return; } static void __printf(2, 3) scst_to_syslog(void *arg, const char *fmt, ...) @@ -767,7 +744,6 @@ static void __printf(2, 3) scst_to_syslog(void *arg, const char *fmt, ...) pr_info(" "); vprintk(fmt, args); va_end(args); - return; } /* @@ -800,12 +776,12 @@ static int scst_susp_wait(unsigned long timeout) if (res > 0) { res = 0; goto out; - } else if ((res < 0) && (timeout != SCST_SUSPEND_TIMEOUT_UNLIMITED)) + } + if (res < 0 && timeout != SCST_SUSPEND_TIMEOUT_UNLIMITED) goto out; if (res == 0) { - PRINT_INFO( - "%d active commands to still not completed. See README for possible reasons.", + PRINT_INFO("%d active commands to still not completed. See README for possible reasons.", scst_get_cmd_counter()); scst_trace_cmds(scst_to_syslog, &hp); scst_trace_mcmds(scst_to_syslog, &hp); @@ -865,8 +841,9 @@ int scst_suspend_activity(unsigned long timeout) res = mutex_lock_interruptible(&scst_suspend_mutex); if (res != 0) goto out; - } else + } else { mutex_lock(&scst_suspend_mutex); + } TRACE_MGMT_DBG("suspend_count %d", suspend_count); suspend_count++; @@ -923,8 +900,9 @@ int scst_suspend_activity(unsigned long timeout) goto out_resume; } wait_time = timeout - wait_time; - } else + } else { wait_time = SCST_SUSPEND_TIMEOUT_UNLIMITED; + } res = scst_susp_wait(wait_time); if (res != 0) @@ -989,12 +967,9 @@ static void __scst_resume_activity(void) wake_up_all(&scst_init_cmd_list_waitQ); spin_lock_irq(&scst_mcmd_lock); - list_for_each_entry(m, &scst_delayed_mgmt_cmd_list, - mgmt_cmd_list_entry) { - TRACE_MGMT_DBG( - "Moving delayed mgmt cmd %p to head of active mgmt cmd list", + list_for_each_entry(m, &scst_delayed_mgmt_cmd_list, mgmt_cmd_list_entry) + TRACE_MGMT_DBG("Moving delayed mgmt cmd %p to head of active mgmt cmd list", m); - } list_splice_init(&scst_delayed_mgmt_cmd_list, &scst_active_mgmt_cmd_list); spin_unlock_irq(&scst_mcmd_lock); @@ -1003,7 +978,6 @@ static void __scst_resume_activity(void) out: TRACE_EXIT(); - return; } /** @@ -1022,7 +996,6 @@ void scst_resume_activity(void) mutex_unlock(&scst_suspend_mutex); TRACE_EXIT(); - return; } EXPORT_SYMBOL_GPL(scst_resume_activity); @@ -1039,7 +1012,6 @@ static int scst_register_device(struct scsi_device *scsidp) TRACE_ENTRY(); - res = mutex_lock_interruptible(&scst_mutex); if (res != 0) goto out; @@ -1053,8 +1025,8 @@ static int scst_register_device(struct scsi_device *scsidp) dev->virt_name = kasprintf(GFP_KERNEL, "%d:%d:%d:%lld", scsidp->host->host_no, scsidp->channel, scsidp->id, (u64)scsidp->lun); - if (dev->virt_name == NULL) { - PRINT_ERROR("%s", "Unable to alloc device name"); + if (!dev->virt_name) { + PRINT_ERROR("Unable to alloc device name"); res = -ENOMEM; goto out_free_dev; } @@ -1139,7 +1111,7 @@ static void scst_unregister_device(struct scsi_device *scsidp) mutex_lock(&scst_mutex); dev = __scst_lookup_device(scsidp); - if (dev == NULL) { + if (!dev) { PRINT_ERROR("SCST device for SCSI device %d:%d:%d:%lld not found", scsidp->host->host_no, scsidp->channel, scsidp->id, (u64)scsidp->lun); @@ -1194,28 +1166,25 @@ static int scst_dev_handler_check(struct scst_dev_type *dev_handler) { int res = 0; - if (dev_handler->parse == NULL) { - PRINT_ERROR("scst dev handler %s must have " - "parse() method.", dev_handler->name); + if (!dev_handler->parse) { + PRINT_ERROR("scst dev handler %s must have parse() method.", + dev_handler->name); res = -EINVAL; goto out; } - if (((dev_handler->add_device != NULL) && - (dev_handler->del_device == NULL)) || - ((dev_handler->add_device == NULL) && - (dev_handler->del_device != NULL))) { - PRINT_ERROR("Dev handler %s must either define both " - "add_device() and del_device(), or none.", - dev_handler->name); + if ((dev_handler->add_device && !dev_handler->del_device) || + (!dev_handler->add_device && dev_handler->del_device)) { + PRINT_ERROR("Dev handler %s must either define both add_device() and del_device(), or none.", + dev_handler->name); res = -EINVAL; goto out; } - if (dev_handler->dev_alloc_data_buf == NULL) + if (!dev_handler->dev_alloc_data_buf) dev_handler->dev_alloc_data_buf_atomic = 1; - if (dev_handler->dev_done == NULL) + if (!dev_handler->dev_done) dev_handler->dev_done_atomic = 1; if (dev_handler->max_tgt_dev_commands == 0) @@ -1230,17 +1199,17 @@ static int scst_check_device_name(const char *dev_name) { int res = 0; - if (strchr(dev_name, '/') != NULL) { + if (strchr(dev_name, '/')) { PRINT_ERROR("Dev name %s contains illegal character '/'", - dev_name); + dev_name); res = -EINVAL; goto out; } /* To prevent collision with saved PR and mode pages backup files */ - if (strchr(dev_name, '.') != NULL) { + if (strchr(dev_name, '.')) { PRINT_ERROR("Dev name %s contains illegal character '.'", - dev_name); + dev_name); res = -EINVAL; goto out; } @@ -1260,8 +1229,8 @@ out: * Registers a virtual device and returns ID assigned to the device on * success, or negative value otherwise */ -int scst_register_virtual_device_node(struct scst_dev_type *dev_handler, - const char *dev_name, int nodeid) +int scst_register_virtual_device_node(struct scst_dev_type *dev_handler, const char *dev_name, + int nodeid) { DECLARE_COMPLETION_ONSTACK(c); struct scst_device *dev, *d; @@ -1270,14 +1239,14 @@ int scst_register_virtual_device_node(struct scst_dev_type *dev_handler, TRACE_ENTRY(); - if (dev_handler == NULL) { + if (!dev_handler) { PRINT_ERROR("%s: valid device handler must be supplied", __func__); res = -EINVAL; goto out; } - if (dev_name == NULL) { + if (!dev_name) { PRINT_ERROR("%s: device name must be non-NULL", __func__); res = -EINVAL; goto out; @@ -1302,9 +1271,9 @@ int scst_register_virtual_device_node(struct scst_dev_type *dev_handler, dev->type = dev_handler->type; dev->scsi_dev = NULL; dev->virt_name = kstrdup(dev_name, GFP_KERNEL); - if (dev->virt_name == NULL) { + if (!dev->virt_name) { PRINT_ERROR("Unable to allocate virt_name for dev %s", - dev_name); + dev_name); res = -ENOMEM; goto out_free_dev; } @@ -1425,7 +1394,7 @@ void scst_unregister_virtual_device(int id, break; } } - if (dev == NULL) { + if (!dev) { PRINT_ERROR("Virtual device (id %d) not found", id); goto out_unlock; } @@ -1450,7 +1419,7 @@ void scst_unregister_virtual_device(int id, mutex_unlock(&scst_mutex); PRINT_INFO("Detached from virtual device %s (id %d)", - dev->virt_name, dev->virt_id); + dev->virt_name, dev->virt_id); if (on_free) on_free(dev, arg); @@ -1490,8 +1459,7 @@ EXPORT_SYMBOL_GPL(scst_unregister_virtual_device); * Registers a pass-through dev handler driver. Returns 0 on success * or appropriate error code otherwise. */ -int __scst_register_dev_driver(struct scst_dev_type *dev_type, - const char *version) +int __scst_register_dev_driver(struct scst_dev_type *dev_type, const char *version) { int res, exist; struct scst_dev_type *dt; @@ -1501,7 +1469,7 @@ int __scst_register_dev_driver(struct scst_dev_type *dev_type, res = -EINVAL; if (strcmp(version, SCST_INTERFACE_VERSION) != 0) { PRINT_ERROR("Incorrect version of dev handler %s", - dev_type->name); + dev_type->name); goto out; } @@ -1516,8 +1484,8 @@ int __scst_register_dev_driver(struct scst_dev_type *dev_type, exist = 0; list_for_each_entry(dt, &scst_dev_type_list, dev_type_list_entry) { if (strcmp(dt->name, dev_type->name) == 0) { - PRINT_ERROR("Device type handler \"%s\" already " - "exists", dt->name); + PRINT_ERROR("Device type handler \"%s\" already exists", + dt->name); exist = 1; break; } @@ -1533,8 +1501,8 @@ int __scst_register_dev_driver(struct scst_dev_type *dev_type, if (res < 0) goto out; - PRINT_INFO("Device handler \"%s\" for type %d registered " - "successfully", dev_type->name, dev_type->type); + PRINT_INFO("Device handler \"%s\" for type %d registered successfully", + dev_type->name, dev_type->type); out: TRACE_EXIT_RES(res); @@ -1570,7 +1538,7 @@ void scst_unregister_dev_driver(struct scst_dev_type *dev_type) } if (!found) { PRINT_ERROR("Dev handler \"%s\" isn't registered", - dev_type->name); + dev_type->name); goto out_up; } @@ -1613,8 +1581,7 @@ EXPORT_SYMBOL_GPL(scst_unregister_dev_driver); * Registers a virtual dev handler driver. Returns 0 on success or * appropriate error code otherwise. */ -int __scst_register_virtual_dev_driver(struct scst_dev_type *dev_type, - const char *version) +int __scst_register_virtual_dev_driver(struct scst_dev_type *dev_type, const char *version) { int res; @@ -1622,7 +1589,7 @@ int __scst_register_virtual_dev_driver(struct scst_dev_type *dev_type, if (strcmp(version, SCST_INTERFACE_VERSION) != 0) { PRINT_ERROR("Incorrect version of virtual dev handler %s", - dev_type->name); + dev_type->name); res = -EINVAL; goto out; } @@ -1641,14 +1608,12 @@ int __scst_register_virtual_dev_driver(struct scst_dev_type *dev_type, if (res < 0) goto out; - if (dev_type->type != -1) { - PRINT_INFO("Virtual device handler %s for type %d " - "registered successfully", dev_type->name, - dev_type->type); - } else { - PRINT_INFO("Virtual device handler \"%s\" registered " - "successfully", dev_type->name); - } + if (dev_type->type != -1) + PRINT_INFO("Virtual device handler %s for type %d registered successfully", + dev_type->name, dev_type->type); + else + PRINT_INFO("Virtual device handler \"%s\" registered successfully", + dev_type->name); out: TRACE_EXIT_RES(res); @@ -1682,12 +1647,11 @@ void scst_unregister_virtual_dev_driver(struct scst_dev_type *dev_type) PRINT_INFO("Device handler \"%s\" unloaded", dev_type->name); TRACE_EXIT(); - return; } EXPORT_SYMBOL_GPL(scst_unregister_virtual_dev_driver); -int scst_add_threads(struct scst_cmd_threads *cmd_threads, - struct scst_device *dev, struct scst_tgt_dev *tgt_dev, int num) +int scst_add_threads(struct scst_cmd_threads *cmd_threads, struct scst_device *dev, + struct scst_tgt_dev *tgt_dev, int num) { int res = 0, i; struct scst_cmd_thread_t *thr; @@ -1705,13 +1669,12 @@ int scst_add_threads(struct scst_cmd_threads *cmd_threads, spin_unlock(&cmd_threads->thr_lock); TRACE_DBG("cmd_threads %p, dev %s, tgt_dev %p, num %d, n %d", - cmd_threads, dev ? dev->virt_name : "NULL", tgt_dev, num, n); + cmd_threads, dev ? dev->virt_name : "NULL", tgt_dev, num, n); - if (tgt_dev != NULL) { + if (tgt_dev) { struct scst_tgt_dev *t; - list_for_each_entry(t, &tgt_dev->dev->dev_tgt_dev_list, - dev_tgt_dev_list_entry) { + list_for_each_entry(t, &tgt_dev->dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { if (t == tgt_dev) break; tgt_dev_num++; @@ -1719,8 +1682,9 @@ int scst_add_threads(struct scst_cmd_threads *cmd_threads, tgt_dev->thread_index = tgt_dev_num; nodeid = tgt_dev->dev->dev_numa_node_id; - } else if (dev != NULL) + } else if (dev) { nodeid = dev->dev_numa_node_id; + } for (i = 0; i < num; i++) { thr = kmem_cache_alloc_node(scst_thr_cachep, GFP_KERNEL, nodeid); @@ -1734,16 +1698,18 @@ int scst_add_threads(struct scst_cmd_threads *cmd_threads, spin_lock_init(&thr->thr_cmd_list_lock); thr->thr_cmd_threads = cmd_threads; - if (dev != NULL) { - thr->cmd_thread = kthread_create_on_node(scst_cmd_thread, - thr, nodeid, "%.13s%d", dev->virt_name, n++); - } else if (tgt_dev != NULL) { - thr->cmd_thread = kthread_create_on_node(scst_cmd_thread, - thr, nodeid, "%.10s%d_%d", - tgt_dev->dev->virt_name, tgt_dev_num, n++); - } else - thr->cmd_thread = kthread_create_on_node(scst_cmd_thread, - thr, nodeid, "scstd%d", n++); + if (dev) { + thr->cmd_thread = kthread_create_on_node(scst_cmd_thread, thr, nodeid, + "%.13s%d", dev->virt_name, n++); + } else if (tgt_dev) { + thr->cmd_thread = kthread_create_on_node(scst_cmd_thread, thr, nodeid, + "%.10s%d_%d", + tgt_dev->dev->virt_name, + tgt_dev_num, n++); + } else { + thr->cmd_thread = kthread_create_on_node(scst_cmd_thread, thr, nodeid, + "scstd%d", n++); + } if (IS_ERR(thr->cmd_thread)) { res = PTR_ERR(thr->cmd_thread); @@ -1752,17 +1718,17 @@ int scst_add_threads(struct scst_cmd_threads *cmd_threads, goto out_wait; } - if (tgt_dev != NULL) { + if (tgt_dev) { int rc; /* * sess->acg can be NULL here, if called from * scst_check_reassign_sess()! */ rc = set_cpus_allowed_ptr(thr->cmd_thread, - &tgt_dev->acg_dev->acg->acg_cpu_mask); + &tgt_dev->acg_dev->acg->acg_cpu_mask); if (rc != 0) - PRINT_ERROR("Setting CPU affinity failed: " - "%d", rc); + PRINT_ERROR("Setting CPU affinity failed: %d", + rc); } spin_lock(&cmd_threads->thr_lock); @@ -1771,7 +1737,7 @@ int scst_add_threads(struct scst_cmd_threads *cmd_threads, spin_unlock(&cmd_threads->thr_lock); TRACE_DBG("Added thr %p to threads list (nr_threads %d, n %d)", - thr, cmd_threads->nr_threads, n); + thr, cmd_threads->nr_threads, n); wake_up_process(thr->cmd_thread); } @@ -1830,11 +1796,9 @@ void scst_del_threads(struct scst_cmd_threads *cmd_threads, int num) kmem_cache_free(scst_thr_cachep, ct); } - EXTRACHECKS_BUG_ON((cmd_threads->nr_threads == 0) && - (cmd_threads->io_context != NULL)); + EXTRACHECKS_BUG_ON((cmd_threads->nr_threads == 0) && cmd_threads->io_context); TRACE_EXIT(); - return; } /* scst_mutex supposed to be held */ @@ -1864,17 +1828,13 @@ void scst_stop_dev_threads(struct scst_device *dev) TRACE_ENTRY(); - list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, - dev_tgt_dev_list_entry) { + list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) scst_tgt_dev_stop_threads(tgt_dev); - } - if ((dev->threads_num > 0) && - (dev->threads_pool_type == SCST_THREADS_POOL_SHARED)) + if (dev->threads_num > 0 && dev->threads_pool_type == SCST_THREADS_POOL_SHARED) scst_del_threads(&dev->dev_cmd_threads, -1); TRACE_EXIT(); - return; } /* The activity supposed to be suspended and scst_mutex held */ @@ -1885,17 +1845,14 @@ int scst_create_dev_threads(struct scst_device *dev) TRACE_ENTRY(); - list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, - dev_tgt_dev_list_entry) { + list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { res = scst_tgt_dev_setup_threads(tgt_dev); if (res != 0) goto out_err; } - if ((dev->threads_num > 0) && - (dev->threads_pool_type == SCST_THREADS_POOL_SHARED)) { - res = scst_add_threads(&dev->dev_cmd_threads, dev, NULL, - dev->threads_num); + if (dev->threads_num > 0 && dev->threads_pool_type == SCST_THREADS_POOL_SHARED) { + res = scst_add_threads(&dev->dev_cmd_threads, dev, NULL, dev->threads_num); if (res != 0) goto out_err; } @@ -1916,8 +1873,7 @@ out_err: * wait until the commands associated with these LUNs have finished before this * function is called. */ -int scst_assign_dev_handler(struct scst_device *dev, - struct scst_dev_type *handler) +int scst_assign_dev_handler(struct scst_device *dev, struct scst_dev_type *handler) { int res = 0; struct scst_tgt_dev *tgt_dev; @@ -1927,21 +1883,20 @@ int scst_assign_dev_handler(struct scst_device *dev, lockdep_assert_held(&scst_mutex); - sBUG_ON(handler == NULL); + sBUG_ON(!handler); if (dev->handler == handler) goto out; - if (dev->handler == NULL) + if (!dev->handler) goto assign; if (dev->handler->detach_tgt) { - list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, - dev_tgt_dev_list_entry) { + list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { TRACE_DBG("Calling dev handler's detach_tgt(%p)", - tgt_dev); + tgt_dev); dev->handler->detach_tgt(tgt_dev); - TRACE_DBG("%s", "Dev handler's detach_tgt() returned"); + TRACE_DBG("Dev handler's detach_tgt() returned"); } } @@ -1953,9 +1908,9 @@ int scst_assign_dev_handler(struct scst_device *dev, scst_devt_dev_sysfs_del(dev); if (dev->handler->detach) { - TRACE_DBG("%s", "Calling dev handler's detach()"); + TRACE_DBG("Calling dev handler's detach()"); dev->handler->detach(dev); - TRACE_DBG("%s", "Old handler's detach() returned"); + TRACE_DBG("Old handler's detach() returned"); } scst_stop_dev_threads(dev); @@ -1972,8 +1927,8 @@ assign: res = handler->attach(dev); TRACE_DBG("New dev handler's attach() returned %d", res); if (res != 0) { - PRINT_ERROR("New device handler's %s attach() " - "failed: %d", handler->name, res); + PRINT_ERROR("New device handler's %s attach() failed: %d", + handler->name, res); goto out; } } @@ -1983,19 +1938,17 @@ assign: goto out_detach; if (handler->attach_tgt) { - list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, - dev_tgt_dev_list_entry) { + list_for_each_entry(tgt_dev, &dev->dev_tgt_dev_list, dev_tgt_dev_list_entry) { TRACE_DBG("Calling dev handler's attach_tgt(%p)", - tgt_dev); + tgt_dev); res = handler->attach_tgt(tgt_dev); - TRACE_DBG("%s", "Dev handler's attach_tgt() returned"); + TRACE_DBG("Dev handler's attach_tgt() returned"); if (res != 0) { - PRINT_ERROR("Device handler's %s attach_tgt() " - "failed: %d", handler->name, res); + PRINT_ERROR("Device handler's %s attach_tgt() failed: %d", + handler->name, res); goto out_err_detach_tgt; } - list_add_tail(&tgt_dev->extra_tgt_dev_list_entry, - &attached_tgt_devs); + list_add_tail(&tgt_dev->extra_tgt_dev_list_entry, &attached_tgt_devs); } } @@ -2009,12 +1962,11 @@ out: out_err_detach_tgt: if (handler->detach_tgt) { - list_for_each_entry(tgt_dev, &attached_tgt_devs, - extra_tgt_dev_list_entry) { + list_for_each_entry(tgt_dev, &attached_tgt_devs, extra_tgt_dev_list_entry) { TRACE_DBG("Calling handler's detach_tgt(%p)", - tgt_dev); + tgt_dev); handler->detach_tgt(tgt_dev); - TRACE_DBG("%s", "Handler's detach_tgt() returned"); + TRACE_DBG("Handler's detach_tgt() returned"); } } @@ -2022,9 +1974,9 @@ out_err_detach_tgt: out_detach: if (handler->detach) { - TRACE_DBG("%s", "Calling handler's detach()"); + TRACE_DBG("Calling handler's detach()"); handler->detach(dev); - TRACE_DBG("%s", "Handler's detach() returned"); + TRACE_DBG("Handler's detach() returned"); } dev->handler = &scst_null_devtype; @@ -2051,12 +2003,10 @@ void scst_init_threads(struct scst_cmd_threads *cmd_threads) spin_lock_init(&cmd_threads->thr_lock); mutex_lock(&scst_cmd_threads_mutex); - list_add_tail(&cmd_threads->lists_list_entry, - &scst_cmd_threads_list); + list_add_tail(&cmd_threads->lists_list_entry, &scst_cmd_threads_list); mutex_unlock(&scst_cmd_threads_mutex); TRACE_EXIT(); - return; } EXPORT_SYMBOL_GPL(scst_init_threads); @@ -2076,7 +2026,6 @@ void scst_deinit_threads(struct scst_cmd_threads *cmd_threads) sBUG_ON(cmd_threads->io_context); TRACE_EXIT(); - return; } EXPORT_SYMBOL_GPL(scst_deinit_threads); @@ -2098,7 +2047,6 @@ static void scst_stop_global_threads(void) mutex_unlock(&scst_mutex); TRACE_EXIT(); - return; } /* It does NOT stop ran threads on error! */ @@ -2114,8 +2062,7 @@ static int scst_start_global_threads(int num) if (res < 0) goto out_unlock; - scst_init_cmd_thread = kthread_run(scst_init_thread, - NULL, "scst_initd"); + scst_init_cmd_thread = kthread_run(scst_init_thread, NULL, "scst_initd"); if (IS_ERR(scst_init_cmd_thread)) { res = PTR_ERR(scst_init_cmd_thread); PRINT_ERROR("kthread_create() for init cmd failed: %d", res); @@ -2123,8 +2070,7 @@ static int scst_start_global_threads(int num) goto out_unlock; } - scst_mgmt_cmd_thread = kthread_run(scst_tm_thread, - NULL, "scsi_tm"); + scst_mgmt_cmd_thread = kthread_run(scst_tm_thread, NULL, "scsi_tm"); if (IS_ERR(scst_mgmt_cmd_thread)) { res = PTR_ERR(scst_mgmt_cmd_thread); PRINT_ERROR("kthread_create() for TM failed: %d", res); @@ -2132,8 +2078,7 @@ static int scst_start_global_threads(int num) goto out_unlock; } - scst_mgmt_thread = kthread_run(scst_global_mgmt_thread, - NULL, "scst_mgmtd"); + scst_mgmt_thread = kthread_run(scst_global_mgmt_thread, NULL, "scst_mgmtd"); if (IS_ERR(scst_mgmt_thread)) { res = PTR_ERR(scst_mgmt_thread); PRINT_ERROR("kthread_create() for mgmt failed: %d", res); @@ -2175,7 +2120,7 @@ static int scst_add(struct device *cdev) scsidp = to_scsi_device(cdev->parent); - if ((scsidp->host->hostt->name == NULL) || + if (!scsidp->host->hostt->name || (strcmp(scsidp->host->hostt->name, SCST_LOCAL_NAME) != 0)) res = scst_register_device(scsidp); @@ -2197,12 +2142,11 @@ static void scst_remove(struct device *cdev) scsidp = to_scsi_device(cdev->parent); - if ((scsidp->host->hostt->name == NULL) || + if (!scsidp->host->hostt->name || (strcmp(scsidp->host->hostt->name, SCST_LOCAL_NAME) != 0)) scst_unregister_device(scsidp); TRACE_EXIT(); - return; } static struct class_interface scst_interface = { @@ -2342,7 +2286,7 @@ static int __init init_scst(void) scst_threads = scst_num_cpus; if (scst_threads < 1) { - PRINT_ERROR("%s", "scst_threads can not be less than 1"); + PRINT_ERROR("scst_threads can not be less than 1"); scst_threads = scst_num_cpus; } @@ -2363,7 +2307,8 @@ static int __init init_scst(void) /* Used for structures with fast path write access */ #define INIT_CACHEP_ALIGN(p, s) ({ \ - (p) = KMEM_CACHE(s, SCST_SLAB_FLAGS|SLAB_HWCACHE_ALIGN);\ + (p) = KMEM_CACHE(s, \ + SCST_SLAB_FLAGS | SLAB_HWCACHE_ALIGN); \ TRACE_MEM("Slab create: %s at %p size %zd", #s, (p), \ sizeof(struct s)); \ (p); \ @@ -2407,9 +2352,9 @@ static int __init init_scst(void) if (!INIT_CACHEP_ALIGN(scst_thr_cachep, scst_cmd_thread_t)) goto out_destroy_acg_cache; - scst_mgmt_mempool = mempool_create(64, mempool_alloc_slab, - mempool_free_slab, scst_mgmt_cachep); - if (scst_mgmt_mempool == NULL) { + scst_mgmt_mempool = mempool_create(64, mempool_alloc_slab, mempool_free_slab, + scst_mgmt_cachep); + if (!scst_mgmt_mempool) { res = -ENOMEM; goto out_destroy_thr_cache; } @@ -2419,30 +2364,30 @@ static int __init init_scst(void) * may have fatal consequences, so let's have big pools for them. */ - scst_mgmt_stub_mempool = mempool_create(1024, mempool_alloc_slab, - mempool_free_slab, scst_mgmt_stub_cachep); - if (scst_mgmt_stub_mempool == NULL) { + scst_mgmt_stub_mempool = mempool_create(1024, mempool_alloc_slab, mempool_free_slab, + scst_mgmt_stub_cachep); + if (!scst_mgmt_stub_mempool) { res = -ENOMEM; goto out_destroy_mgmt_mempool; } - scst_ua_mempool = mempool_create(512, mempool_alloc_slab, - mempool_free_slab, scst_ua_cachep); - if (scst_ua_mempool == NULL) { + scst_ua_mempool = mempool_create(512, mempool_alloc_slab, mempool_free_slab, + scst_ua_cachep); + if (!scst_ua_mempool) { res = -ENOMEM; goto out_destroy_mgmt_stub_mempool; } - scst_sense_mempool = mempool_create(1024, mempool_alloc_slab, - mempool_free_slab, scst_sense_cachep); - if (scst_sense_mempool == NULL) { + scst_sense_mempool = mempool_create(1024, mempool_alloc_slab, mempool_free_slab, + scst_sense_cachep); + if (!scst_sense_mempool) { res = -ENOMEM; goto out_destroy_ua_mempool; } - scst_aen_mempool = mempool_create(100, mempool_alloc_slab, - mempool_free_slab, scst_aen_cachep); - if (scst_aen_mempool == NULL) { + scst_aen_mempool = mempool_create(100, mempool_alloc_slab, mempool_free_slab, + scst_aen_cachep); + if (!scst_aen_mempool) { res = -ENOMEM; goto out_destroy_sense_mempool; } @@ -2462,32 +2407,27 @@ static int __init init_scst(void) si_meminfo(&si); #if BITS_PER_LONG == 32 - scst_max_cmd_mem = min( - (((uint64_t)(si.totalram - si.totalhigh) << PAGE_SHIFT) - >> 20) >> 2, (uint64_t)1 << 30); + scst_max_cmd_mem = min((((uint64_t)(si.totalram - si.totalhigh) << PAGE_SHIFT) >> 20) >> 2, + (uint64_t)1 << 30); #else - scst_max_cmd_mem = (((si.totalram - si.totalhigh) << PAGE_SHIFT) - >> 20) >> 2; + scst_max_cmd_mem = (((si.totalram - si.totalhigh) << PAGE_SHIFT) >> 20) >> 2; #endif } if (scst_max_dev_cmd_mem != 0) { if (scst_max_dev_cmd_mem > scst_max_cmd_mem) { - PRINT_ERROR("scst_max_dev_cmd_mem (%d) > " - "scst_max_cmd_mem (%d)", - scst_max_dev_cmd_mem, - scst_max_cmd_mem); + PRINT_ERROR("scst_max_dev_cmd_mem (%d) > scst_max_cmd_mem (%d)", + scst_max_dev_cmd_mem, scst_max_cmd_mem); scst_max_dev_cmd_mem = scst_max_cmd_mem; } - } else + } else { scst_max_dev_cmd_mem = scst_max_cmd_mem * 2 / 5; + } - res = scst_sgv_pools_init( - ((uint64_t)scst_max_cmd_mem << 10) >> (PAGE_SHIFT - 10), 0); + res = scst_sgv_pools_init(((uint64_t)scst_max_cmd_mem << 10) >> (PAGE_SHIFT - 10), 0); if (res != 0) goto out_sysfs_cleanup; - res = scsi_register_interface(&scst_interface); if (res != 0) goto out_destroy_sgv_pool; @@ -2510,14 +2450,13 @@ static int __init init_scst(void) (unsigned long)&scst_percpu_infos[i]); } - TRACE_DBG("%d CPUs found, starting %d threads", scst_num_cpus, - scst_threads); + TRACE_DBG("%d CPUs found, starting %d threads", + scst_num_cpus, scst_threads); res = scst_start_global_threads(scst_threads); if (res < 0) goto out_thread_free; - res = scst_cm_init(); if (res != 0) goto out_thread_free; @@ -2536,7 +2475,6 @@ out: TRACE_EXIT_RES(res); return res; - out_thread_free: scst_stop_global_threads(); percpu_ref_exit(&scst_mcmd_count); @@ -2671,10 +2609,9 @@ static void __exit exit_scst(void) scst_lib_exit(); - PRINT_INFO("%s", "SCST unloaded"); + PRINT_INFO("SCST unloaded"); TRACE_EXIT(); - return; } module_init(init_scst); |
From: Gleb C. <lna...@ya...> - 2025-05-14 15:38:57
|
Commit: a410829 GitHub URL: https://github.com/SCST-project/scst/commit/a410829b26de9975895bb11f6842f2e358e6a182 Author: Gleb Chesnokov Date: 2025-05-14T18:36:46+03:00 Log Message: ----------- scst_vdisk: Port to Linux kernel v6.15 Support for the following block layer changes in the Linux kernel v6.15: - 105ca2a2c2ff ("block: split struct bio_integrity_payload") Modified Paths: -------------- scst/src/dev_handlers/scst_vdisk.c | 52 +++++++-------- 1 file changed, 24 insertions(+), 28 deletions(-) =================================================================== diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 6523d65..abf6a32 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -6502,6 +6502,20 @@ out: return res; } +static void vdisk_free_bioset(struct scst_vdisk_dev *virt_dev) +{ + if (!virt_dev->vdisk_bioset) + return; + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) + bioset_exit(virt_dev->vdisk_bioset); +#else + bioset_free(virt_dev->vdisk_bioset); +#endif + + virt_dev->vdisk_bioset = NULL; +} + static int vdisk_create_bioset(struct scst_vdisk_dev *virt_dev) { int res = 0; @@ -6511,8 +6525,7 @@ static int vdisk_create_bioset(struct scst_vdisk_dev *virt_dev) /* Pool size doesn't really matter */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) virt_dev->vdisk_bioset = &virt_dev->vdisk_bioset_struct; - res = bioset_init(&virt_dev->vdisk_bioset_struct, 2, 0, - BIOSET_NEED_BVECS); + res = bioset_init(&virt_dev->vdisk_bioset_struct, 2, 0, BIOSET_NEED_BVECS); #else virt_dev->vdisk_bioset = bioset_create(2, 0, BIOSET_NEED_BVECS); if (!virt_dev->vdisk_bioset) @@ -6520,43 +6533,26 @@ static int vdisk_create_bioset(struct scst_vdisk_dev *virt_dev) #endif if (res < 0) { PRINT_ERROR("Failed to create bioset (dev %s)", virt_dev->name); - goto out; + return res; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 15, 0) + /* + * See also commit 105ca2a2c2ff ("block: split struct bio_integrity_payload") #v6.15. + */ if (virt_dev->dif_mode & SCST_DIF_MODE_DEV) { /* The same, pool size doesn't really matter */ res = bioset_integrity_create(virt_dev->vdisk_bioset, 2); - if (res != 0) { + if (res) { PRINT_ERROR("Failed to create integrity bioset (dev %s)", virt_dev->name); - goto out_free; + vdisk_free_bioset(virt_dev); + return res; } } - - res = 0; - -out: - return res; - -out_free: -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) - bioset_exit(virt_dev->vdisk_bioset); -#else - bioset_free(virt_dev->vdisk_bioset); #endif - virt_dev->vdisk_bioset = NULL; - goto out; -} -static void vdisk_free_bioset(struct scst_vdisk_dev *virt_dev) -{ - if (!virt_dev->vdisk_bioset) - return; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0) - bioset_exit(virt_dev->vdisk_bioset); -#else - bioset_free(virt_dev->vdisk_bioset); -#endif + return 0; } static void vdev_inq_changed_fn(struct work_struct *work) |
From: Gleb C. <lna...@ya...> - 2025-05-14 15:38:12
|
Commit: 163eb9d GitHub URL: https://github.com/SCST-project/scst/commit/163eb9dcc10b25f6f3ac15e5be058ec46dd1100a Author: Gleb Chesnokov Date: 2025-05-14T18:36:46+03:00 Log Message: ----------- scst: Port to Linux kernel v6.15 Support for the following scsi layer changes in the Linux kernel v6.15: - 0ea163a18b17 ("scsi: usb: Rename the RESERVE and RELEASE constants") Modified Paths: -------------- scst/include/backport.h | 13 ++++ scst/src/dev_handlers/scst_disk.c | 4 +- scst/src/dev_handlers/scst_vdisk.c | 8 +-- scst/src/scst_lib.c | 24 +++---- scst/src/scst_targ.c | 13 ++-- scst/src/scst_tg.c | 4 +- usr/fileio/common.c | 4 +- usr/fileio/common.h | 50 +++++++++------ 8 files changed, 70 insertions(+), 50 deletions(-) =================================================================== diff --git a/scst/include/backport.h b/scst/include/backport.h index 27a9bbd..20f276d 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -1875,6 +1875,19 @@ static inline void scsi_done(struct scsi_cmnd *cmd) } #endif +/* <scsi/scsi_proto.h> */ + +/* + * See also commit 0ea163a18b17 ("scsi: usb: Rename the RESERVE and RELEASE constants") # v6.15. + */ +#ifndef RESERVE_6 +#define RESERVE_6 0x16 +#endif + +#ifndef RELEASE_6 +#define RELEASE_6 0x17 +#endif + /* <scsi/scsi_request.h> */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) diff --git a/scst/src/dev_handlers/scst_disk.c b/scst/src/dev_handlers/scst_disk.c index c9d5cda..0472569 100644 --- a/scst/src/dev_handlers/scst_disk.c +++ b/scst/src/dev_handlers/scst_disk.c @@ -348,9 +348,9 @@ static enum scst_exec_res disk_exec(struct scst_cmd *cmd) if (unlikely(tgt->tgt_forward_src && cmd->op_flags & SCST_LOCAL_CMD)) { switch (cmd->cdb[0]) { - case RESERVE: + case RESERVE_6: case RESERVE_10: - case RELEASE: + case RELEASE_6: case RELEASE_10: TRACE_DBG("Skipping LOCAL cmd %p (op %s)", cmd, cmd->op_name); diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 7b163c8..6523d65 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -3285,9 +3285,9 @@ static bool vdisk_no_fd_allowed_commands(const struct scst_cmd *cmd) case READ_CAPACITY: case REPORT_LUNS: case REQUEST_SENSE: - case RELEASE: + case RELEASE_6: case RELEASE_10: - case RESERVE: + case RESERVE_6: case RESERVE_10: case READ_BUFFER: case WRITE_BUFFER: @@ -9784,9 +9784,9 @@ static int __init vdev_check_mode_pages_path(void) [ALLOW_MEDIUM_REMOVAL] = vdisk_exec_prevent_allow_medium_removal, \ [READ_TOC] = vdisk_exec_read_toc, \ [START_STOP] = vdisk_exec_start_stop, \ - [RESERVE] = vdisk_nop, \ + [RESERVE_6] = vdisk_nop, \ [RESERVE_10] = vdisk_nop, \ - [RELEASE] = vdisk_nop, \ + [RELEASE_6] = vdisk_nop, \ [RELEASE_10] = vdisk_nop, \ [TEST_UNIT_READY] = vdisk_nop, \ [INQUIRY] = vdisk_exec_inquiry, \ diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 1cf5e93..979caae 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -236,22 +236,22 @@ const struct scst_opcode_descriptor scst_op_descr_send_diagnostic = { EXPORT_SYMBOL(scst_op_descr_send_diagnostic); const struct scst_opcode_descriptor scst_op_descr_reserve6 = { - .od_opcode = RESERVE, + .od_opcode = RESERVE_6, .od_support = 3, /* supported as in the standard */ .od_cdb_size = 6, .od_nominal_timeout = SCST_DEFAULT_NOMINAL_TIMEOUT_SEC, .od_recommended_timeout = SCST_GENERIC_DISK_SMALL_TIMEOUT/HZ, - .od_cdb_usage_bits = { RESERVE, 0, 0, 0, 0, SCST_OD_DEFAULT_CONTROL_BYTE }, + .od_cdb_usage_bits = { RESERVE_6, 0, 0, 0, 0, SCST_OD_DEFAULT_CONTROL_BYTE }, }; EXPORT_SYMBOL(scst_op_descr_reserve6); const struct scst_opcode_descriptor scst_op_descr_release6 = { - .od_opcode = RELEASE, + .od_opcode = RELEASE_6, .od_support = 3, /* supported as in the standard */ .od_cdb_size = 6, .od_nominal_timeout = SCST_DEFAULT_NOMINAL_TIMEOUT_SEC, .od_recommended_timeout = SCST_GENERIC_DISK_SMALL_TIMEOUT/HZ, - .od_cdb_usage_bits = { RELEASE, 0, 0, 0, 0, SCST_OD_DEFAULT_CONTROL_BYTE }, + .od_cdb_usage_bits = { RELEASE_6, 0, 0, 0, 0, SCST_OD_DEFAULT_CONTROL_BYTE }, }; EXPORT_SYMBOL(scst_op_descr_release6); @@ -727,14 +727,14 @@ static const struct scst_sdbops scst_scsi_op_table[] = { .info_len_off = 4, .info_len_len = 1, .get_cdb_info = get_cdb_info_len_1}, {.ops = 0x16, .devkey = "MMMMMMMMMMMMMMMM", - .info_op_name = "RESERVE", + .info_op_name = "RESERVE(6)", .info_data_direction = SCST_DATA_NONE, .info_op_flags = SCST_SMALL_TIMEOUT|SCST_LOCAL_CMD|SCST_SERIALIZED| SCST_WRITE_EXCL_ALLOWED|SCST_EXCL_ACCESS_ALLOWED| SCST_SCSI_ATOMIC/* see comment in scst_cmd_overlap() */, .get_cdb_info = get_cdb_info_none}, {.ops = 0x17, .devkey = "MMMMMMMMMMMMMMMM", - .info_op_name = "RELEASE", + .info_op_name = "RELEASE(6)", .info_data_direction = SCST_DATA_NONE, .info_op_flags = SCST_SMALL_TIMEOUT|SCST_LOCAL_CMD|SCST_SERIALIZED| SCST_REG_RESERVE_ALLOWED|SCST_WRITE_EXCL_ALLOWED| @@ -7257,23 +7257,23 @@ static void scst_send_release(struct scst_device *dev) for (i = 0; i < 5; i++) { memset(cdb, 0, sizeof(cdb)); - cdb[0] = RELEASE; + cdb[0] = RELEASE_6; cdb[1] = (scsi_dev->scsi_level <= SCSI_2) ? ((scsi_dev->lun << 5) & 0xe0) : 0; memset(sense, 0, sizeof(sense)); - TRACE(TRACE_DEBUG | TRACE_SCSI, "%s", "Sending RELEASE req to " - "SCSI mid-level"); + TRACE(TRACE_DEBUG | TRACE_SCSI, + "Sending RELEASE_6 req to SCSI mid-level"); rc = scst_scsi_execute_cmd(scsi_dev, cdb, DMA_FROM_DEVICE, NULL, 0, sense, 15, 0, 0); - TRACE_DBG("RELEASE done: %x", rc); + TRACE_DBG("RELEASE_6 done: %x", rc); if (scsi_status_is_good(rc)) break; - PRINT_ERROR("RELEASE failed: %d", rc); - PRINT_BUFFER("RELEASE sense", sense, sizeof(sense)); + PRINT_ERROR("RELEASE_6 failed: %d", rc); + PRINT_BUFFER("RELEASE_6 sense", sense, sizeof(sense)); scst_check_internal_sense(dev, rc, sense, sizeof(sense)); } diff --git a/scst/src/scst_targ.c b/scst/src/scst_targ.c index d2c50ab..f653dac 100644 --- a/scst/src/scst_targ.c +++ b/scst/src/scst_targ.c @@ -145,7 +145,7 @@ static bool scst_cmd_overlap_cwr(struct scst_cmd *cwr_cmd, struct scst_cmd *cmd) if (cmd->op_flags & SCST_LBA_NOT_VALID) { switch (cmd->cdb[0]) { - case RESERVE: + case RESERVE_6: case RESERVE_10: res = true; break; @@ -179,8 +179,7 @@ out: return res; } -static bool scst_cmd_overlap_reserve(struct scst_cmd *reserve_cmd, - struct scst_cmd *cmd) +static bool scst_cmd_overlap_reserve(struct scst_cmd *reserve_cmd, struct scst_cmd *cmd) { bool res; @@ -191,7 +190,7 @@ static bool scst_cmd_overlap_reserve(struct scst_cmd *reserve_cmd, (cmd->op_flags & SCST_LBA_NOT_VALID) == 0, (long long)cmd->lba, (long long)cmd->data_len); - EXTRACHECKS_BUG_ON((reserve_cmd->cdb[0] != RESERVE) && + EXTRACHECKS_BUG_ON((reserve_cmd->cdb[0] != RESERVE_6) && (reserve_cmd->cdb[0] != RESERVE_10)); /* @@ -225,7 +224,7 @@ static bool scst_cmd_overlap_atomic(struct scst_cmd *atomic_cmd, struct scst_cmd case COMPARE_AND_WRITE: res = scst_cmd_overlap_cwr(atomic_cmd, cmd); break; - case RESERVE: + case RESERVE_6: case RESERVE_10: res = scst_cmd_overlap_reserve(atomic_cmd, cmd); break; @@ -2702,11 +2701,11 @@ static scst_local_exec_fn scst_local_fns[256] = { [PERSISTENT_RESERVE_IN] = scst_persistent_reserve_in_local, [PERSISTENT_RESERVE_OUT] = scst_persistent_reserve_out_local, [RECEIVE_COPY_RESULTS] = scst_cm_rcv_copy_res_exec, - [RELEASE] = scst_release_local, + [RELEASE_6] = scst_release_local, [RELEASE_10] = scst_release_local, [REPORT_LUNS] = scst_report_luns_local, [REQUEST_SENSE] = scst_request_sense_local, - [RESERVE] = scst_reserve_local, + [RESERVE_6] = scst_reserve_local, [RESERVE_10] = scst_reserve_local, }; diff --git a/scst/src/scst_tg.c b/scst/src/scst_tg.c index 348aefe..f2415b0 100644 --- a/scst/src/scst_tg.c +++ b/scst/src/scst_tg.c @@ -313,9 +313,9 @@ static int scst_tg_accept_standby(struct scst_cmd *cmd) case READ_CAPACITY: case REPORT_LUNS: case REQUEST_SENSE: - case RELEASE: + case RELEASE_6: case RELEASE_10: - case RESERVE: + case RESERVE_6: case RESERVE_10: case READ_BUFFER: case WRITE_BUFFER: diff --git a/usr/fileio/common.c b/usr/fileio/common.c index 23a7f21..b8962fd 100644 --- a/usr/fileio/common.c +++ b/usr/fileio/common.c @@ -418,9 +418,9 @@ static int do_exec(struct vdisk_cmd *vcmd) case START_STOP: exec_fsync(vcmd/*, 0, dev->file_size*/); break; - case RESERVE: + case RESERVE_6: case RESERVE_10: - case RELEASE: + case RELEASE_6: case RELEASE_10: case TEST_UNIT_READY: break; diff --git a/usr/fileio/common.h b/usr/fileio/common.h index 7827bc7..1a08278 100644 --- a/usr/fileio/common.h +++ b/usr/fileio/common.h @@ -23,34 +23,42 @@ #include "debug.h" -#ifndef WRITE_SAME_10 -#define WRITE_SAME_10 0x41 -#endif - /* 8 byte ASCII Vendor */ -#define VENDOR "SCST_USR" +#define VENDOR "SCST_USR" /* 4 byte ASCII Product Revision Level - left aligned */ -#define FIO_REV "3100" +#define FIO_REV "3100" + +#define MAX_USN_LEN (20 + 1) /* For '\0' */ + +#define INQ_BUF_SZ 128 +#define EVPD 0x01 +#define CMDDT 0x02 -#define MAX_USN_LEN (20+1) /* For '\0' */ +#define MSENSE_BUF_SZ 256 +#define DBD 0x08 /* disable block descriptor */ +#define WP 0x80 /* write protect */ +#define DPOFUA 0x10 /* DPOFUA bit */ +#define WCE 0x04 /* write cache enable */ -#define INQ_BUF_SZ 128 -#define EVPD 0x01 -#define CMDDT 0x02 +#define PF 0x10 /* page format */ +#define SP 0x01 /* save pages */ +#define PS 0x80 /* parameter saveable */ -#define MSENSE_BUF_SZ 256 -#define DBD 0x08 /* disable block descriptor */ -#define WP 0x80 /* write protect */ -#define DPOFUA 0x10 /* DPOFUA bit */ -#define WCE 0x04 /* write cache enable */ +#define BYTE 8 +#define DEF_SECTORS 56 +#define DEF_HEADS 255 -#define PF 0x10 /* page format */ -#define SP 0x01 /* save pages */ -#define PS 0x80 /* parameter saveable */ +#ifndef RESERVE_6 +#define RESERVE_6 0x16 +#endif + +#ifndef RELEASE_6 +#define RELEASE_6 0x17 +#endif -#define BYTE 8 -#define DEF_SECTORS 56 -#define DEF_HEADS 255 +#ifndef WRITE_SAME_10 +#define WRITE_SAME_10 0x41 +#endif struct vdisk_tgt_dev { uint64_t sess_h; |
From: Gleb C. <lna...@ya...> - 2025-05-14 15:37:13
|
Commit: d21b6f1 GitHub URL: https://github.com/SCST-project/scst/commit/d21b6f1457f189e119b5824874f69800884b3d00 Author: Gleb Chesnokov Date: 2025-05-14T18:36:46+03:00 Log Message: ----------- scst: Port to Linux kernel v6.15 Support for the following changes in the Linux kernel v6.15: - 8fa7292fee5c ("treewide: Switch/rename to timer_delete[_sync]()") Modified Paths: -------------- iscsi-scst/kernel/conn.c | 4 +- iscsi-scst/kernel/isert-scst/isert_login.c | 2 +- qla2x00t-32gbit/qla_edif.c | 4 +- qla2x00t-32gbit/qla_init.c | 2 +- qla2x00t-32gbit/qla_iocb.c | 4 +- qla2x00t-32gbit/qla_mid.c | 2 +- qla2x00t-32gbit/qla_os.c | 2 +- qla2x00t/qla_init.c | 2 +- qla2x00t/qla_mid.c | 2 +- qla2x00t/qla_os.c | 2 +- scst/include/backport.h | 41 +++++++++++++++ scst/src/scst_lib.c | 4 +- scst/src/scst_main.c | 2 +- 13 files changed, 57 insertions(+), 16 deletions(-) =================================================================== diff --git a/iscsi-scst/kernel/conn.c b/iscsi-scst/kernel/conn.c index fdeffc9..2cb385d 100644 --- a/iscsi-scst/kernel/conn.c +++ b/iscsi-scst/kernel/conn.c @@ -555,7 +555,7 @@ static void conn_rsp_timer_fn(struct timer_list *timer) * * Since we have not empty write_timeout_list, we are * safe to restart the timer, because we not race with - * del_timer_sync() in conn_free(). + * timer_delete_sync() in conn_free(). */ mod_timer(&conn->rsp_timer, timeout_time); } @@ -792,7 +792,7 @@ void conn_free(struct iscsi_conn *conn) lockdep_assert_held(&conn->target->target_mutex); - del_timer_sync(&conn->rsp_timer); + timer_delete_sync(&conn->rsp_timer); conn_sysfs_del(conn); diff --git a/iscsi-scst/kernel/isert-scst/isert_login.c b/iscsi-scst/kernel/isert-scst/isert_login.c index 859f6a0..33965c0 100644 --- a/iscsi-scst/kernel/isert-scst/isert_login.c +++ b/iscsi-scst/kernel/isert-scst/isert_login.c @@ -89,7 +89,7 @@ void isert_del_timer(struct isert_conn_dev *dev) { if (dev->timer_active) { dev->timer_active = 0; - del_timer_sync(&dev->tmo_timer); + timer_delete_sync(&dev->tmo_timer); } } diff --git a/qla2x00t-32gbit/qla_edif.c b/qla2x00t-32gbit/qla_edif.c index 1ce6c82..a91440b 100644 --- a/qla2x00t-32gbit/qla_edif.c +++ b/qla2x00t-32gbit/qla_edif.c @@ -416,7 +416,7 @@ static void __qla2x00_release_all_sadb(struct scsi_qla_host *vha, */ if (edif_entry->delete_sa_index != INVALID_EDIF_SA_INDEX) { - del_timer(&edif_entry->timer); + timer_delete(&edif_entry->timer); /* build and send the aen */ fcport->edif.rx_sa_set = 1; @@ -2844,7 +2844,7 @@ qla28xx_sa_update_iocb_entry(scsi_qla_host_t *v, struct req_que *req, "%s: removing edif_entry %p, new sa_index: 0x%x\n", __func__, edif_entry, pkt->sa_index); qla_edif_list_delete_sa_index(sp->fcport, edif_entry); - del_timer(&edif_entry->timer); + timer_delete(&edif_entry->timer); ql_dbg(ql_dbg_edif, vha, 0x5033, "%s: releasing edif_entry %p, new sa_index: 0x%x\n", diff --git a/qla2x00t-32gbit/qla_init.c b/qla2x00t-32gbit/qla_init.c index e6b616a..13484b0 100644 --- a/qla2x00t-32gbit/qla_init.c +++ b/qla2x00t-32gbit/qla_init.c @@ -67,7 +67,7 @@ void qla2x00_sp_free(srb_t *sp) { struct srb_iocb *iocb = &sp->u.iocb_cmd; - del_timer(&iocb->timer); + timer_delete(&iocb->timer); qla2x00_rel_sp(sp); } diff --git a/qla2x00t-32gbit/qla_iocb.c b/qla2x00t-32gbit/qla_iocb.c index 85c3b9a..2ce8e73 100644 --- a/qla2x00t-32gbit/qla_iocb.c +++ b/qla2x00t-32gbit/qla_iocb.c @@ -2588,7 +2588,7 @@ qla24xx_tm_iocb(srb_t *sp, struct tsk_mgmt_entry *tsk) static void qla2x00_async_done(struct srb *sp, int res) { - if (del_timer(&sp->u.iocb_cmd.timer)) { + if (timer_delete(&sp->u.iocb_cmd.timer)) { /* * Successfully cancelled the timeout handler * ref: TMR @@ -2661,7 +2661,7 @@ static void qla2x00_els_dcmd_sp_free(srb_t *sp) elsio->u.els_logo.els_logo_pyld, elsio->u.els_logo.els_logo_pyld_dma); - del_timer(&elsio->timer); + timer_delete(&elsio->timer); qla2x00_rel_sp(sp); } diff --git a/qla2x00t-32gbit/qla_mid.c b/qla2x00t-32gbit/qla_mid.c index 79879c4..8b71ac0 100644 --- a/qla2x00t-32gbit/qla_mid.c +++ b/qla2x00t-32gbit/qla_mid.c @@ -20,7 +20,7 @@ void qla2x00_vp_stop_timer(scsi_qla_host_t *vha) { if (vha->vp_idx && vha->timer_active) { - del_timer_sync(&vha->timer); + timer_delete_sync(&vha->timer); vha->timer_active = 0; } } diff --git a/qla2x00t-32gbit/qla_os.c b/qla2x00t-32gbit/qla_os.c index 9dbb5b3..37417ee 100644 --- a/qla2x00t-32gbit/qla_os.c +++ b/qla2x00t-32gbit/qla_os.c @@ -441,7 +441,7 @@ qla2x00_restart_timer(scsi_qla_host_t *vha, unsigned long interval) static __inline__ void qla2x00_stop_timer(scsi_qla_host_t *vha) { - del_timer_sync(&vha->timer); + timer_delete_sync(&vha->timer); vha->timer_active = 0; } diff --git a/qla2x00t/qla_init.c b/qla2x00t/qla_init.c index d4fbecc..bc6edb1 100644 --- a/qla2x00t/qla_init.c +++ b/qla2x00t/qla_init.c @@ -72,7 +72,7 @@ qla2x00_sp_free(void *data, void *ptr) struct srb_iocb *iocb = &sp->u.iocb_cmd; struct scsi_qla_host *vha = (scsi_qla_host_t *)data; - del_timer(&iocb->timer); + timer_delete(&iocb->timer); mempool_free(sp, vha->hw->srb_mempool); QLA_VHA_MARK_NOT_BUSY(vha); diff --git a/qla2x00t/qla_mid.c b/qla2x00t/qla_mid.c index 24e3d3f..9efeef9 100644 --- a/qla2x00t/qla_mid.c +++ b/qla2x00t/qla_mid.c @@ -26,7 +26,7 @@ void qla2x00_vp_stop_timer(scsi_qla_host_t *vha) { if (vha->vp_idx && vha->timer_active) { - del_timer_sync(&vha->timer); + timer_delete_sync(&vha->timer); vha->timer_active = 0; } } diff --git a/qla2x00t/qla_os.c b/qla2x00t/qla_os.c index 2bb5718..c3e2d37 100644 --- a/qla2x00t/qla_os.c +++ b/qla2x00t/qla_os.c @@ -350,7 +350,7 @@ qla2x00_restart_timer(scsi_qla_host_t *vha, unsigned long interval) static __inline__ void qla2x00_stop_timer(scsi_qla_host_t *vha) { - del_timer_sync(&vha->timer); + timer_delete_sync(&vha->timer); vha->timer_active = 0; } diff --git a/scst/include/backport.h b/scst/include/backport.h index e9d978d..27a9bbd 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -1577,6 +1577,47 @@ struct t10_pi_tuple { /* <linux/timer.h> */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0) && \ + (LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(4, 19, 0) >> 8 || \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 312)) && \ + (LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(5, 4, 0) >> 8 || \ + LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 274)) && \ + (LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(5, 10, 0) >> 8 || \ + LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 215)) && \ + (LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(5, 15, 0) >> 8 || \ + LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 154)) && \ + (LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(6, 1, 0) >> 8 || \ + LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 84)) && \ + (!defined(UEK_KABI_RENAME) || \ + LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 17)) +/* + * See also commit 9b13df3fb64e ("timers: Rename del_timer_sync() to + * timer_delete_sync()") # v6.2. + * See also commit 48a8a5393960 # v4.19.312. + * See also commit df4209170b6c # v5.4.274. + * See also commit d8166e8adb7f # v5.10.215. + * See also commit 2382f2e45c71 # v5.15.154. + * See also commit 113d5341ee12 # v6.1.84. + */ +static inline int timer_delete_sync(struct timer_list *timer) +{ + return del_timer_sync(timer); +} +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0) && \ + (LINUX_VERSION_CODE >> 8 != KERNEL_VERSION(6, 1, 0) >> 8 || \ + LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 91)) +/* + * See also commit bb663f0f3c39 ("timers: Rename del_timer() to timer_delete()") # v6.2. + * See also commit b086d1e82fcd # v6.1.91. + */ +static inline int timer_delete(struct timer_list *timer) +{ + return del_timer(timer); +} +#endif + /* * See also commit 686fef928bba ("timer: Prepare to change timer callback * argument type") # v4.14. See also commit 0eeda71bc30d ("timer: Replace diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 91404cf..1cf5e93 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -15850,7 +15850,7 @@ static void tm_dbg_deinit_tgt_dev(struct scst_tgt_dev *tgt_dev) unsigned long flags; TRACE_MGMT_DBG("Deinit TM debugging tgt_dev %p", tgt_dev); - del_timer_sync(&tm_dbg_timer); + timer_delete_sync(&tm_dbg_timer); spin_lock_irqsave(&scst_tm_dbg_lock, flags); tm_dbg_tgt_dev = NULL; spin_unlock_irqrestore(&scst_tm_dbg_lock, flags); @@ -15969,7 +15969,7 @@ static void tm_dbg_change_state(unsigned long *flags) TRACE_MGMT_DBG("%s", "Deleting timer"); spin_unlock_irqrestore(&scst_tm_dbg_lock, *flags); - del_timer_sync(&tm_dbg_timer); + timer_delete_sync(&tm_dbg_timer); spin_lock_irqsave(&scst_tm_dbg_lock, *flags); return; } diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 3ebf2d6..4d494ef 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -567,7 +567,7 @@ void scst_unregister_target(struct scst_tgt *tgt) list_del(&tgt->tgt_list_entry); mutex_unlock(&scst_mutex2); - del_timer_sync(&tgt->retry_timer); + timer_delete_sync(&tgt->retry_timer); scst_tg_tgt_remove_by_tgt(tgt); |
From: Gleb C. <lna...@ya...> - 2025-05-14 10:51:30
|
Commit: cc1e66a GitHub URL: https://github.com/SCST-project/scst/commit/cc1e66a0e1e03f784a0f6a1eb1fdb66d10278bb1 Author: Gleb Chesnokov Date: 2025-05-14T13:49:18+03:00 Log Message: ----------- qla2x00t-32gbit: Mark device strings as nonstring In preparation for memtostr*() checking that its source is marked as nonstring, annotate the device strings accordingly. Reviewed-by: Martin K. Petersen <mar...@or...> # SCSI Signed-off-by: Kees Cook <ke...@ke...> [ commit 88a157a3204d upstream ] Modified Paths: -------------- qla2x00t-32gbit/qla_mr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) =================================================================== diff --git a/qla2x00t-32gbit/qla_mr.h b/qla2x00t-32gbit/qla_mr.h index 4f63aff..3a2bd95 100644 --- a/qla2x00t-32gbit/qla_mr.h +++ b/qla2x00t-32gbit/qla_mr.h @@ -282,8 +282,8 @@ struct register_host_info { #define QLAFX00_TGT_NODE_LIST_SIZE (sizeof(uint32_t) * 32) struct config_info_data { - uint8_t model_num[16]; - uint8_t model_description[80]; + uint8_t model_num[16] __nonstring; + uint8_t model_description[80] __nonstring; uint8_t reserved0[160]; uint8_t symbolic_name[64]; uint8_t serial_num[32]; |
From: Gleb C. <lna...@ya...> - 2025-05-14 10:49:55
|
Commit: b9f56d6 GitHub URL: https://github.com/SCST-project/scst/commit/b9f56d6d161121204491fd965a0cc512b5ada3c5 Author: Gleb Chesnokov Date: 2025-05-14T13:49:18+03:00 Log Message: ----------- qla2x00t-32gbit: Fix typos in a comment Fix typos in a comment. hapens -> happens recommeds -> recommends Signed-off-by: Yuichiro Tsuji <yui...@am...> Link: https://lore.kernel.org/r/202...@am... Signed-off-by: Martin K. Petersen <mar...@or...> [ commit 0107fb8686b2 upstream ] Modified Paths: -------------- qla2x00t-32gbit/qla_sup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) =================================================================== diff --git a/qla2x00t-32gbit/qla_sup.c b/qla2x00t-32gbit/qla_sup.c index 6d16546..9e7a407 100644 --- a/qla2x00t-32gbit/qla_sup.c +++ b/qla2x00t-32gbit/qla_sup.c @@ -2136,8 +2136,8 @@ qla2x00_write_flash_byte(struct qla_hw_data *ha, uint32_t addr, uint8_t data) * @flash_id: Flash ID * * This function polls the device until bit 7 of what is read matches data - * bit 7 or until data bit 5 becomes a 1. If that hapens, the flash ROM timed - * out (a fatal error). The flash book recommeds reading bit 7 again after + * bit 7 or until data bit 5 becomes a 1. If that happens, the flash ROM timed + * out (a fatal error). The flash book recommends reading bit 7 again after * reading bit 5 as a 1. * * Returns 0 on success, else non-zero. |