* Changed the way the BFS_IOCTL_UPDATE_BOOT_BLOCK ioctl works; it's a bit
more flexible to use now. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28053 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2007, Axel Dörfler, [email protected]
|
* Copyright 2001-2008, Axel Dörfler, [email protected]
|
||||||
* This file may be used under the terms of the MIT License.
|
* This file may be used under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef BFS_CONTROL_H
|
#ifndef BFS_CONTROL_H
|
||||||
@@ -8,7 +8,11 @@
|
|||||||
//! additional functionality exported via ioctl()
|
//! additional functionality exported via ioctl()
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef BFS_SHELL
|
||||||
# include "system_dependencies.h"
|
# include "system_dependencies.h"
|
||||||
|
#else
|
||||||
|
# include <SupportDefs.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* ioctl to check the version of BFS used - parameter is a uint32 *
|
/* ioctl to check the version of BFS used - parameter is a uint32 *
|
||||||
@@ -18,6 +22,12 @@
|
|||||||
|
|
||||||
#define BFS_IOCTL_UPDATE_BOOT_BLOCK 14204
|
#define BFS_IOCTL_UPDATE_BOOT_BLOCK 14204
|
||||||
|
|
||||||
|
struct update_boot_block {
|
||||||
|
uint32 offset;
|
||||||
|
const uint8* data;
|
||||||
|
uint32 length;
|
||||||
|
};
|
||||||
|
|
||||||
/* ioctls to use the "chkbfs" feature from the outside
|
/* ioctls to use the "chkbfs" feature from the outside
|
||||||
* all calls use a struct check_result as single parameter
|
* all calls use a struct check_result as single parameter
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -624,9 +624,16 @@ bfs_ioctl(fs_volume* _volume, fs_vnode* _node, void* _cookie, ulong cmd,
|
|||||||
{
|
{
|
||||||
// let's makebootable (or anyone else) update the boot block
|
// let's makebootable (or anyone else) update the boot block
|
||||||
// while BFS is mounted
|
// while BFS is mounted
|
||||||
if (user_memcpy(&volume->SuperBlock().pad_to_block,
|
update_boot_block update;
|
||||||
(uint8*)buffer + offsetof(disk_super_block, pad_to_block),
|
if (bufferLength != sizeof(update_boot_block))
|
||||||
sizeof(volume->SuperBlock().pad_to_block)) < B_OK)
|
return B_BAD_VALUE;
|
||||||
|
if (user_memcpy(&update, buffer, sizeof(update_boot_block)) != B_OK)
|
||||||
|
return B_BAD_ADDRESS;
|
||||||
|
if (update.offset < offsetof(disk_super_block, pad_to_block)
|
||||||
|
|| update.length + update.offset > 512)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
if (user_memcpy((uint8*)&volume->SuperBlock() + update.offset,
|
||||||
|
update.data, update.length) != B_OK)
|
||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
|
|
||||||
return volume->WriteSuperBlock();
|
return volume->WriteSuperBlock();
|
||||||
|
|||||||
Reference in New Issue
Block a user