diff options
-rw-r--r-- | include/libimobiledevice/afc.h | 28 | ||||
-rw-r--r-- | src/afc.c | 24 |
2 files changed, 27 insertions, 25 deletions
diff --git a/include/libimobiledevice/afc.h b/include/libimobiledevice/afc.h index 2f272e0..a3cde32 100644 --- a/include/libimobiledevice/afc.h +++ b/include/libimobiledevice/afc.h @@ -139,37 +139,39 @@ afc_error_t afc_client_free(afc_client_t client); * and blocksize on the accessed disk partition. * * @param client The client to get device info for. - * @param infos A char ** list of parameters as given by AFC or NULL if there - * was an error. + * @param device_information A char list of device information terminated by an + * empty string or NULL if there was an error. Free with + * afc_dictionary_free(). * * @return AFC_E_SUCCESS on success or an AFC_E_* error value. */ -afc_error_t afc_get_device_info(afc_client_t client, char ***infos); +afc_error_t afc_get_device_info(afc_client_t client, char ***device_information); /** * Gets a directory listing of the directory requested. * * @param client The client to get a directory listing from. - * @param dir The directory to list. (must be a fully-qualified path) - * @param list A char list of files in that directory, terminated by an empty - * string or NULL if there was an error. + * @param path The directory for listing. (must be a fully-qualified path) + * @param directory_information A char list of files in the directory + * terminated by an empty string or NULL if there was an error. Free with + * afc_dictionary_free(). * * @return AFC_E_SUCCESS on success or an AFC_E_* error value. */ -afc_error_t afc_read_directory(afc_client_t client, const char *dir, char ***list); +afc_error_t afc_read_directory(afc_client_t client, const char *path, char ***directory_information); /** * Gets information about a specific file. * * @param client The client to use to get the information of the file. * @param path The fully-qualified path to the file. - * @param infolist Pointer to a buffer that will be filled with a NULL-terminated - * list of strings with the file information. - * Set to NULL before calling this function. + * @param file_information Pointer to a buffer that will be filled with a + * NULL-terminated list of strings with the file information. Set to NULL + * before calling this function. Free with afc_dictionary_free(). * * @return AFC_E_SUCCESS on success or an AFC_E_* error value. */ -afc_error_t afc_get_file_info(afc_client_t client, const char *filename, char ***infolist); +afc_error_t afc_get_file_info(afc_client_t client, const char *filename, char ***file_information); /** * Opens a file on the device. @@ -296,12 +298,12 @@ afc_error_t afc_rename_path(afc_client_t client, const char *from, const char *t * Creates a directory on the device. * * @param client The client to use to make a directory. - * @param dir The directory's path. (must be a fully-qualified path, I assume + * @param path The directory's path. (must be a fully-qualified path, I assume * all other mkdir restrictions apply as well) * * @return AFC_E_SUCCESS on success or an AFC_E_* error value. */ -afc_error_t afc_make_directory(afc_client_t client, const char *dir); +afc_error_t afc_make_directory(afc_client_t client, const char *path); /** * Sets the size of a file on the device without prior opening it. @@ -402,19 +402,19 @@ static char **make_strings_list(char *tokens, uint32_t length) return list; } -afc_error_t afc_read_directory(afc_client_t client, const char *dir, char ***list) +afc_error_t afc_read_directory(afc_client_t client, const char *path, char ***directory_information) { uint32_t bytes = 0; char *data = NULL, **list_loc = NULL; afc_error_t ret = AFC_E_UNKNOWN_ERROR; - if (!client || !dir || !list || (list && *list)) + if (!client || !path || !directory_information || (directory_information && *directory_information)) return AFC_E_INVALID_ARG; afc_lock(client); /* Send the command */ - ret = afc_dispatch_packet(client, AFC_OP_READ_DIR, dir, strlen(dir)+1, NULL, 0, &bytes); + ret = afc_dispatch_packet(client, AFC_OP_READ_DIR, path, strlen(path)+1, NULL, 0, &bytes); if (ret != AFC_E_SUCCESS) { afc_unlock(client); return AFC_E_NOT_ENOUGH_DATA; @@ -433,18 +433,18 @@ afc_error_t afc_read_directory(afc_client_t client, const char *dir, char ***lis free(data); afc_unlock(client); - *list = list_loc; + *directory_information = list_loc; return ret; } -afc_error_t afc_get_device_info(afc_client_t client, char ***infos) +afc_error_t afc_get_device_info(afc_client_t client, char ***device_information) { uint32_t bytes = 0; char *data = NULL, **list = NULL; afc_error_t ret = AFC_E_UNKNOWN_ERROR; - if (!client || !infos) + if (!client || !device_information) return AFC_E_INVALID_ARG; afc_lock(client); @@ -470,7 +470,7 @@ afc_error_t afc_get_device_info(afc_client_t client, char ***infos) afc_unlock(client); - *infos = list; + *device_information = list; return ret; } @@ -559,7 +559,7 @@ afc_error_t afc_rename_path(afc_client_t client, const char *from, const char *t return ret; } -afc_error_t afc_make_directory(afc_client_t client, const char *dir) +afc_error_t afc_make_directory(afc_client_t client, const char *path) { uint32_t bytes = 0; afc_error_t ret = AFC_E_UNKNOWN_ERROR; @@ -570,7 +570,7 @@ afc_error_t afc_make_directory(afc_client_t client, const char *dir) afc_lock(client); /* Send command */ - ret = afc_dispatch_packet(client, AFC_OP_MAKE_DIR, dir, strlen(dir)+1, NULL, 0, &bytes); + ret = afc_dispatch_packet(client, AFC_OP_MAKE_DIR, path, strlen(path)+1, NULL, 0, &bytes); if (ret != AFC_E_SUCCESS) { afc_unlock(client); return AFC_E_NOT_ENOUGH_DATA; @@ -583,13 +583,13 @@ afc_error_t afc_make_directory(afc_client_t client, const char *dir) return ret; } -afc_error_t afc_get_file_info(afc_client_t client, const char *path, char ***infolist) +afc_error_t afc_get_file_info(afc_client_t client, const char *path, char ***file_information) { char *received = NULL; uint32_t bytes = 0; afc_error_t ret = AFC_E_UNKNOWN_ERROR; - if (!client || !path || !infolist) + if (!client || !path || !file_information) return AFC_E_INVALID_ARG; afc_lock(client); @@ -604,7 +604,7 @@ afc_error_t afc_get_file_info(afc_client_t client, const char *path, char ***inf /* Receive data */ ret = afc_receive_data(client, &received, &bytes); if (received) { - *infolist = make_strings_list(received, bytes); + *file_information = make_strings_list(received, bytes); free(received); } |