dosfs: Add sync_device option for msdos_format()

This commit is contained in:
Sebastian Huber
2012-12-13 11:38:53 +01:00
parent 60e8cd430e
commit 4b8e01f7c5
3 changed files with 16 additions and 1 deletions
+5
View File
@@ -94,6 +94,11 @@ typedef struct {
*/
bool skip_alignment;
/**
* @brief Synchronize device after write operations.
*/
bool sync_device;
/**
* @brief The amount of info to output.
*/
+5
View File
@@ -1251,6 +1251,11 @@ int msdos_format
tmp_sec);
}
}
if (ret_val == 0 && rqdata != NULL && rqdata->sync_device) {
ret_val = rtems_disk_fd_sync(fd);
}
/*
* cleanup:
* sync and unlock disk
+6 -1
View File
@@ -89,6 +89,11 @@ static void check_file_size(const char *file, off_t size)
static void test(const char *rda, const char *mnt, const char *file)
{
static const msdos_format_request_param_t rqdata = {
.quick_format = true,
.sync_device = true
};
rtems_status_code sc;
int disk_fd;
int rv;
@@ -99,7 +104,7 @@ static void test(const char *rda, const char *mnt, const char *file)
disk_fd = open(rda, O_RDWR);
rtems_test_assert(disk_fd >= 0);
rv = msdos_format(rda, NULL);
rv = msdos_format(rda, &rqdata);
rtems_test_assert(rv == 0);
rv = mount_and_make_target_path(