__u16 unused; /* Number of reserved GDT blocks in group */
};
+struct ext4_new_group_input {
+ __u32 group; /* Group number for this data */
+ __u64 block_bitmap; /* Absolute block number of block bitmap */
+ __u64 inode_bitmap; /* Absolute block number of inode bitmap */
+ __u64 inode_table; /* Absolute block number of inode table start */
+ __u32 blocks_count; /* Total number of blocks in this group */
+ __u16 reserved_blocks; /* Number of reserved blocks in this group */
+ __u16 unused;
+};
+
#ifdef __GNU__ /* Needed for the Hurd */
#define _IOT_ext2_new_group_input _IOT (_IOTS(__u32), 5, _IOTS(__u16), 2, 0, 0)
#endif
#define EXT2_IOC_SETVERSION_NEW _IOW('f', 4, long)
#define EXT2_IOC_GROUP_EXTEND _IOW('f', 7, unsigned long)
#define EXT2_IOC_GROUP_ADD _IOW('f', 8,struct ext2_new_group_input)
+#define EXT4_IOC_GROUP_ADD _IOW('f', 8,struct ext4_new_group_input)
/*
* Structure of an inode on the disk
{
#ifdef __linux__
struct ext2_new_group_input input;
+ struct ext4_new_group_input input64;
struct ext2_super_block *sb = fs->super;
unsigned long new_desc_blocks;
ext2_filsys new_fs;
dgrp_t i;
blk_t size;
int fd, r_frac, overhead;
+ int use_old_ioctl = 1;
printf(_("Filesystem at %s is mounted on %s; "
"on-line resizing required\n"), fs->device_name, mtpt);
printf("Adding group #%d\n", input.group);
#endif
- if (ioctl(fd, EXT2_IOC_GROUP_ADD, &input) < 0) {
+ if (use_old_ioctl &&
+ ioctl(fd, EXT2_IOC_GROUP_ADD, &input) == 0)
+ continue;
+ else
+ use_old_ioctl = 1;
+
+ input64.group = input.group;
+ input64.block_bitmap = input.block_bitmap;
+ input64.inode_bitmap = input.inode_bitmap;
+ input64.inode_table = input.inode_table;
+ input64.blocks_count = input.blocks_count;
+ input64.reserved_blocks = input.reserved_blocks;
+ input64.unused = input.unused;
+
+ if (ioctl(fd, EXT4_IOC_GROUP_ADD, &input64) < 0) {
com_err(program_name, errno,
_("While trying to add group #%d"),
input.group);