mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-22 15:56:35 +08:00
dosfs: Add sync_device option for msdos_format()
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user