+ if (optargs_bitmask & GUESTFS_MKFS_OPTS_FEATURES_BITMASK) {
+ argv[i++] = "-O";
+ argv[i++] = features;
+ }
+
+ if (optargs_bitmask & GUESTFS_MKFS_OPTS_INODE_BITMASK) {
+ if (!STREQ (fstype, "ext2") && !STREQ (fstype, "ext3") &&
+ !STREQ (fstype, "ext4")) {
+ reply_with_error ("inode size (-I) can only be set on ext2/3/4 filesystems");
+ return -1;
+ }
+
+ if (inode <= 0) {
+ reply_with_error ("inode size must be larger than zero");
+ return -1;
+ }
+
+ snprintf (inode_str, sizeof inode_str, "%d", inode);
+ argv[i++] = "-I";
+ argv[i++] = inode_str;
+ }
+
+ if (optargs_bitmask & GUESTFS_MKFS_OPTS_SECTORSIZE_BITMASK) {
+ if (!STREQ (fstype, "ufs")) {
+ reply_with_error ("sector size (-S) can only be set on ufs filesystems");
+ return -1;
+ }
+
+ if (sectorsize <= 0) {
+ reply_with_error ("sector size must be larger than zero");
+ return -1;
+ }
+
+ snprintf (sectorsize_str, sizeof sectorsize_str, "%d", sectorsize);
+ argv[i++] = "-S";
+ argv[i++] = sectorsize_str;
+ }
+