[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 10:48:20 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;
AIUI the values in that file are always 0 or 1 to begin with, because this is just a simple boolean: is it rotational or not?
--
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_r381215043
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20200219/0419083f/attachment.html>
More information about the Rpm-maint
mailing list