diff options
author | Rob Landley <rob@landley.net> | 2006-04-29 15:49:18 +0000 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-04-29 15:49:18 +0000 |
commit | e5b281f89e90cdd9c646b7208f59a236f82ee936 (patch) | |
tree | e5bef6910c0e588a0f179fe70c8374c33422e181 | |
parent | 2e2d752d490fe8b71bfa398439851a954a1b308e (diff) | |
download | busybox-w32-e5b281f89e90cdd9c646b7208f59a236f82ee936.tar.gz busybox-w32-e5b281f89e90cdd9c646b7208f59a236f82ee936.tar.bz2 busybox-w32-e5b281f89e90cdd9c646b7208f59a236f82ee936.zip |
From Dennis Vlasenko, Make hdparm smaller:
* Use combined no_scsi_no_xt()
* Have common unsigned char args[4] = {WIN_SETFEATURES,0,0,0};
-rw-r--r-- | miscutils/hdparm.c | 122 |
1 files changed, 49 insertions, 73 deletions
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index 80af44511..33f05be0c 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c | |||
@@ -1652,6 +1652,12 @@ static void no_xt (void) | |||
1652 | bb_error_msg_and_die(bb_msg_op_not_supp,"XT"); | 1652 | bb_error_msg_and_die(bb_msg_op_not_supp,"XT"); |
1653 | } | 1653 | } |
1654 | 1654 | ||
1655 | static void no_scsi_no_xt (void) | ||
1656 | { | ||
1657 | no_scsi(); | ||
1658 | no_xt(); | ||
1659 | } | ||
1660 | |||
1655 | static void on_off (unsigned int value) | 1661 | static void on_off (unsigned int value) |
1656 | { | 1662 | { |
1657 | printf(value ? " (on)\n" : " (off)\n"); | 1663 | printf(value ? " (on)\n" : " (off)\n"); |
@@ -1864,6 +1870,8 @@ static void process_dev (char *devname) | |||
1864 | #ifndef HDIO_DRIVE_CMD | 1870 | #ifndef HDIO_DRIVE_CMD |
1865 | int force_operation = 0; | 1871 | int force_operation = 0; |
1866 | #endif | 1872 | #endif |
1873 | unsigned char args[4] = {WIN_SETFEATURES,0,0,0}; | ||
1874 | |||
1867 | xstat(devname,&stat_buf); | 1875 | xstat(devname,&stat_buf); |
1868 | 1876 | ||
1869 | switch(major(stat_buf.st_rdev)) | 1877 | switch(major(stat_buf.st_rdev)) |
@@ -1945,7 +1953,6 @@ static void process_dev (char *devname) | |||
1945 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF | 1953 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF |
1946 | if (scan_hwif) | 1954 | if (scan_hwif) |
1947 | { | 1955 | { |
1948 | int args[3]; | ||
1949 | no_scsi(); | 1956 | no_scsi(); |
1950 | printf(" attempting to scan hwif (0x%x, 0x%x, %u)\n", hwif_data, hwif_ctrl, hwif_irq); | 1957 | printf(" attempting to scan hwif (0x%x, 0x%x, %u)\n", hwif_data, hwif_ctrl, hwif_irq); |
1951 | args[0] = hwif_data; | 1958 | args[0] = hwif_data; |
@@ -1956,8 +1963,7 @@ static void process_dev (char *devname) | |||
1956 | #endif | 1963 | #endif |
1957 | if (set_piomode) | 1964 | if (set_piomode) |
1958 | { | 1965 | { |
1959 | no_scsi(); | 1966 | no_scsi_no_xt(); |
1960 | no_xt(); | ||
1961 | 1967 | ||
1962 | if (noisy_piomode) | 1968 | if (noisy_piomode) |
1963 | { | 1969 | { |
@@ -1975,15 +1981,13 @@ static void process_dev (char *devname) | |||
1975 | } | 1981 | } |
1976 | if (set_io32bit) | 1982 | if (set_io32bit) |
1977 | { | 1983 | { |
1978 | no_scsi(); | 1984 | no_scsi_no_xt(); |
1979 | no_xt(); | ||
1980 | if_printf(get_io32bit," setting 32-bit IO_support flag to %ld\n", io32bit); | 1985 | if_printf(get_io32bit," setting 32-bit IO_support flag to %ld\n", io32bit); |
1981 | bb_ioctl(fd, HDIO_SET_32BIT, (int *)io32bit, "HDIO_SET_32BIT"); | 1986 | bb_ioctl(fd, HDIO_SET_32BIT, (int *)io32bit, "HDIO_SET_32BIT"); |
1982 | } | 1987 | } |
1983 | if (set_mult) | 1988 | if (set_mult) |
1984 | { | 1989 | { |
1985 | no_scsi(); | 1990 | no_scsi_no_xt(); |
1986 | no_xt(); | ||
1987 | if_printf(get_mult, " setting multcount to %ld\n", mult); | 1991 | if_printf(get_mult, " setting multcount to %ld\n", mult); |
1988 | if(ioctl(fd, HDIO_SET_MULTCOUNT, mult)) | 1992 | if(ioctl(fd, HDIO_SET_MULTCOUNT, mult)) |
1989 | bb_perror_msg("HDIO_SET_MULTCOUNT"); | 1993 | bb_perror_msg("HDIO_SET_MULTCOUNT"); |
@@ -1999,8 +2003,7 @@ static void process_dev (char *devname) | |||
1999 | } | 2003 | } |
2000 | if (set_unmask) | 2004 | if (set_unmask) |
2001 | { | 2005 | { |
2002 | no_scsi(); | 2006 | no_scsi_no_xt(); |
2003 | no_xt(); | ||
2004 | if_printf_on_off(get_unmask," setting unmaskirq to %ld", unmask); | 2007 | if_printf_on_off(get_unmask," setting unmaskirq to %ld", unmask); |
2005 | bb_ioctl(fd, HDIO_SET_UNMASKINTR, (int *)unmask, "HDIO_SET_UNMASKINTR"); | 2008 | bb_ioctl(fd, HDIO_SET_UNMASKINTR, (int *)unmask, "HDIO_SET_UNMASKINTR"); |
2006 | } | 2009 | } |
@@ -2020,25 +2023,20 @@ static void process_dev (char *devname) | |||
2020 | } | 2023 | } |
2021 | if (set_nowerr) | 2024 | if (set_nowerr) |
2022 | { | 2025 | { |
2023 | no_scsi(); | 2026 | no_scsi_no_xt(); |
2024 | no_xt(); | ||
2025 | if_printf_on_off(get_nowerr," setting nowerr to %ld", nowerr); | 2027 | if_printf_on_off(get_nowerr," setting nowerr to %ld", nowerr); |
2026 | bb_ioctl(fd, HDIO_SET_NOWERR, (int *)nowerr,"HDIO_SET_NOWERR"); | 2028 | bb_ioctl(fd, HDIO_SET_NOWERR, (int *)nowerr,"HDIO_SET_NOWERR"); |
2027 | } | 2029 | } |
2028 | if (set_keep) | 2030 | if (set_keep) |
2029 | { | 2031 | { |
2030 | no_scsi(); | 2032 | no_scsi_no_xt(); |
2031 | no_xt(); | ||
2032 | if_printf_on_off(get_keep," setting keep_settings to %ld", keep); | 2033 | if_printf_on_off(get_keep," setting keep_settings to %ld", keep); |
2033 | bb_ioctl(fd, HDIO_SET_KEEPSETTINGS, (int *)keep,"HDIO_SET_KEEPSETTINGS"); | 2034 | bb_ioctl(fd, HDIO_SET_KEEPSETTINGS, (int *)keep,"HDIO_SET_KEEPSETTINGS"); |
2034 | } | 2035 | } |
2035 | #ifdef HDIO_DRIVE_CMD | 2036 | #ifdef HDIO_DRIVE_CMD |
2036 | if (set_doorlock) | 2037 | if (set_doorlock) |
2037 | { | 2038 | { |
2038 | unsigned char args[4] = {0,0,0,0}; | 2039 | no_scsi_no_xt(); |
2039 | no_scsi(); | ||
2040 | no_xt(); | ||
2041 | |||
2042 | args[0] = doorlock ? WIN_DOORLOCK : WIN_DOORUNLOCK; | 2040 | args[0] = doorlock ? WIN_DOORLOCK : WIN_DOORUNLOCK; |
2043 | if_printf_on_off(get_doorlock," setting drive doorlock to %ld", doorlock); | 2041 | if_printf_on_off(get_doorlock," setting drive doorlock to %ld", doorlock); |
2044 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args,"HDIO_DRIVE_CMD(doorlock)"); | 2042 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args,"HDIO_DRIVE_CMD(doorlock)"); |
@@ -2046,17 +2044,13 @@ static void process_dev (char *devname) | |||
2046 | if (set_dkeep) | 2044 | if (set_dkeep) |
2047 | { | 2045 | { |
2048 | /* lock/unlock the drive's "feature" settings */ | 2046 | /* lock/unlock the drive's "feature" settings */ |
2049 | unsigned char args[4] = {WIN_SETFEATURES,0,0,0}; | 2047 | no_scsi_no_xt(); |
2050 | no_scsi(); | ||
2051 | no_xt(); | ||
2052 | |||
2053 | if_printf_on_off(get_dkeep," setting drive keep features to %ld", dkeep); | 2048 | if_printf_on_off(get_dkeep," setting drive keep features to %ld", dkeep); |
2054 | args[2] = dkeep ? 0x66 : 0xcc; | 2049 | args[2] = dkeep ? 0x66 : 0xcc; |
2055 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args,"HDIO_DRIVE_CMD(keepsettings)"); | 2050 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args,"HDIO_DRIVE_CMD(keepsettings)"); |
2056 | } | 2051 | } |
2057 | if (set_defects) | 2052 | if (set_defects) |
2058 | { | 2053 | { |
2059 | unsigned char args[4] = {WIN_SETFEATURES,0,0x04,0}; | ||
2060 | no_scsi(); | 2054 | no_scsi(); |
2061 | args[2] = defects ? 0x04 : 0x84; | 2055 | args[2] = defects ? 0x04 : 0x84; |
2062 | if_printf(get_defects," setting drive defect-mgmt to %ld\n", defects); | 2056 | if_printf(get_defects," setting drive defect-mgmt to %ld\n", defects); |
@@ -2064,21 +2058,17 @@ static void process_dev (char *devname) | |||
2064 | } | 2058 | } |
2065 | if (set_prefetch) | 2059 | if (set_prefetch) |
2066 | { | 2060 | { |
2067 | unsigned char args[4] = {WIN_SETFEATURES,0,0xab,0}; | 2061 | no_scsi_no_xt(); |
2068 | no_scsi(); | ||
2069 | no_xt(); | ||
2070 | |||
2071 | args[1] = prefetch; | 2062 | args[1] = prefetch; |
2063 | args[2] = 0xab; | ||
2072 | if_printf(get_prefetch," setting drive prefetch to %ld\n", prefetch); | 2064 | if_printf(get_prefetch," setting drive prefetch to %ld\n", prefetch); |
2073 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(setprefetch)"); | 2065 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(setprefetch)"); |
2074 | } | 2066 | } |
2075 | if (set_xfermode) | 2067 | if (set_xfermode) |
2076 | { | 2068 | { |
2077 | unsigned char args[4] = {WIN_SETFEATURES,0,3,0}; | 2069 | no_scsi_no_xt(); |
2078 | no_scsi(); | ||
2079 | no_xt(); | ||
2080 | |||
2081 | args[1] = xfermode_requested; | 2070 | args[1] = xfermode_requested; |
2071 | args[2] = 3; | ||
2082 | if (get_xfermode) | 2072 | if (get_xfermode) |
2083 | { | 2073 | { |
2084 | printf(" setting xfermode to %d", xfermode_requested); | 2074 | printf(" setting xfermode to %d", xfermode_requested); |
@@ -2088,17 +2078,13 @@ static void process_dev (char *devname) | |||
2088 | } | 2078 | } |
2089 | if (set_lookahead) | 2079 | if (set_lookahead) |
2090 | { | 2080 | { |
2091 | unsigned char args[4] = {WIN_SETFEATURES,0,0,0}; | 2081 | no_scsi_no_xt(); |
2092 | no_scsi(); | ||
2093 | no_xt(); | ||
2094 | |||
2095 | args[2] = lookahead ? 0xaa : 0x55; | 2082 | args[2] = lookahead ? 0xaa : 0x55; |
2096 | if_printf_on_off(get_lookahead," setting drive read-lookahead to %ld", lookahead); | 2083 | if_printf_on_off(get_lookahead," setting drive read-lookahead to %ld", lookahead); |
2097 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(setreadahead)"); | 2084 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(setreadahead)"); |
2098 | } | 2085 | } |
2099 | if (set_apmmode) | 2086 | if (set_apmmode) |
2100 | { | 2087 | { |
2101 | unsigned char args[4] = {WIN_SETFEATURES,0,0,0}; | ||
2102 | no_scsi(); | 2088 | no_scsi(); |
2103 | apmmode=check_if_min_and_set_val(apmmode,1); | 2089 | apmmode=check_if_min_and_set_val(apmmode,1); |
2104 | apmmode=check_if_maj_and_set_val(apmmode,255); | 2090 | apmmode=check_if_maj_and_set_val(apmmode,255); |
@@ -2124,11 +2110,9 @@ static void process_dev (char *devname) | |||
2124 | #ifndef WIN_FLUSHCACHE | 2110 | #ifndef WIN_FLUSHCACHE |
2125 | #define WIN_FLUSHCACHE 0xe7 | 2111 | #define WIN_FLUSHCACHE 0xe7 |
2126 | #endif | 2112 | #endif |
2127 | unsigned char flushcache[4] = {WIN_FLUSHCACHE,0,0,0}; | 2113 | static unsigned char flushcache[4] = {WIN_FLUSHCACHE,0,0,0}; |
2128 | #endif /* DO_FLUSHCACHE */ | 2114 | #endif /* DO_FLUSHCACHE */ |
2129 | unsigned char args[4] = {WIN_SETFEATURES,0,0,0}; | 2115 | no_scsi_no_xt(); |
2130 | no_scsi(); | ||
2131 | no_xt(); | ||
2132 | args[2] = wcache ? 0x02 : 0x82; | 2116 | args[2] = wcache ? 0x02 : 0x82; |
2133 | if_printf_on_off(get_wcache," setting drive write-caching to %ld", wcache); | 2117 | if_printf_on_off(get_wcache," setting drive write-caching to %ld", wcache); |
2134 | #ifdef DO_FLUSHCACHE | 2118 | #ifdef DO_FLUSHCACHE |
@@ -2149,8 +2133,8 @@ static void process_dev (char *devname) | |||
2149 | #ifndef WIN_STANDBYNOW2 | 2133 | #ifndef WIN_STANDBYNOW2 |
2150 | #define WIN_STANDBYNOW2 0x94 | 2134 | #define WIN_STANDBYNOW2 0x94 |
2151 | #endif | 2135 | #endif |
2152 | unsigned char args1[4] = {WIN_STANDBYNOW1,0,0,0}; | 2136 | static unsigned char args1[4] = {WIN_STANDBYNOW1,0,0,0}; |
2153 | unsigned char args2[4] = {WIN_STANDBYNOW2,0,0,0}; | 2137 | static unsigned char args2[4] = {WIN_STANDBYNOW2,0,0,0}; |
2154 | no_scsi(); | 2138 | no_scsi(); |
2155 | if_printf(get_standbynow," issuing standby command\n"); | 2139 | if_printf(get_standbynow," issuing standby command\n"); |
2156 | if (ioctl(fd, HDIO_DRIVE_CMD, &args1) | 2140 | if (ioctl(fd, HDIO_DRIVE_CMD, &args1) |
@@ -2165,8 +2149,8 @@ static void process_dev (char *devname) | |||
2165 | #ifndef WIN_SLEEPNOW2 | 2149 | #ifndef WIN_SLEEPNOW2 |
2166 | #define WIN_SLEEPNOW2 0x99 | 2150 | #define WIN_SLEEPNOW2 0x99 |
2167 | #endif | 2151 | #endif |
2168 | unsigned char args1[4] = {WIN_SLEEPNOW1,0,0,0}; | 2152 | static unsigned char args1[4] = {WIN_SLEEPNOW1,0,0,0}; |
2169 | unsigned char args2[4] = {WIN_SLEEPNOW2,0,0,0}; | 2153 | static unsigned char args2[4] = {WIN_SLEEPNOW2,0,0,0}; |
2170 | no_scsi(); | 2154 | no_scsi(); |
2171 | if_printf(get_sleepnow," issuing sleep command\n"); | 2155 | if_printf(get_sleepnow," issuing sleep command\n"); |
2172 | if (ioctl(fd, HDIO_DRIVE_CMD, &args1) | 2156 | if (ioctl(fd, HDIO_DRIVE_CMD, &args1) |
@@ -2175,17 +2159,16 @@ static void process_dev (char *devname) | |||
2175 | } | 2159 | } |
2176 | if (set_seagate) | 2160 | if (set_seagate) |
2177 | { | 2161 | { |
2178 | unsigned char args[4] = {0xfb,0,0,0}; | 2162 | args[0] = 0xfb; |
2179 | no_scsi(); | 2163 | no_scsi_no_xt(); |
2180 | no_xt(); | ||
2181 | if_printf(get_seagate," disabling Seagate auto powersaving mode\n"); | 2164 | if_printf(get_seagate," disabling Seagate auto powersaving mode\n"); |
2182 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(seagatepwrsave)"); | 2165 | bb_ioctl(fd, HDIO_DRIVE_CMD, &args, "HDIO_DRIVE_CMD(seagatepwrsave)"); |
2183 | } | 2166 | } |
2184 | if (set_standby) | 2167 | if (set_standby) |
2185 | { | 2168 | { |
2186 | unsigned char args[4] = {WIN_SETIDLE1,standby_requested,0,0}; | 2169 | args[0] = WIN_SETIDLE1; |
2187 | no_scsi(); | 2170 | args[1] = standby_requested; |
2188 | no_xt(); | 2171 | no_scsi_no_xt(); |
2189 | if (get_standby) | 2172 | if (get_standby) |
2190 | { | 2173 | { |
2191 | printf(" setting standby to %lu", standby_requested); | 2174 | printf(" setting standby to %lu", standby_requested); |
@@ -2223,8 +2206,7 @@ static void process_dev (char *devname) | |||
2223 | } | 2206 | } |
2224 | if ((verbose && !is_scsi_hd && !is_xt_hd) || get_io32bit) | 2207 | if ((verbose && !is_scsi_hd && !is_xt_hd) || get_io32bit) |
2225 | { | 2208 | { |
2226 | no_scsi(); | 2209 | no_scsi_no_xt(); |
2227 | no_xt(); | ||
2228 | if(ioctl(fd, HDIO_GET_32BIT, &parm)) | 2210 | if(ioctl(fd, HDIO_GET_32BIT, &parm)) |
2229 | bb_perror_msg("HDIO_GET_32BIT"); | 2211 | bb_perror_msg("HDIO_GET_32BIT"); |
2230 | else | 2212 | else |
@@ -2254,8 +2236,7 @@ static void process_dev (char *devname) | |||
2254 | } | 2236 | } |
2255 | if ((verbose && !is_scsi_hd && !is_xt_hd) || get_unmask) | 2237 | if ((verbose && !is_scsi_hd && !is_xt_hd) || get_unmask) |
2256 | { | 2238 | { |
2257 | no_scsi(); | 2239 | no_scsi_no_xt(); |
2258 | no_xt(); | ||
2259 | bb_ioctl_on_off(fd, HDIO_GET_UNMASKINTR,(unsigned long *)parm, | 2240 | bb_ioctl_on_off(fd, HDIO_GET_UNMASKINTR,(unsigned long *)parm, |
2260 | "HDIO_GET_UNMASKINTR"," unmaskirq = %2ld"); | 2241 | "HDIO_GET_UNMASKINTR"," unmaskirq = %2ld"); |
2261 | } | 2242 | } |
@@ -2284,16 +2265,14 @@ static void process_dev (char *devname) | |||
2284 | } | 2265 | } |
2285 | if ((verbose && !is_scsi_hd && !is_xt_hd) || get_keep) | 2266 | if ((verbose && !is_scsi_hd && !is_xt_hd) || get_keep) |
2286 | { | 2267 | { |
2287 | no_scsi(); | 2268 | no_scsi_no_xt(); |
2288 | no_xt(); | ||
2289 | bb_ioctl_on_off (fd, HDIO_GET_KEEPSETTINGS,(unsigned long *)parm, | 2269 | bb_ioctl_on_off (fd, HDIO_GET_KEEPSETTINGS,(unsigned long *)parm, |
2290 | "HDIO_GET_KEEPSETTINGS"," keepsettings = %2ld"); | 2270 | "HDIO_GET_KEEPSETTINGS"," keepsettings = %2ld"); |
2291 | } | 2271 | } |
2292 | 2272 | ||
2293 | if (get_nowerr) | 2273 | if (get_nowerr) |
2294 | { | 2274 | { |
2295 | no_scsi(); | 2275 | no_scsi_no_xt(); |
2296 | no_xt(); | ||
2297 | bb_ioctl_on_off (fd, HDIO_GET_NOWERR,(unsigned long *)&parm, | 2276 | bb_ioctl_on_off (fd, HDIO_GET_NOWERR,(unsigned long *)&parm, |
2298 | " HDIO_GET_NOWERR"," nowerr = %2ld"); | 2277 | " HDIO_GET_NOWERR"," nowerr = %2ld"); |
2299 | } | 2278 | } |
@@ -2335,9 +2314,9 @@ static void process_dev (char *devname) | |||
2335 | #ifndef WIN_CHECKPOWERMODE2 | 2314 | #ifndef WIN_CHECKPOWERMODE2 |
2336 | #define WIN_CHECKPOWERMODE2 0x98 | 2315 | #define WIN_CHECKPOWERMODE2 0x98 |
2337 | #endif | 2316 | #endif |
2338 | unsigned char args[4] = {WIN_CHECKPOWERMODE1,0,0,0}; | ||
2339 | const char *state; | 2317 | const char *state; |
2340 | no_scsi(); | 2318 | no_scsi(); |
2319 | args[0] = WIN_CHECKPOWERMODE1; | ||
2341 | if (ioctl(fd, HDIO_DRIVE_CMD, &args) | 2320 | if (ioctl(fd, HDIO_DRIVE_CMD, &args) |
2342 | && (args[0] = WIN_CHECKPOWERMODE2) /* try again with 0x98 */ | 2321 | && (args[0] = WIN_CHECKPOWERMODE2) /* try again with 0x98 */ |
2343 | && ioctl(fd, HDIO_DRIVE_CMD, &args)) | 2322 | && ioctl(fd, HDIO_DRIVE_CMD, &args)) |
@@ -2356,17 +2335,16 @@ static void process_dev (char *devname) | |||
2356 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET | 2335 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET |
2357 | if (perform_reset) | 2336 | if (perform_reset) |
2358 | { | 2337 | { |
2359 | no_scsi(); | 2338 | no_scsi_no_xt(); |
2360 | no_xt(); | ||
2361 | bb_ioctl(fd, HDIO_DRIVE_RESET, NULL, "HDIO_DRIVE_RESET"); | 2339 | bb_ioctl(fd, HDIO_DRIVE_RESET, NULL, "HDIO_DRIVE_RESET"); |
2362 | } | 2340 | } |
2363 | #endif /* CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET */ | 2341 | #endif /* CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET */ |
2364 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF | 2342 | #ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF |
2365 | if (perform_tristate) | 2343 | if (perform_tristate) |
2366 | { | 2344 | { |
2367 | unsigned char args[4] = {0,tristate,0,0}; | 2345 | args[0] = 0; |
2368 | no_scsi(); | 2346 | args[1] = tristate; |
2369 | no_xt(); | 2347 | no_scsi_no_xt(); |
2370 | bb_ioctl(fd, HDIO_TRISTATE_HWIF, &args, "HDIO_TRISTATE_HWIF"); | 2348 | bb_ioctl(fd, HDIO_TRISTATE_HWIF, &args, "HDIO_TRISTATE_HWIF"); |
2371 | } | 2349 | } |
2372 | #endif /* CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF */ | 2350 | #endif /* CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF */ |
@@ -2375,8 +2353,7 @@ static void process_dev (char *devname) | |||
2375 | { | 2353 | { |
2376 | static struct hd_driveid id; | 2354 | static struct hd_driveid id; |
2377 | 2355 | ||
2378 | no_scsi(); | 2356 | no_scsi_no_xt(); |
2379 | no_xt(); | ||
2380 | 2357 | ||
2381 | if (!ioctl(fd, HDIO_GET_IDENTITY, &id)) | 2358 | if (!ioctl(fd, HDIO_GET_IDENTITY, &id)) |
2382 | { | 2359 | { |
@@ -2397,25 +2374,24 @@ static void process_dev (char *devname) | |||
2397 | 2374 | ||
2398 | if (get_IDentity) | 2375 | if (get_IDentity) |
2399 | { | 2376 | { |
2400 | unsigned char args[4+512] = {WIN_IDENTIFY,0,0,1,}; | 2377 | unsigned char args1[4+512] = {WIN_IDENTIFY,0,0,1,}; |
2401 | unsigned i; | 2378 | unsigned i; |
2402 | 2379 | ||
2403 | no_scsi(); | 2380 | no_scsi_no_xt(); |
2404 | no_xt(); | ||
2405 | 2381 | ||
2406 | if (ioctl(fd, HDIO_DRIVE_CMD, &args)) | 2382 | if (ioctl(fd, HDIO_DRIVE_CMD, &args1)) |
2407 | { | 2383 | { |
2408 | args[0] = WIN_PIDENTIFY; | 2384 | args[0] = WIN_PIDENTIFY; |
2409 | if (ioctl(fd, HDIO_DRIVE_CMD, &args)) | 2385 | if (ioctl(fd, HDIO_DRIVE_CMD, &args1)) |
2410 | { | 2386 | { |
2411 | bb_perror_msg("HDIO_DRIVE_CMD(identify)"); | 2387 | bb_perror_msg("HDIO_DRIVE_CMD(identify)"); |
2412 | goto identify_abort; | 2388 | goto identify_abort; |
2413 | } | 2389 | } |
2414 | } | 2390 | } |
2415 | for(i=0; i<(sizeof args)/2; i+=2) | 2391 | for(i=0; i<(sizeof args1)/2; i+=2) |
2416 | __le16_to_cpus((uint16_t *)(&args[i])); | 2392 | __le16_to_cpus((uint16_t *)(&args1[i])); |
2417 | 2393 | ||
2418 | identify((void *)&args[4], NULL); | 2394 | identify((void *)&args1[4], NULL); |
2419 | identify_abort: | 2395 | identify_abort: |
2420 | /* VOID */; | 2396 | /* VOID */; |
2421 | } | 2397 | } |