forked from Imagelibrary/rtems
2011-02-17 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libblock/include/rtems/bdpart.h (rtems_bdpart_format): Preserve previous API. * libblock/src/bdpart-create.c, libblock/src/bdpart-read.c, libblock/src/bdpart-write.c: Reflect changes above. * libmisc/shell/fdisk.c: Reflect changes above.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2011-02-17 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* libblock/include/rtems/bdpart.h (rtems_bdpart_format):
|
||||
Preserve previous API.
|
||||
* libblock/src/bdpart-create.c, libblock/src/bdpart-read.c,
|
||||
libblock/src/bdpart-write.c: Reflect changes above.
|
||||
* libmisc/shell/fdisk.c: Reflect changes above.
|
||||
|
||||
2011-02-17 Sebastian Huber <sebastian.huber@embedded-brains.de>
|
||||
|
||||
* libcsupport/src/rtems_heap_extend.c: New file.
|
||||
|
||||
@@ -163,41 +163,44 @@ typedef enum {
|
||||
/**
|
||||
* Disk format description.
|
||||
*/
|
||||
typedef struct {
|
||||
typedef union {
|
||||
/**
|
||||
* Format type.
|
||||
*/
|
||||
rtems_bdpart_format_type type;
|
||||
union {
|
||||
/**
|
||||
* MBR format fields.
|
||||
*/
|
||||
struct {
|
||||
/**
|
||||
* Disk ID in MBR at offset 440.
|
||||
*/
|
||||
uint32_t disk_id;
|
||||
|
||||
/**
|
||||
* This option is used for partition table creation and validation checks
|
||||
* before a write to the disk. It ensures that the first primary
|
||||
* partition and the logical partitions start at head one and sector one
|
||||
* under the virtual one head and 63 sectors geometry. Each begin and
|
||||
* end of a partition will be aligned to the virtual cylinder boundary.
|
||||
*/
|
||||
bool dos_compatibility;
|
||||
} mbr;
|
||||
/**
|
||||
* MBR format fields.
|
||||
*/
|
||||
struct {
|
||||
rtems_bdpart_format_type type;
|
||||
|
||||
/**
|
||||
* GPT format fields.
|
||||
* Disk ID in MBR at offset 440.
|
||||
*/
|
||||
struct {
|
||||
/**
|
||||
* Disk ID in GPT header.
|
||||
*/
|
||||
uuid_t disk_id;
|
||||
} gpt;
|
||||
} u;
|
||||
uint32_t disk_id;
|
||||
|
||||
/**
|
||||
* This option is used for partition table creation and validation checks
|
||||
* before a write to the disk. It ensures that the first primary
|
||||
* partition and the logical partitions start at head one and sector one
|
||||
* under the virtual one head and 63 sectors geometry. Each begin and
|
||||
* end of a partition will be aligned to the virtual cylinder boundary.
|
||||
*/
|
||||
bool dos_compatibility;
|
||||
} mbr;
|
||||
|
||||
/**
|
||||
* GPT format fields.
|
||||
*/
|
||||
struct {
|
||||
rtems_bdpart_format_type type;
|
||||
|
||||
/**
|
||||
* Disk ID in GPT header.
|
||||
*/
|
||||
uuid_t disk_id;
|
||||
} gpt;
|
||||
} rtems_bdpart_format;
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,7 +37,7 @@ rtems_status_code rtems_bdpart_create(
|
||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||
bool dos_compatibility = format != NULL
|
||||
&& format->type == RTEMS_BDPART_FORMAT_MBR
|
||||
&& format->u.mbr.dos_compatibility;
|
||||
&& format->mbr.dos_compatibility;
|
||||
rtems_blkdev_bnum disk_end = 0;
|
||||
rtems_blkdev_bnum pos = 0;
|
||||
rtems_blkdev_bnum dist_sum = 0;
|
||||
|
||||
@@ -261,10 +261,10 @@ rtems_status_code rtems_bdpart_read(
|
||||
|
||||
/* Set format */
|
||||
format->type = RTEMS_BDPART_FORMAT_MBR;
|
||||
format->u.mbr.disk_id = rtems_uint32_from_little_endian(
|
||||
format->mbr.disk_id = rtems_uint32_from_little_endian(
|
||||
block->buffer + RTEMS_BDPART_MBR_OFFSET_DISK_ID
|
||||
);
|
||||
format->u.mbr.dos_compatibility = true;
|
||||
format->mbr.dos_compatibility = true;
|
||||
|
||||
/* Iterate through the rest of the primary partition table */
|
||||
for (i = 1; i < 4; ++i) {
|
||||
|
||||
@@ -94,7 +94,7 @@ rtems_status_code rtems_bdpart_write(
|
||||
rtems_status_code esc = RTEMS_SUCCESSFUL;
|
||||
bool dos_compatibility = format != NULL
|
||||
&& format->type == RTEMS_BDPART_FORMAT_MBR
|
||||
&& format->u.mbr.dos_compatibility;
|
||||
&& format->mbr.dos_compatibility;
|
||||
rtems_bdbuf_buffer *block = NULL;
|
||||
rtems_blkdev_bnum disk_end = 0;
|
||||
rtems_blkdev_bnum record_space =
|
||||
@@ -219,7 +219,7 @@ rtems_status_code rtems_bdpart_write(
|
||||
|
||||
/* Write disk ID */
|
||||
rtems_uint32_to_little_endian(
|
||||
format->u.mbr.disk_id,
|
||||
format->mbr.disk_id,
|
||||
block->buffer + RTEMS_BDPART_MBR_OFFSET_DISK_ID
|
||||
);
|
||||
|
||||
|
||||
@@ -132,8 +132,8 @@ static int rtems_bdpart_shell_main( int argc, char **argv)
|
||||
|
||||
/* Default format */
|
||||
format.type = RTEMS_BDPART_FORMAT_MBR;
|
||||
format.u.mbr.disk_id = 0;
|
||||
format.u.mbr.dos_compatibility = true;
|
||||
format.mbr.disk_id = 0;
|
||||
format.mbr.dos_compatibility = true;
|
||||
|
||||
for (ai = 2; ai < argc; ++ai) {
|
||||
char *s = argv [ai];
|
||||
@@ -194,9 +194,9 @@ static int rtems_bdpart_shell_main( int argc, char **argv)
|
||||
break;
|
||||
case RTEMS_BDPART_SHELL_MBR:
|
||||
if (strcmp( s, "dos") == 0) {
|
||||
format.u.mbr.dos_compatibility = true;
|
||||
format.mbr.dos_compatibility = true;
|
||||
} else if (strcmp( s, "nodos") == 0) {
|
||||
format.u.mbr.dos_compatibility = false;
|
||||
format.mbr.dos_compatibility = false;
|
||||
} else {
|
||||
RTEMS_BDPART_SHELL_ERROR( "unexpected option: %s", argv [ai]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user