[Rpm-maint] [rpm-software-management/rpm] Auto-enable optimizations for non-rotational disks on Linux (#949)
Panu Matilainen
notifications at github.com
Wed Feb 19 11:11:29 UTC 2020
pmatilai commented on this pull request.
> @@ -109,6 +121,27 @@ static char *getMntPoint(const char *dirName, dev_t dev)
return res;
}
+static int getRotational(const char *dirName, dev_t dev)
+{
+ int rotational = 1; /* Be a good pessimist, assume the worst */
+#if defined(__linux__)
+ char *devpath = NULL;
+ FILE *f = NULL;
+
+ rasprintf(&devpath, "/sys/dev/block/%d:%d/queue/rotational",
+ major(dev), minor(dev));
+ if ((f = fopen(devpath, "r")) != NULL) {
+ int v;
+ if (fscanf(f, "%d", &v) == 1)
+ rotational = v;
I don't mind being nitpicked at all, it's a fair point. Fixed now to only consider value of '1' as rotational, because -1 to me sounds like a "I dunno" value.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/949#discussion_r381226545
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20200219/46eb5f5b/attachment.html>
More information about the Rpm-maint
mailing list