X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Flinux.c;h=ab4d709e4be2c305d82ca31568fd4c458f742ffc;hb=5445c8890aaa7168040ab7fa27c6535c43cd523d;hp=a5feb59fca0e3f76589338b46b95893729e369d0;hpb=7a6ce89226586e19195bc7236bc888bd77992394;p=monky diff --git a/src/linux.c b/src/linux.c index a5feb59..ab4d709 100644 --- a/src/linux.c +++ b/src/linux.c @@ -2337,7 +2337,10 @@ const char *get_disk_protect_queue(const char *disk) char path[128]; int state; - snprintf(path, 127, "/sys/block/%s/queue/protect", disk); + snprintf(path, 127, "/sys/block/%s/device/unload_heads", disk); + if (access(path, F_OK)) { + snprintf(path, 127, "/sys/block/%s/queue/protect", disk); + } if ((fp = fopen(path, "r")) == NULL) return "n/a "; if (fscanf(fp, "%d\n", &state) != 1) { @@ -2345,6 +2348,6 @@ const char *get_disk_protect_queue(const char *disk) return "failed"; } fclose(fp); - return state ? "frozen" : "free "; + return (state > 0) ? "frozen" : "free "; }