system/corennnnn
Révision | 735b60ebc2c293688d89bd311494ce8f61ba6475 (tree) |
---|---|
l'heure | 2009-05-19 03:17:40 |
Auteur | San Mehat <san@goog...> |
Commiter | The Android Open Source Project |
am 7edc4f94: vold: If a filesystem is read/only then restart the fscheck but don\'t make any changes
Merge commit '7edc4f9454f1665b73faf0c02543cf350b741a53'
* commit '7edc4f9454f1665b73faf0c02543cf350b741a53':
@@ -39,6 +39,7 @@ int vfat_identify(blkdev_t *dev) | ||
39 | 39 | int vfat_check(blkdev_t *dev) |
40 | 40 | { |
41 | 41 | int rc; |
42 | + boolean rw = true; | |
42 | 43 | |
43 | 44 | #if VFAT_DEBUG |
44 | 45 | LOG_VOL("vfat_check(%d:%d):", dev->major, dev->minor); |
@@ -50,47 +51,51 @@ int vfat_check(blkdev_t *dev) | ||
50 | 51 | return 0; |
51 | 52 | } |
52 | 53 | |
53 | -#ifdef VERIFY_PASS | |
54 | - char *args[7]; | |
55 | - args[0] = FSCK_MSDOS_PATH; | |
56 | - args[1] = "-v"; | |
57 | - args[2] = "-V"; | |
58 | - args[3] = "-w"; | |
59 | - args[4] = "-p"; | |
60 | - args[5] = blkdev_get_devpath(dev); | |
61 | - args[6] = NULL; | |
62 | - rc = logwrap(6, args); | |
63 | - free(args[5]); | |
64 | -#else | |
65 | - char *args[6]; | |
66 | - args[0] = FSCK_MSDOS_PATH; | |
67 | - args[1] = "-v"; | |
68 | - args[2] = "-w"; | |
69 | - args[3] = "-p"; | |
70 | - args[4] = blkdev_get_devpath(dev); | |
71 | - args[5] = NULL; | |
72 | - rc = logwrap(5, args); | |
73 | - free(args[4]); | |
74 | -#endif | |
54 | + do { | |
55 | + | |
56 | + char *args[6]; | |
57 | + args[0] = FSCK_MSDOS_PATH; | |
58 | + args[1] = "-v"; | |
59 | + | |
60 | + if (rw) { | |
61 | + args[2] = "-w"; | |
62 | + args[3] = "-p"; | |
63 | + args[4] = blkdev_get_devpath(dev); | |
64 | + args[5] = NULL; | |
65 | + rc = logwrap(5, args); | |
66 | + free(args[4]); | |
67 | + } else { | |
68 | + args[2] = "-n"; | |
69 | + args[3] = blkdev_get_devpath(dev); | |
70 | + args[4] = NULL; | |
71 | + rc = logwrap(4, args); | |
72 | + free(args[3]); | |
73 | + } | |
74 | + | |
75 | + if (rc == 0) { | |
76 | + LOG_VOL("Filesystem check completed OK"); | |
77 | + return 0; | |
78 | + } else if (rc == 1) { | |
79 | + LOG_VOL("Filesystem check failed (general failure)"); | |
80 | + return -EINVAL; | |
81 | + } else if (rc == 2) { | |
82 | + LOG_VOL("Filesystem check failed (invalid usage)"); | |
83 | + return -EIO; | |
84 | + } else if (rc == 4) { | |
85 | + LOG_VOL("Filesystem check completed (errors fixed)"); | |
86 | + } else if (rc == 6) { | |
87 | + LOG_VOL("Filesystem read-only - retrying check RO"); | |
88 | + rw = false; | |
89 | + continue; | |
90 | + } else if (rc == 8) { | |
91 | + LOG_VOL("Filesystem check failed (not a FAT filesystem)"); | |
92 | + return -ENODATA; | |
93 | + } else { | |
94 | + LOG_VOL("Filesystem check failed (unknown exit code %d)", rc); | |
95 | + return -EIO; | |
96 | + } | |
97 | + } while (0); | |
75 | 98 | |
76 | - if (rc == 0) { | |
77 | - LOG_VOL("Filesystem check completed OK"); | |
78 | - return 0; | |
79 | - } else if (rc == 1) { | |
80 | - LOG_VOL("Filesystem check failed (general failure)"); | |
81 | - return -EINVAL; | |
82 | - } else if (rc == 2) { | |
83 | - LOG_VOL("Filesystem check failed (invalid usage)"); | |
84 | - return -EIO; | |
85 | - } else if (rc == 4) { | |
86 | - LOG_VOL("Filesystem check completed (errors fixed)"); | |
87 | - } else if (rc == 8) { | |
88 | - LOG_VOL("Filesystem check failed (not a FAT filesystem)"); | |
89 | - return -ENODATA; | |
90 | - } else { | |
91 | - LOG_VOL("Filesystem check failed (unknown exit code %d)", rc); | |
92 | - return -EIO; | |
93 | - } | |
94 | 99 | return 0; |
95 | 100 | } |
96 | 101 |