Koushik Dutta | 68df48c | 2010-09-13 15:04:54 -0700 | [diff] [blame] | 1 | #include <ctype.h> |
| 2 | #include <errno.h> |
| 3 | #include <fcntl.h> |
| 4 | #include <getopt.h> |
| 5 | #include <limits.h> |
| 6 | #include <linux/input.h> |
| 7 | #include <stdio.h> |
| 8 | #include <stdlib.h> |
| 9 | #include <string.h> |
| 10 | #include <sys/reboot.h> |
| 11 | #include <sys/types.h> |
| 12 | #include <time.h> |
| 13 | #include <unistd.h> |
| 14 | |
| 15 | #include <sys/wait.h> |
| 16 | #include <sys/limits.h> |
| 17 | #include <dirent.h> |
| 18 | #include <sys/stat.h> |
| 19 | |
| 20 | #include <signal.h> |
| 21 | #include <sys/wait.h> |
| 22 | |
| 23 | int |
| 24 | __system(const char *command); |
| 25 | |
Koushik Dutta | e5c7e0e | 2010-11-11 01:19:10 -0800 | [diff] [blame^] | 26 | int restore_raw_partition(const char *partition, const char *filename) |
| 27 | { |
Koushik Dutta | 68df48c | 2010-09-13 15:04:54 -0700 | [diff] [blame] | 28 | char tmp[PATH_MAX]; |
Koushik Dutta | e5c7e0e | 2010-11-11 01:19:10 -0800 | [diff] [blame^] | 29 | sprintf("dd if=%s of=/dev/block/bml7 bs=4096", filename); |
Koushik Dutta | 68df48c | 2010-09-13 15:04:54 -0700 | [diff] [blame] | 30 | return __system(tmp); |
| 31 | } |
Koushik Dutta | 56c1b3b | 2010-09-13 15:08:49 -0700 | [diff] [blame] | 32 | |
Koushik Dutta | e5c7e0e | 2010-11-11 01:19:10 -0800 | [diff] [blame^] | 33 | int backup_raw_partition(const char *partition, const char *filename) |
| 34 | { |
Koushik Dutta | 56c1b3b | 2010-09-13 15:08:49 -0700 | [diff] [blame] | 35 | char tmp[PATH_MAX]; |
Koushik Dutta | e5c7e0e | 2010-11-11 01:19:10 -0800 | [diff] [blame^] | 36 | sprintf("dd of=%s if=/dev/block/bml7 bs=4096", filename); |
Koushik Dutta | 56c1b3b | 2010-09-13 15:08:49 -0700 | [diff] [blame] | 37 | return __system(tmp); |
| 38 | } |
Koushik Dutta | e5c7e0e | 2010-11-11 01:19:10 -0800 | [diff] [blame^] | 39 | |
| 40 | int erase_raw_partition(const char *partition) |
| 41 | { |
| 42 | // TODO: implement raw wipe |
| 43 | return 0; |
| 44 | } |
| 45 | |
| 46 | int erase_partition(const char *partition, const char *filesystem) |
| 47 | { |
| 48 | return -1; |
| 49 | } |
| 50 | |
| 51 | int mount_partition(const char *partition, const char *mount_point, const char *filesystem, int read_only) |
| 52 | { |
| 53 | return -1; |
| 54 | } |
| 55 | |
| 56 | int get_partition_device(const char *partition, char *device) |
| 57 | { |
| 58 | return -1; |
| 59 | } |