#if ENABLE_FEATURE_HDPARM_GET_IDENTITY
static const char cfg_str[] ALIGN1 =
- """\0" "HardSect""\0" "SoftSect""\0" "NotMFM""\0"
- "HdSw>15uSec""\0" "SpinMotCtl""\0" "Fixed""\0" "Removeable""\0"
- "DTR<=5Mbs""\0" "DTR>5Mbs""\0" "DTR>10Mbs""\0" "RotSpdTol>.5%""\0"
- "dStbOff""\0" "TrkOff""\0" "FmtGapReq""\0" "nonMagnetic"
+ """\0" "HardSect""\0" "SoftSect""\0" "NotMFM""\0"
+ "HdSw>15uSec""\0" "SpinMotCtl""\0" "Fixed""\0" "Removeable""\0"
+ "DTR<=5Mbs""\0" "DTR>5Mbs""\0" "DTR>10Mbs""\0" "RotSpdTol>.5%""\0"
+ "dStbOff""\0" "TrkOff""\0" "FmtGapReq""\0" "nonMagnetic"
;
static const char BuffType[] ALIGN1 =
/* for ELF executables, notes are pushed before environment and args */
static ptrdiff_t find_elf_note(ptrdiff_t findme)
{
- ptrdiff_t *ep = (ptrdiff_t *) environ;
-
- while (*ep++);
- while (*ep) {
- if (ep[0] == findme) {
- return ep[1];
- }
- ep += 2;
- }
- return -1;
+ ptrdiff_t *ep = (ptrdiff_t *) environ;
+
+ while (*ep++);
+ while (*ep) {
+ if (ep[0] == findme) {
+ return ep[1];
+ }
+ ep += 2;
+ }
+ return -1;
}
#if ENABLE_FEATURE_PS_UNUSUAL_SYSTEMS
static unsigned get_HZ_by_waiting(void)
{
- struct timeval tv1, tv2;
- unsigned t1, t2, r, hz;
- unsigned cnt = cnt; /* for compiler */
- int diff;
-
- r = 0;
-
- /* Wait for times() to reach new tick */
- t1 = times(NULL);
- do {
- t2 = times(NULL);
- } while (t2 == t1);
- gettimeofday(&tv2, NULL);
-
- do {
- t1 = t2;
- tv1.tv_usec = tv2.tv_usec;
-
- /* Wait exactly one times() tick */
- do {
- t2 = times(NULL);
- } while (t2 == t1);
- gettimeofday(&tv2, NULL);
-
- /* Calculate ticks per sec, rounding up to even */
- diff = tv2.tv_usec - tv1.tv_usec;
- if (diff <= 0) diff += 1000000;
- hz = 1000000u / (unsigned)diff;
- hz = (hz+1) & ~1;
+ struct timeval tv1, tv2;
+ unsigned t1, t2, r, hz;
+ unsigned cnt = cnt; /* for compiler */
+ int diff;
+
+ r = 0;
+
+ /* Wait for times() to reach new tick */
+ t1 = times(NULL);
+ do {
+ t2 = times(NULL);
+ } while (t2 == t1);
+ gettimeofday(&tv2, NULL);
+
+ do {
+ t1 = t2;
+ tv1.tv_usec = tv2.tv_usec;
+
+ /* Wait exactly one times() tick */
+ do {
+ t2 = times(NULL);
+ } while (t2 == t1);
+ gettimeofday(&tv2, NULL);
+
+ /* Calculate ticks per sec, rounding up to even */
+ diff = tv2.tv_usec - tv1.tv_usec;
+ if (diff <= 0) diff += 1000000;
+ hz = 1000000u / (unsigned)diff;
+ hz = (hz+1) & ~1;
/* Count how many same hz values we saw */
- if (r != hz) {
- r = hz;
- cnt = 0;
- }
- cnt++;
- } while (cnt < 3); /* exit if saw 3 same values */
-
- return r;
+ if (r != hz) {
+ r = hz;
+ cnt = 0;
+ }
+ cnt++;
+ } while (cnt < 3); /* exit if saw 3 same values */
+
+ return r;
}
#else
static inline unsigned get_HZ_by_waiting(void)
char buf5[5];
/* see http://en.wikipedia.org/wiki/Tera */
- smart_ulltoa4( (u, buf5, " mgtpezy");
+ smart_ulltoa4(u, buf5, " mgtpezy");
buf5[5] = '\0';
sprintf(buf, "%.*s", size, buf5);
}