Package init
This commit is contained in:
commit
cb9f2c9d20
47
0000-hdparm-9.43-ditch_dead_code.patch
Normal file
47
0000-hdparm-9.43-ditch_dead_code.patch
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
Index: hdparm-9.43/sgio.c
|
||||||
|
===================================================================
|
||||||
|
--- hdparm-9.43.orig/sgio.c
|
||||||
|
+++ hdparm-9.43/sgio.c
|
||||||
|
@@ -17,6 +17,10 @@
|
||||||
|
|
||||||
|
#include <linux/hdreg.h>
|
||||||
|
|
||||||
|
+#ifndef DEMAND_SENSE_DATA
|
||||||
|
+ #define DEMAND_SENSE_DATA 0
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
extern int verbose;
|
||||||
|
extern int prefer_ata12;
|
||||||
|
|
||||||
|
@@ -193,7 +197,7 @@ int sg16 (int fd, int rw, int dma, struc
|
||||||
|
unsigned char cdb[SG_ATA_16_LEN];
|
||||||
|
unsigned char sb[32], *desc;
|
||||||
|
struct scsi_sg_io_hdr io_hdr;
|
||||||
|
- int prefer12 = prefer_ata12, demanded_sense = 0;
|
||||||
|
+ int prefer12 = prefer_ata12;
|
||||||
|
|
||||||
|
if (tf->command == ATA_OP_PIDENTIFY)
|
||||||
|
prefer12 = 0;
|
||||||
|
@@ -302,14 +306,16 @@ int sg16 (int fd, int rw, int dma, struc
|
||||||
|
|
||||||
|
desc = sb + 8;
|
||||||
|
if (io_hdr.driver_status != SG_DRIVER_SENSE) {
|
||||||
|
- if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) {
|
||||||
|
- static int second_try = 0;
|
||||||
|
- if (!second_try++)
|
||||||
|
+ static int second_try = 0;
|
||||||
|
+ if (!second_try++) {
|
||||||
|
+ if (sb[0] | sb[1] | sb[2] | sb[3] | sb[4] | sb[5] | sb[6] | sb[7] | sb[8] | sb[9]) {
|
||||||
|
fprintf(stderr, "SG_IO: questionable sense data, results may be incorrect\n");
|
||||||
|
- } else if (demanded_sense) {
|
||||||
|
- static int second_try = 0;
|
||||||
|
- if (!second_try++)
|
||||||
|
+ }
|
||||||
|
+#if DEMAND_SENSE_DATA
|
||||||
|
+ else {
|
||||||
|
fprintf(stderr, "SG_IO: missing sense data, results may be incorrect\n");
|
||||||
|
+ }
|
||||||
|
+#endif
|
||||||
|
}
|
||||||
|
} else if (sb[0] != 0x72 || sb[7] < 14 || desc[0] != 0x09 || desc[1] < 0x0c) {
|
||||||
|
dump_bytes("SG_IO: bad/missing sense data, sb[]", sb, sizeof(sb));
|
||||||
12
0001-hdparm-9.43-close_fd.patch
Normal file
12
0001-hdparm-9.43-close_fd.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
Index: hdparm-9.43/fallocate.c
|
||||||
|
===================================================================
|
||||||
|
--- hdparm-9.43.orig/fallocate.c
|
||||||
|
+++ hdparm-9.43/fallocate.c
|
||||||
|
@@ -41,6 +41,7 @@ int do_fallocate_syscall (const char *pa
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
err = errno;
|
||||||
|
+ close(fd);
|
||||||
|
unlink(path);
|
||||||
|
}
|
||||||
|
perror(path);
|
||||||
13
0002-hdparm-9.43-get_geom.patch
Normal file
13
0002-hdparm-9.43-get_geom.patch
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
Index: hdparm-9.43/geom.c
|
||||||
|
===================================================================
|
||||||
|
--- hdparm-9.43.orig/geom.c
|
||||||
|
+++ hdparm-9.43/geom.c
|
||||||
|
@@ -201,7 +201,7 @@ int get_dev_geometry (int fd, __u32 *cyl
|
||||||
|
__u64 hs = (*heads) * (*sects);
|
||||||
|
__u64 cyl = (*cyls);
|
||||||
|
__u64 chs = cyl * hs;
|
||||||
|
- if (chs < (*nsectors))
|
||||||
|
+ if (chs < (*nsectors) && hs)
|
||||||
|
*cyls = (*nsectors) / hs;
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
hdparm-9.56.tar.gz
Normal file
BIN
hdparm-9.56.tar.gz
Normal file
Binary file not shown.
55
hdparm.spec
Normal file
55
hdparm.spec
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
Name: hdparm
|
||||||
|
Version: 9.56
|
||||||
|
Release: 3
|
||||||
|
Summary: A system utility for setting or showing hard drive parameters
|
||||||
|
License: BSD
|
||||||
|
URL: https://sourceforge.net/projects/%{name}/
|
||||||
|
Source: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
|
||||||
|
Patch0000: 0000-hdparm-9.43-ditch_dead_code.patch
|
||||||
|
Patch0001: 0001-hdparm-9.43-close_fd.patch
|
||||||
|
Patch0002: 0002-hdparm-9.43-get_geom.patch
|
||||||
|
|
||||||
|
BuildRequires: gcc git
|
||||||
|
|
||||||
|
%description
|
||||||
|
hdparm - get/set ATA/SATA drive parameters under Linux.
|
||||||
|
|
||||||
|
%package help
|
||||||
|
Summary: Include man page for hdparm utility
|
||||||
|
Requires: man
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
%description help
|
||||||
|
This package contains the man page for hdparm.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -n %{name}-%{version} -S git -p1
|
||||||
|
|
||||||
|
%build
|
||||||
|
CFLAGS="$RPM_OPT_FLAGS" %make_build STRIP=/bin/true LDFLAGS="$RPM_LD_FLAGS"
|
||||||
|
|
||||||
|
%install
|
||||||
|
mkdir -p $RPM_BUILD_ROOT/sbin
|
||||||
|
install -c -m 755 hdparm $RPM_BUILD_ROOT/sbin/hdparm
|
||||||
|
|
||||||
|
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man8
|
||||||
|
install -c -m 644 hdparm.8 $RPM_BUILD_ROOT/%{_mandir}/man8
|
||||||
|
|
||||||
|
%files
|
||||||
|
%doc README.acoustic
|
||||||
|
%license LICENSE.TXT
|
||||||
|
/sbin/hdparm
|
||||||
|
|
||||||
|
%files help
|
||||||
|
%{_mandir}/man8/hdparm.8*
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Fri Aug 30 2019 louhongxiang <louhongxiang@huawei.com> - 9.56-3
|
||||||
|
- Type:enhancemnet
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESCi:openEuler Debranding
|
||||||
|
|
||||||
|
* Wed Aug 21 2019 wubo <wubo40@huawei.com> - 9.56-2
|
||||||
|
- Package init and change patch name
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user