Skip to content

Commit

Permalink
Merge pull request #929 from tbzatek/clang-fixes
Browse files Browse the repository at this point in the history
clang fixes
  • Loading branch information
vojtechtrefny authored Jul 4, 2023
2 parents b4c568d + 0d97224 commit fc0b696
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 32 deletions.
5 changes: 3 additions & 2 deletions scripts/boilerplate_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def get_arg_names(args):

def get_func_boilerplate(fn_info):
call_args_str = ", ".join(get_arg_names(fn_info.args))
args_ann_unused = fn_info.args.replace(",", " G_GNUC_UNUSED,")

if "int" in fn_info.rtype:
default_ret = "0"
Expand All @@ -159,12 +160,12 @@ def get_func_boilerplate(fn_info):
default_ret = 0

# first add the stub function doing nothing and just reporting error
ret = ("static {0.rtype} {0.name}_stub ({0.args}) {{\n" +
ret = ("static {0.rtype} {0.name}_stub ({2}) {{\n" +
" g_critical (\"The function '{0.name}' called, but not implemented!\");\n" +
" g_set_error (error, BD_INIT_ERROR, BD_INIT_ERROR_NOT_IMPLEMENTED,\n"+
" \"The function '{0.name}' called, but not implemented!\");\n"
" return {1};\n"
"}}\n\n").format(fn_info, default_ret)
"}}\n\n").format(fn_info, default_ret, args_ann_unused)

# then add a variable holding a reference to the dynamically loaded function
# (if any) initialized to the stub
Expand Down
1 change: 0 additions & 1 deletion src/plugins/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,6 @@ struct _BDCryptoKeyslotContext {
} volume_key;
} u;
};
typedef struct _BDCryptoKeyslotContext BDCryptoKeyslotContext;

void bd_crypto_keyslot_context_free (BDCryptoKeyslotContext *context) {
if (context == NULL)
Expand Down
32 changes: 4 additions & 28 deletions src/plugins/fs/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,148 +155,124 @@ static const BDFSFeatures fs_features[BD_FS_LAST_FS] = {
/**
* BDFSInfo:
* @type: filesystem identifier, must be present
* @mkfs_util: required utility for filesystem creation, "" if not needed and NULL for no support
* @check_util: required utility for consistency checking, "" if not needed and NULL for no support
* @repair_util: required utility for repair, "" if not needed and NULL for no support
* @resize_util: required utility for resize, "" if not needed and NULL for no support
* @resize_mode: resize availability flags, 0 if no support
* @label_util: required utility for labelling, "" if not needed and NULL for no support
* @info_util: required utility for getting information about the filesystem, "" if not needed and NULL for no support
* @uuid_util: required utility for setting UUID, "" if not needed and NULL for no support
*/
typedef struct BDFSInfo {
const gchar *type;
const gchar *mkfs_util;
BDFSMkfsOptionsFlags mkfs_options;
const gchar *check_util;
const gchar *repair_util;
const gchar *resize_util;
BDFSResizeFlags resize_mode;
const gchar *label_util;
const gchar *info_util;
const gchar *uuid_util;
} BDFSInfo;

static const BDFSInfo fs_info[BD_FS_LAST_FS] = {
const BDFSInfo fs_info[BD_FS_LAST_FS] = {
/* padding for BD_FS_TECH_GENERIC and MOUNT to make accessing the FS techs simpler */
{ 0 }, { 0 },
/* EXT2 */
{ .type = "ext2",
.mkfs_util = "mkfs.ext2",
.mkfs_options = fs_features[BD_FS_TECH_EXT2].mkfs,
.check_util = "e2fsck",
.repair_util = "e2fsck",
.resize_util = "resize2fs",
.resize_mode = fs_features[BD_FS_TECH_EXT2].resize,
.label_util = "tune2fs",
.info_util = "dumpe2fs",
.uuid_util = "tune2fs" },
/* EXT3 */
{ .type = "ext3",
.mkfs_util = "mkfs.ext3",
.mkfs_options = fs_features[BD_FS_TECH_EXT3].mkfs,
.check_util = "e2fsck",
.repair_util = "e2fsck",
.resize_util = "resize2fs",
.resize_mode = fs_features[BD_FS_TECH_EXT3].resize,
.label_util = "tune2fs",
.info_util = "dumpe2fs",
.uuid_util = "tune2fs" },
/* EXT4 */
{ .type = "ext4",
.mkfs_util = "mkfs.ext4",
.mkfs_options = fs_features[BD_FS_TECH_EXT4].mkfs,
.check_util = "e2fsck",
.repair_util = "e2fsck",
.resize_util = "resize2fs",
.resize_mode = fs_features[BD_FS_TECH_EXT4].resize,
.label_util = "tune2fs",
.info_util = "dumpe2fs",
.uuid_util = "tune2fs" },
/* XFS */
{ .type = "xfs",
.mkfs_util = "mkfs.xfs",
.mkfs_options = fs_features[BD_FS_TECH_XFS].mkfs,
.check_util = "xfs_db",
.repair_util = "xfs_repair",
.resize_util = "xfs_growfs",
.resize_mode = fs_features[BD_FS_TECH_XFS].resize,
.label_util = "xfs_admin",
.info_util = "xfs_admin",
.uuid_util = "xfs_admin" },
/* VFAT */
{ .type = "vfat",
.mkfs_util = "mkfs.vfat",
.mkfs_options = fs_features[BD_FS_TECH_VFAT].mkfs,
.check_util = "fsck.vfat",
.repair_util = "fsck.vfat",
.resize_util = "vfat-resize",
.resize_mode = fs_features[BD_FS_TECH_VFAT].resize,
.label_util = "fatlabel",
.info_util = "fsck.vfat",
.uuid_util = "fatlabel" },
/* NTFS */
{ .type = "ntfs",
.mkfs_util = "mkfs.ntfs",
.mkfs_options = fs_features[BD_FS_TECH_NTFS].mkfs,
.check_util = "ntfsfix",
.repair_util = "ntfsfix",
.resize_util = "ntfsresize",
.resize_mode = fs_features[BD_FS_TECH_NTFS].resize,
.label_util = "ntfslabel",
.info_util = "ntfscluster",
.uuid_util = "ntfslabel" },
/* F2FS */
{ .type = "f2fs",
.mkfs_util = "mkfs.f2fs",
.mkfs_options = fs_features[BD_FS_TECH_F2FS].mkfs,
.check_util = "fsck.f2fs",
.repair_util = "fsck.f2fs",
.resize_util = "resize.f2fs",
.resize_mode = fs_features[BD_FS_TECH_F2FS].resize,
.label_util = NULL,
.info_util = "dump.f2fs",
.uuid_util = NULL },
/* NILFS2 */
{ .type = "nilfs2",
.mkfs_util = "mkfs.nilfs2",
.mkfs_options = fs_features[BD_FS_TECH_NILFS2].mkfs,
.check_util = NULL,
.repair_util = NULL,
.resize_util = "nilfs-resize",
.resize_mode = fs_features[BD_FS_TECH_NILFS2].resize,
.label_util = "nilfs-tune",
.info_util = "nilfs-tune",
.uuid_util = "nilfs-tune" },
/* EXFAT */
{ .type = "exfat",
.mkfs_util = "mkfs.exfat",
.mkfs_options = fs_features[BD_FS_TECH_EXFAT].mkfs,
.check_util = "fsck.exfat",
.repair_util = "fsck.exfat",
.resize_util = NULL,
.resize_mode = fs_features[BD_FS_TECH_EXFAT].resize,
.label_util = "tune.exfat",
.info_util = "tune.exfat",
.uuid_util = "tune.exfat" },
/* BTRFS */
{ .type = "btrfs",
.mkfs_util = "mkfs.btrfs",
.mkfs_options = fs_features[BD_FS_TECH_BTRFS].mkfs,
.check_util = "btrfsck",
.repair_util = "btrfsck",
.resize_util = "btrfs",
.resize_mode = fs_features[BD_FS_TECH_BTRFS].resize,
.label_util = "btrfs",
.info_util = "btrfs",
.uuid_util = "btrfstune" },
/* UDF */
{ .type = "udf",
.mkfs_util = "mkudffs",
.mkfs_options = fs_features[BD_FS_TECH_UDF].mkfs,
.check_util = NULL,
.repair_util = NULL,
.resize_util = NULL,
.resize_mode = fs_features[BD_FS_TECH_UDF].resize,
.label_util = "udflabel",
.info_util = "udfinfo",
.uuid_util = "udflabel" },
Expand Down Expand Up @@ -1538,10 +1514,10 @@ static gboolean query_fs_operation (const gchar *fs_type, BDFSOpType op, gchar *
}

if (mode != NULL)
*mode = fsinfo->resize_mode;
*mode = fs_features[tech].resize;

if (options != NULL)
*options = fsinfo->mkfs_options;
*options = fs_features[tech].mkfs;

if (strlen (exec_util) == 0) { /* empty string if no util needed */
return TRUE;
Expand Down
1 change: 0 additions & 1 deletion src/plugins/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ static gchar* _loop_get_backing_file (const gchar *dev_name, GError **error) {
BDLoopInfo* bd_loop_info (const gchar *loop, GError **error) {
BDLoopInfo *info = NULL;
g_autofree gchar *dev_loop = NULL;
g_autofree gchar *sys_path = NULL;
gint fd = -1;
struct loop_info64 li64;
GError *l_error = NULL;
Expand Down

0 comments on commit fc0b696

Please sign in to comment.