diff options
author | Dr. Tilmann Bubeck <t.bubeck@reinform.de> | 2013-04-08 12:54:05 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-04-08 12:54:05 -0400 |
commit | 393d1d1d76933886d5e1ce603214c9987589c6d5 (patch) | |
tree | 2f2368a9d787ccb8e69f61a3e5023ef9c4abfd8b /Documentation/filesystems | |
parent | f78ee70db40040e6f38a5134527d4760254d6683 (diff) |
ext4: implementation of a new ioctl called EXT4_IOC_SWAP_BOOT
Add a new ioctl, EXT4_IOC_SWAP_BOOT which swaps i_blocks and
associated attributes (like i_blocks, i_size, i_flags, ...) from the
specified inode with inode EXT4_BOOT_LOADER_INO (#5). This is
typically used to store a boot loader in a secure part of the
filesystem, where it can't be changed by a normal user by accident.
The data blocks of the previous boot loader will be associated with
the given inode.
This usercode program is a simple example of the usage:
int main(int argc, char *argv[])
{
int fd;
int err;
if ( argc != 2 ) {
printf("usage: ext4-swap-boot-inode FILE-TO-SWAP\n");
exit(1);
}
fd = open(argv[1], O_WRONLY);
if ( fd < 0 ) {
perror("open");
exit(1);
}
err = ioctl(fd, EXT4_IOC_SWAP_BOOT);
if ( err < 0 ) {
perror("ioctl");
exit(1);
}
close(fd);
exit(0);
}
[ Modified by Theodore Ts'o to fix a number of bugs in the original code.]
Signed-off-by: Dr. Tilmann Bubeck <t.bubeck@reinform.de>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'Documentation/filesystems')
-rw-r--r-- | Documentation/filesystems/ext4.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt index 34ea4f1fa6ea..5dd957d8b25b 100644 --- a/Documentation/filesystems/ext4.txt +++ b/Documentation/filesystems/ext4.txt | |||
@@ -587,6 +587,16 @@ Table of Ext4 specific ioctls | |||
587 | bitmaps and inode table, the userspace tool thus | 587 | bitmaps and inode table, the userspace tool thus |
588 | just passes the new number of blocks. | 588 | just passes the new number of blocks. |
589 | 589 | ||
590 | EXT4_IOC_SWAP_BOOT Swap i_blocks and associated attributes | ||
591 | (like i_blocks, i_size, i_flags, ...) from | ||
592 | the specified inode with inode | ||
593 | EXT4_BOOT_LOADER_INO (#5). This is typically | ||
594 | used to store a boot loader in a secure part of | ||
595 | the filesystem, where it can't be changed by a | ||
596 | normal user by accident. | ||
597 | The data blocks of the previous boot loader | ||
598 | will be associated with the given inode. | ||
599 | |||
590 | .............................................................................. | 600 | .............................................................................. |
591 | 601 | ||
592 | References | 602 | References |