~chrisccoulson/dpkg/ssd-ionice

« back to all changes in this revision

Viewing changes to utils/start-stop-daemon.c

  • Committer: chrisccoulson at googlemail
  • Date: 2009-01-13 19:34:30 UTC
  • Revision ID: chrisccoulson@googlemail.com-20090113193430-g6u1we9q8di34eao
Allow user to specify no scheduler class,
eg, ':3'. In this case, scheduler class will default to IOPRIO_CLASS_BE.

Other tidy up

Show diffs side-by-side

added added

removed removed

Lines of Context:
1390
1390
        if (ioprio_class_in != NULL) {
1391
1391
                if (strcmp(ioprio_class_in, "real-time") == 0) {
1392
1392
                        ioprio_class = IOPRIO_CLASS_RT;
1393
 
                } else if (strcmp(ioprio_class_in, "best-effort") == 0) {
 
1393
                } else if (strcmp(ioprio_class_in, "best-effort") == 0) || (strcmp(ioprio_class_in, "") == 0) {
1394
1394
                        ioprio_class = IOPRIO_CLASS_BE;
1395
1395
                } else if (strcmp(ioprio_class_in, "idle") == 0) {
1396
1396
                        ioprio_class = IOPRIO_CLASS_IDLE;
1397
1397
                } else {
1398
1398
                        fatal("Unrecognized IO scheduler class %s", ioprio_class_in);
1399
1399
                }
1400
 
                if (ioprio_data_in != NULL)
1401
 
                        ioprio_data = atoi(ioprio_data_in);
1402
 
                if (ioprio_class == IOPRIO_CLASS_IDLE)
1403
 
                        ioprio_data = 7;
 
1400
                switch (ioprio_class) {
 
1401
                        case (IOPRIO_CLASS_IDLE):
 
1402
                                ioprio_data = 7;
 
1403
                                break;
 
1404
                        default:
 
1405
                                if (ioprio_data_in != NULL)
 
1406
                                        ioprio_data = atoi(ioprio_data_in);
 
1407
                }
1404
1408
                ioprio_mask = IOPRIO_PRIO_VALUE(ioprio_class, ioprio_data);
1405
1409
                if (quietmode < 0)
1406
1410
                        printf("IO priority mask %i", ioprio_mask);