diff options
| author | 2008-08-31 18:43:29 +0200 | |
|---|---|---|
| committer | 2008-08-31 19:33:19 +0200 | |
| commit | 5dc380594ad755dd5a9d2cad246e5dcb5480350d (patch) | |
| tree | c90811184619c86f920872e9eb84f35604735779 | |
| parent | 8333ca944cc56b4da1ab418c0b890f96f5135210 (diff) | |
| download | libimobiledevice-5dc380594ad755dd5a9d2cad246e5dcb5480350d.tar.gz libimobiledevice-5dc380594ad755dd5a9d2cad246e5dcb5480350d.tar.bz2 | |
prefix public enum with IPHONE_
| -rw-r--r-- | include/libiphone/libiphone.h | 26 | ||||
| -rw-r--r-- | src/AFC.c | 2 | ||||
| -rw-r--r-- | src/ifuse.c | 10 | ||||
| -rw-r--r-- | src/main.c | 6 |
4 files changed, 22 insertions, 22 deletions
diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index 249b9b3..2e66b5d 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h | |||
| @@ -48,18 +48,18 @@ extern "C" { | |||
| 48 | //afc specific error | 48 | //afc specific error |
| 49 | #define IPHONE_E_NO_SUCH_FILE -12 | 49 | #define IPHONE_E_NO_SUCH_FILE -12 |
| 50 | 50 | ||
| 51 | typedef short iphone_error_t; | 51 | typedef int16_t iphone_error_t; |
| 52 | 52 | ||
| 53 | enum { | 53 | typedef enum { |
| 54 | AFC_FILE_READ = 0x00000002, // seems to be able to read and write files | 54 | IPHONE_AFC_FILE_READ = 0x00000002, // seems to be able to read and write files |
| 55 | AFC_FILE_WRITE = 0x00000003, // writes and creates a file, blanks it out, etc. | 55 | IPHONE_AFC_FILE_WRITE = 0x00000003, // writes and creates a file, blanks it out, etc. |
| 56 | AFC_FILE_RW = 0x00000005, // seems to do the same as 2. Might even create the file. | 56 | IPHONE_AFC_FILE_RW = 0x00000005, // seems to do the same as 2. Might even create the file. |
| 57 | AFC_FILE_OP4 = 0x00000004, // no idea -- appears to be "write" -- clears file beforehand like 3 | 57 | IPHONE_AFC_FILE_OP4 = 0x00000004, // no idea -- appears to be "write" -- clears file beforehand like 3 |
| 58 | AFC_FILE_OP6 = 0x00000006, // no idea yet -- appears to be the same as 5. | 58 | IPHONE_AFC_FILE_OP6 = 0x00000006, // no idea yet -- appears to be the same as 5. |
| 59 | AFC_FILE_OP1 = 0x00000001, // no idea juuust yet... probably read. | 59 | IPHONE_AFC_FILE_OP1 = 0x00000001, // no idea juuust yet... probably read. |
| 60 | AFC_FILE_OP0 = 0x00000000, | 60 | IPHONE_AFC_FILE_OP0 = 0x00000000, |
| 61 | AFC_FILE_OP10 = 0x0000000a | 61 | IPHONE_AFC_FILE_OP10 = 0x0000000a |
| 62 | }; | 62 | } iphone_afc_file_mode_t; |
| 63 | 63 | ||
| 64 | struct iphone_device_int; | 64 | struct iphone_device_int; |
| 65 | typedef struct iphone_device_int *iphone_device_t; | 65 | typedef struct iphone_device_int *iphone_device_t; |
| @@ -106,7 +106,7 @@ iphone_error_t iphone_afc_get_devinfo ( iphone_afc_client_t client, char ***info | |||
| 106 | iphone_error_t iphone_afc_get_dir_list ( iphone_afc_client_t client, const char *dir, char ***list); | 106 | iphone_error_t iphone_afc_get_dir_list ( iphone_afc_client_t client, const char *dir, char ***list); |
| 107 | 107 | ||
| 108 | iphone_error_t iphone_afc_get_file_attr ( iphone_afc_client_t client, const char *filename, struct stat *stbuf ); | 108 | iphone_error_t iphone_afc_get_file_attr ( iphone_afc_client_t client, const char *filename, struct stat *stbuf ); |
| 109 | iphone_error_t iphone_afc_open_file ( iphone_afc_client_t client, const char *filename, uint32_t file_mode, iphone_afc_file_t *file ); | 109 | iphone_error_t iphone_afc_open_file ( iphone_afc_client_t client, const char *filename, iphone_afc_file_mode_t file_mode, iphone_afc_file_t *file ); |
| 110 | iphone_error_t iphone_afc_close_file ( iphone_afc_client_t client, iphone_afc_file_t file); | 110 | iphone_error_t iphone_afc_close_file ( iphone_afc_client_t client, iphone_afc_file_t file); |
| 111 | iphone_error_t iphone_afc_read_file ( iphone_afc_client_t client, iphone_afc_file_t file, char *data, int length, uint32_t *bytes); | 111 | iphone_error_t iphone_afc_read_file ( iphone_afc_client_t client, iphone_afc_file_t file, char *data, int length, uint32_t *bytes); |
| 112 | iphone_error_t iphone_afc_write_file ( iphone_afc_client_t client, iphone_afc_file_t file, const char *data, int length, uint32_t *bytes); | 112 | iphone_error_t iphone_afc_write_file ( iphone_afc_client_t client, iphone_afc_file_t file, const char *data, int length, uint32_t *bytes); |
| @@ -625,7 +625,7 @@ iphone_error_t iphone_afc_get_file_attr ( iphone_afc_client_t client, const char | |||
| 625 | * received by afc_get_file_info) as well as the handle to the file or | 625 | * received by afc_get_file_info) as well as the handle to the file or |
| 626 | * NULL in the case of failure. | 626 | * NULL in the case of failure. |
| 627 | */ | 627 | */ |
| 628 | iphone_error_t iphone_afc_open_file ( iphone_afc_client_t client, const char *filename, uint32_t file_mode, iphone_afc_file_t *file ) { | 628 | iphone_error_t iphone_afc_open_file ( iphone_afc_client_t client, const char *filename, iphone_afc_file_mode_t file_mode, iphone_afc_file_t *file ) { |
| 629 | iphone_afc_file_t file_loc = NULL; | 629 | iphone_afc_file_t file_loc = NULL; |
| 630 | uint32 ag = 0; | 630 | uint32 ag = 0; |
| 631 | int bytes = 0, length = 0; | 631 | int bytes = 0, length = 0; |
diff --git a/src/ifuse.c b/src/ifuse.c index 6d2bae0..353188e 100644 --- a/src/ifuse.c +++ b/src/ifuse.c | |||
| @@ -76,7 +76,7 @@ static int ifuse_create(const char *path, mode_t mode, struct fuse_file_info *fi | |||
| 76 | iphone_afc_file_t file; | 76 | iphone_afc_file_t file; |
| 77 | iphone_afc_client_t afc = fuse_get_context()->private_data; | 77 | iphone_afc_client_t afc = fuse_get_context()->private_data; |
| 78 | 78 | ||
| 79 | iphone_afc_open_file(afc, path, AFC_FILE_WRITE, &file); | 79 | iphone_afc_open_file(afc, path, IPHONE_AFC_FILE_WRITE, &file); |
| 80 | fh_index++; | 80 | fh_index++; |
| 81 | fi->fh = fh_index; | 81 | fi->fh = fh_index; |
| 82 | g_hash_table_insert(file_handles, &fh_index, file); | 82 | g_hash_table_insert(file_handles, &fh_index, file); |
| @@ -89,11 +89,11 @@ static int ifuse_open(const char *path, struct fuse_file_info *fi) { | |||
| 89 | uint32_t mode = 0; | 89 | uint32_t mode = 0; |
| 90 | 90 | ||
| 91 | if ((fi->flags & 3) == O_RDWR || (fi->flags & 3) == O_WRONLY) { | 91 | if ((fi->flags & 3) == O_RDWR || (fi->flags & 3) == O_WRONLY) { |
| 92 | mode = AFC_FILE_READ; | 92 | mode = IPHONE_AFC_FILE_READ; |
| 93 | } else if ((fi->flags & 3) == O_RDONLY) { | 93 | } else if ((fi->flags & 3) == O_RDONLY) { |
| 94 | mode = AFC_FILE_READ; | 94 | mode = IPHONE_AFC_FILE_READ; |
| 95 | } else { | 95 | } else { |
| 96 | mode = AFC_FILE_READ; | 96 | mode = IPHONE_AFC_FILE_READ; |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | iphone_afc_open_file(afc, path, mode, &file); | 99 | iphone_afc_open_file(afc, path, mode, &file); |
| @@ -235,7 +235,7 @@ int ifuse_truncate(const char *path, off_t size) { | |||
| 235 | int result = 0; | 235 | int result = 0; |
| 236 | iphone_afc_client_t afc = fuse_get_context()->private_data; | 236 | iphone_afc_client_t afc = fuse_get_context()->private_data; |
| 237 | iphone_afc_file_t tfile = NULL; | 237 | iphone_afc_file_t tfile = NULL; |
| 238 | iphone_afc_open_file(afc, path, AFC_FILE_READ, &tfile); | 238 | iphone_afc_open_file(afc, path, IPHONE_AFC_FILE_READ, &tfile); |
| 239 | if (!tfile) return -1; | 239 | if (!tfile) return -1; |
| 240 | 240 | ||
| 241 | result = iphone_afc_truncate_file(afc, tfile, size); | 241 | result = iphone_afc_truncate_file(afc, tfile, size); |
| @@ -87,7 +87,7 @@ int main(int argc, char *argv[]) { | |||
| 87 | iphone_afc_file_t my_file = NULL; | 87 | iphone_afc_file_t my_file = NULL; |
| 88 | struct stat stbuf; | 88 | struct stat stbuf; |
| 89 | iphone_afc_get_file_attr ( afc, "/iTunesOnTheGoPlaylist.plist", &stbuf ); | 89 | iphone_afc_get_file_attr ( afc, "/iTunesOnTheGoPlaylist.plist", &stbuf ); |
| 90 | if (IPHONE_E_SUCCESS == iphone_afc_open_file(afc, "/iTunesOnTheGoPlaylist.plist", AFC_FILE_READ, &my_file) && my_file) { | 90 | if (IPHONE_E_SUCCESS == iphone_afc_open_file(afc, "/iTunesOnTheGoPlaylist.plist", IPHONE_AFC_FILE_READ, &my_file) && my_file) { |
| 91 | printf("A file size: %i\n", stbuf.st_size); | 91 | printf("A file size: %i\n", stbuf.st_size); |
| 92 | char *file_data = (char*)malloc(sizeof(char) * stbuf.st_size); | 92 | char *file_data = (char*)malloc(sizeof(char) * stbuf.st_size); |
| 93 | iphone_afc_read_file(afc, my_file, file_data, stbuf.st_size, &bytes); | 93 | iphone_afc_read_file(afc, my_file, file_data, stbuf.st_size, &bytes); |
| @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) { | |||
| 100 | free(file_data); | 100 | free(file_data); |
| 101 | } else printf("couldn't open a file\n"); | 101 | } else printf("couldn't open a file\n"); |
| 102 | 102 | ||
| 103 | iphone_afc_open_file(afc, "/readme.libiphone.fx", AFC_FILE_WRITE, &my_file); | 103 | iphone_afc_open_file(afc, "/readme.libiphone.fx", IPHONE_AFC_FILE_WRITE, &my_file); |
| 104 | if (my_file) { | 104 | if (my_file) { |
| 105 | char *outdatafile = strdup("this is a bitchin text file\n"); | 105 | char *outdatafile = strdup("this is a bitchin text file\n"); |
| 106 | iphone_afc_write_file(afc, my_file, outdatafile, strlen(outdatafile), &bytes); | 106 | iphone_afc_write_file(afc, my_file, outdatafile, strlen(outdatafile), &bytes); |
| @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) { | |||
| 120 | else printf("Failure. (expected unless you have a /renme file on your phone)\n"); | 120 | else printf("Failure. (expected unless you have a /renme file on your phone)\n"); |
| 121 | 121 | ||
| 122 | printf("Seek & read\n"); | 122 | printf("Seek & read\n"); |
| 123 | iphone_afc_open_file(afc, "/readme.libiphone.fx", AFC_FILE_READ, &my_file); | 123 | iphone_afc_open_file(afc, "/readme.libiphone.fx", IPHONE_AFC_FILE_READ, &my_file); |
| 124 | if (IPHONE_E_SUCCESS != iphone_afc_seek_file(afc, my_file, 5)) printf("WARN: SEEK DID NOT WORK\n"); | 124 | if (IPHONE_E_SUCCESS != iphone_afc_seek_file(afc, my_file, 5)) printf("WARN: SEEK DID NOT WORK\n"); |
| 125 | char *threeletterword = (char*)malloc(sizeof(char) * 5); | 125 | char *threeletterword = (char*)malloc(sizeof(char) * 5); |
| 126 | iphone_afc_read_file(afc, my_file, threeletterword, 3, &bytes); | 126 | iphone_afc_read_file(afc, my_file, threeletterword, 3, &bytes); |
