request do_kill_file, "Deallocate an inode and its blocks",
kill_file;
+request do_copy_inode, "Copy the inode structure",
+ copy_inode;
+
request do_clri, "Clear an inode's contents",
clri;
Clear the contents of the inode
.IR filespec .
.TP
+.BI copy_inode " source_inode destination_inode"
+Copy the conents of the inode structure in
+.I source_inode
+and use it to overwrite the inode structure at
+.IR destination_inode .
+.TP
.BI dirsearch " filespec filename"
Search the directory
.I filespec
unlink_file_by_name(argv[1]);
}
+
+void do_copy_inode(int argc, char *argv[])
+{
+ ext2_ino_t src_ino, dest_ino;
+ struct ext2_inode inode;
+ unsigned char buf[4096];
+ int retval;
+
+ if (common_args_process(argc, argv, 3, 3, "copy_inode",
+ "<source file> <dest_name>", CHECK_FS_RW))
+ return;
+
+ src_ino = string_to_inode(argv[1]);
+ if (!src_ino)
+ return;
+
+ dest_ino = string_to_inode(argv[2]);
+ if (!dest_ino)
+ return;
+
+ if (debugfs_read_inode_full(src_ino, (struct ext2_inode *) buf,
+ argv[0], sizeof(buf)))
+ return;
+
+ if (debugfs_write_inode_full(dest_ino, (struct ext2_inode *) buf,
+ argv[0], sizeof(buf)))
+ return;
+}
+
#endif /* READ_ONLY */
void do_find_free_block(int argc, char *argv[])