mirror of https://github.com/vitalif/e2fsprogs
ChangeLog, e2image.c:
e2image.c (main): Add code to write the e2image header. ChangeLog, e2image.h: e2image.h (struct ext2_image_hdr): Fix type for fs_hostnamebitmap-optimize
parent
6e34328156
commit
c5423c5b3e
|
@ -1,3 +1,7 @@
|
||||||
|
2001-02-08 Theodore Tso <tytso@valinux.com>
|
||||||
|
|
||||||
|
* e2image.h (struct ext2_image_hdr): Fix type for fs_hostname
|
||||||
|
|
||||||
2001-02-07 Theodore Tso <tytso@valinux.com>
|
2001-02-07 Theodore Tso <tytso@valinux.com>
|
||||||
|
|
||||||
* mkjournal.c (ext2fs_create_journal_superblock): Fix the setting
|
* mkjournal.c (ext2fs_create_journal_superblock): Fix the setting
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
struct ext2_image_hdr {
|
struct ext2_image_hdr {
|
||||||
__u32 magic_number; /* This must be EXT2_ET_MAGIC_E2IMAGE */
|
__u32 magic_number; /* This must be EXT2_ET_MAGIC_E2IMAGE */
|
||||||
char magic_descriptor[16]; /* "Ext2 Image 1.0", w/ null padding */
|
char magic_descriptor[16]; /* "Ext2 Image 1.0", w/ null padding */
|
||||||
__u32 fs_hostname[64];/* Hostname of machine of image */
|
char fs_hostname[64];/* Hostname of machine of image */
|
||||||
char fs_netaddr[32]; /* Network address */
|
char fs_netaddr[32]; /* Network address */
|
||||||
__u32 fs_netaddr_type;/* 0 = IPV4, 1 = IPV6, etc. */
|
__u32 fs_netaddr_type;/* 0 = IPV4, 1 = IPV6, etc. */
|
||||||
__u32 fs_device; /* Device number of image */
|
__u32 fs_device; /* Device number of image */
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2001-02-08 Theodore Tso <tytso@valinux.com>
|
||||||
|
|
||||||
|
* e2image.c (main): Add code to write the e2image header.
|
||||||
|
|
||||||
2001-02-07 Theodore Tso <tytso@valinux.com>
|
2001-02-07 Theodore Tso <tytso@valinux.com>
|
||||||
|
|
||||||
* tune2fs.8.in: Update man page to reflect that 2.0.39 supports
|
* tune2fs.8.in: Update man page to reflect that 2.0.39 supports
|
||||||
|
|
|
@ -85,6 +85,7 @@ int main (int argc, char ** argv)
|
||||||
int raw_flag = 0;
|
int raw_flag = 0;
|
||||||
int fd = 0;
|
int fd = 0;
|
||||||
struct ext2_image_hdr hdr;
|
struct ext2_image_hdr hdr;
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
setlocale(LC_MESSAGES, "");
|
setlocale(LC_MESSAGES, "");
|
||||||
|
@ -117,7 +118,7 @@ int main (int argc, char ** argv)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = open(argv[optind+1], O_CREAT|O_TRUNC|O_RDWR, 0600);
|
fd = open(argv[optind+1], O_CREAT|O_RDWR, 0600);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
com_err(program_name, errno, _("while trying to open %s"),
|
com_err(program_name, errno, _("while trying to open %s"),
|
||||||
argv[optind+1]);
|
argv[optind+1]);
|
||||||
|
@ -154,7 +155,25 @@ int main (int argc, char ** argv)
|
||||||
com_err(program_name, retval, _("while writing inode bitmap"));
|
com_err(program_name, retval, _("while writing inode bitmap"));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hdr.magic_number = EXT2_ET_MAGIC_E2IMAGE;
|
||||||
|
strcpy(hdr.magic_descriptor, "Ext2 Image 1.0");
|
||||||
|
gethostname(hdr.fs_hostname, sizeof(hdr.fs_hostname));
|
||||||
|
|
||||||
|
if (stat(device_name, &st) == 0)
|
||||||
|
hdr.fs_device = st.st_rdev;
|
||||||
|
|
||||||
|
if (fstat(fd, &st) == 0) {
|
||||||
|
hdr.image_device = st.st_dev;
|
||||||
|
hdr.image_inode = st.st_ino;
|
||||||
|
}
|
||||||
|
memcpy(hdr.fs_uuid, fs->super->s_uuid, sizeof(hdr.fs_uuid));
|
||||||
|
|
||||||
|
hdr.image_time = time(0);
|
||||||
|
write_header(fd, &hdr);
|
||||||
|
|
||||||
ext2fs_close (fs);
|
ext2fs_close (fs);
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue