mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 03:53:37 +02:00
scsi: target: Constify struct configfs_item_operations and configfs_group_operations
'struct configfs_item_operations' and 'configfs_group_operations' are not modified in this driver. Constifying these structures moves some data to a read-only section, so increases overall security, especially when the structure holds some function pointers. On a x86_64, with allmodconfig: Before: ====== text data bss dec hex filename 151831 80058 4832 236721 39cb1 drivers/target/target_core_configfs.o 45200 16658 0 61858 f1a2 drivers/target/target_core_fabric_configfs.o After: ===== text data bss dec hex filename 152599 79290 4832 236721 39cb1 drivers/target/target_core_configfs.o 46352 15506 0 61858 f1a2 drivers/target/target_core_fabric_configfs.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://patch.msgid.link/a0f25237ae86b8c4dd7a3876c4ed2dc3de200173.1767008082.git.christophe.jaillet@wanadoo.fr Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
8e8e8e7e84
commit
ae62d62b1c
|
|
@ -288,7 +288,7 @@ static void target_core_deregister_fabric(
|
|||
config_item_put(item);
|
||||
}
|
||||
|
||||
static struct configfs_group_operations target_core_fabric_group_ops = {
|
||||
static const struct configfs_group_operations target_core_fabric_group_ops = {
|
||||
.make_group = &target_core_register_fabric,
|
||||
.drop_item = &target_core_deregister_fabric,
|
||||
};
|
||||
|
|
@ -2860,7 +2860,7 @@ static void target_core_alua_lu_gp_release(struct config_item *item)
|
|||
core_alua_free_lu_gp(lu_gp);
|
||||
}
|
||||
|
||||
static struct configfs_item_operations target_core_alua_lu_gp_ops = {
|
||||
static const struct configfs_item_operations target_core_alua_lu_gp_ops = {
|
||||
.release = target_core_alua_lu_gp_release,
|
||||
};
|
||||
|
||||
|
|
@ -2917,7 +2917,7 @@ static void target_core_alua_drop_lu_gp(
|
|||
config_item_put(item);
|
||||
}
|
||||
|
||||
static struct configfs_group_operations target_core_alua_lu_gps_group_ops = {
|
||||
static const struct configfs_group_operations target_core_alua_lu_gps_group_ops = {
|
||||
.make_group = &target_core_alua_create_lu_gp,
|
||||
.drop_item = &target_core_alua_drop_lu_gp,
|
||||
};
|
||||
|
|
@ -3290,7 +3290,7 @@ static void target_core_alua_tg_pt_gp_release(struct config_item *item)
|
|||
core_alua_free_tg_pt_gp(tg_pt_gp);
|
||||
}
|
||||
|
||||
static struct configfs_item_operations target_core_alua_tg_pt_gp_ops = {
|
||||
static const struct configfs_item_operations target_core_alua_tg_pt_gp_ops = {
|
||||
.release = target_core_alua_tg_pt_gp_release,
|
||||
};
|
||||
|
||||
|
|
@ -3348,7 +3348,7 @@ static void target_core_alua_drop_tg_pt_gp(
|
|||
config_item_put(item);
|
||||
}
|
||||
|
||||
static struct configfs_group_operations target_core_alua_tg_pt_gps_group_ops = {
|
||||
static const struct configfs_group_operations target_core_alua_tg_pt_gps_group_ops = {
|
||||
.make_group = &target_core_alua_create_tg_pt_gp,
|
||||
.drop_item = &target_core_alua_drop_tg_pt_gp,
|
||||
};
|
||||
|
|
@ -3389,7 +3389,7 @@ static void target_core_stat_rmdir(
|
|||
return;
|
||||
}
|
||||
|
||||
static struct configfs_group_operations target_core_stat_group_ops = {
|
||||
static const struct configfs_group_operations target_core_stat_group_ops = {
|
||||
.make_group = &target_core_stat_mkdir,
|
||||
.drop_item = &target_core_stat_rmdir,
|
||||
};
|
||||
|
|
@ -3516,7 +3516,7 @@ static void target_core_drop_subdev(
|
|||
mutex_unlock(&hba->hba_access_mutex);
|
||||
}
|
||||
|
||||
static struct configfs_group_operations target_core_hba_group_ops = {
|
||||
static const struct configfs_group_operations target_core_hba_group_ops = {
|
||||
.make_group = target_core_make_subdev,
|
||||
.drop_item = target_core_drop_subdev,
|
||||
};
|
||||
|
|
@ -3595,7 +3595,7 @@ static struct configfs_attribute *target_core_hba_attrs[] = {
|
|||
NULL,
|
||||
};
|
||||
|
||||
static struct configfs_item_operations target_core_hba_item_ops = {
|
||||
static const struct configfs_item_operations target_core_hba_item_ops = {
|
||||
.release = target_core_hba_release,
|
||||
};
|
||||
|
||||
|
|
@ -3676,7 +3676,7 @@ static void target_core_call_delhbafromtarget(
|
|||
config_item_put(item);
|
||||
}
|
||||
|
||||
static struct configfs_group_operations target_core_group_ops = {
|
||||
static const struct configfs_group_operations target_core_group_ops = {
|
||||
.make_group = target_core_call_addhbatotarget,
|
||||
.drop_item = target_core_call_delhbafromtarget,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ static void target_fabric_setup_##_name##_cit(struct target_fabric_configfs *tf)
|
|||
pr_debug("Setup generic %s\n", __stringify(_name)); \
|
||||
}
|
||||
|
||||
static struct configfs_item_operations target_fabric_port_item_ops;
|
||||
static const struct configfs_item_operations target_fabric_port_item_ops;
|
||||
|
||||
/* Start of tfc_tpg_mappedlun_cit */
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ static void target_fabric_mappedlun_release(struct config_item *item)
|
|||
core_dev_free_initiator_node_lun_acl(se_tpg, lacl);
|
||||
}
|
||||
|
||||
static struct configfs_item_operations target_fabric_mappedlun_item_ops = {
|
||||
static const struct configfs_item_operations target_fabric_mappedlun_item_ops = {
|
||||
.release = target_fabric_mappedlun_release,
|
||||
.allow_link = target_fabric_mappedlun_link,
|
||||
.drop_link = target_fabric_mappedlun_unlink,
|
||||
|
|
@ -246,7 +246,7 @@ static void target_core_mappedlun_stat_rmdir(
|
|||
return;
|
||||
}
|
||||
|
||||
static struct configfs_group_operations target_fabric_mappedlun_stat_group_ops = {
|
||||
static const struct configfs_group_operations target_fabric_mappedlun_stat_group_ops = {
|
||||
.make_group = target_core_mappedlun_stat_mkdir,
|
||||
.drop_item = target_core_mappedlun_stat_rmdir,
|
||||
};
|
||||
|
|
@ -345,11 +345,11 @@ static void target_fabric_nacl_base_release(struct config_item *item)
|
|||
core_tpg_del_initiator_node_acl(se_nacl);
|
||||
}
|
||||
|
||||
static struct configfs_item_operations target_fabric_nacl_base_item_ops = {
|
||||
static const struct configfs_item_operations target_fabric_nacl_base_item_ops = {
|
||||
.release = target_fabric_nacl_base_release,
|
||||
};
|
||||
|
||||
static struct configfs_group_operations target_fabric_nacl_base_group_ops = {
|
||||
static const struct configfs_group_operations target_fabric_nacl_base_group_ops = {
|
||||
.make_group = target_fabric_make_mappedlun,
|
||||
.drop_item = target_fabric_drop_mappedlun,
|
||||
};
|
||||
|
|
@ -433,7 +433,7 @@ static void target_fabric_drop_nodeacl(
|
|||
config_item_put(item);
|
||||
}
|
||||
|
||||
static struct configfs_group_operations target_fabric_nacl_group_ops = {
|
||||
static const struct configfs_group_operations target_fabric_nacl_group_ops = {
|
||||
.make_group = target_fabric_make_nodeacl,
|
||||
.drop_item = target_fabric_drop_nodeacl,
|
||||
};
|
||||
|
|
@ -454,7 +454,7 @@ static void target_fabric_np_base_release(struct config_item *item)
|
|||
tf->tf_ops->fabric_drop_np(se_tpg_np);
|
||||
}
|
||||
|
||||
static struct configfs_item_operations target_fabric_np_base_item_ops = {
|
||||
static const struct configfs_item_operations target_fabric_np_base_item_ops = {
|
||||
.release = target_fabric_np_base_release,
|
||||
};
|
||||
|
||||
|
|
@ -499,7 +499,7 @@ static void target_fabric_drop_np(
|
|||
config_item_put(item);
|
||||
}
|
||||
|
||||
static struct configfs_group_operations target_fabric_np_group_ops = {
|
||||
static const struct configfs_group_operations target_fabric_np_group_ops = {
|
||||
.make_group = &target_fabric_make_np,
|
||||
.drop_item = &target_fabric_drop_np,
|
||||
};
|
||||
|
|
@ -700,7 +700,7 @@ static void target_fabric_port_release(struct config_item *item)
|
|||
call_rcu(&lun->rcu_head, target_tpg_free_lun);
|
||||
}
|
||||
|
||||
static struct configfs_item_operations target_fabric_port_item_ops = {
|
||||
static const struct configfs_item_operations target_fabric_port_item_ops = {
|
||||
.release = target_fabric_port_release,
|
||||
.allow_link = target_fabric_port_link,
|
||||
.drop_link = target_fabric_port_unlink,
|
||||
|
|
@ -726,7 +726,7 @@ static void target_core_port_stat_rmdir(
|
|||
return;
|
||||
}
|
||||
|
||||
static struct configfs_group_operations target_fabric_port_stat_group_ops = {
|
||||
static const struct configfs_group_operations target_fabric_port_stat_group_ops = {
|
||||
.make_group = target_core_port_stat_mkdir,
|
||||
.drop_item = target_core_port_stat_rmdir,
|
||||
};
|
||||
|
|
@ -787,7 +787,7 @@ static void target_fabric_drop_lun(
|
|||
config_item_put(item);
|
||||
}
|
||||
|
||||
static struct configfs_group_operations target_fabric_lun_group_ops = {
|
||||
static const struct configfs_group_operations target_fabric_lun_group_ops = {
|
||||
.make_group = &target_fabric_make_lun,
|
||||
.drop_item = &target_fabric_drop_lun,
|
||||
};
|
||||
|
|
@ -812,7 +812,7 @@ static void target_fabric_tpg_release(struct config_item *item)
|
|||
tf->tf_ops->fabric_drop_tpg(se_tpg);
|
||||
}
|
||||
|
||||
static struct configfs_item_operations target_fabric_tpg_base_item_ops = {
|
||||
static const struct configfs_item_operations target_fabric_tpg_base_item_ops = {
|
||||
.release = target_fabric_tpg_release,
|
||||
};
|
||||
|
||||
|
|
@ -998,11 +998,11 @@ static void target_fabric_release_wwn(struct config_item *item)
|
|||
tf->tf_ops->fabric_drop_wwn(wwn);
|
||||
}
|
||||
|
||||
static struct configfs_item_operations target_fabric_tpg_item_ops = {
|
||||
static const struct configfs_item_operations target_fabric_tpg_item_ops = {
|
||||
.release = target_fabric_release_wwn,
|
||||
};
|
||||
|
||||
static struct configfs_group_operations target_fabric_tpg_group_ops = {
|
||||
static const struct configfs_group_operations target_fabric_tpg_group_ops = {
|
||||
.make_group = target_fabric_make_tpg,
|
||||
.drop_item = target_fabric_drop_tpg,
|
||||
};
|
||||
|
|
@ -1144,7 +1144,7 @@ static void target_fabric_drop_wwn(
|
|||
config_item_put(item);
|
||||
}
|
||||
|
||||
static struct configfs_group_operations target_fabric_wwn_group_ops = {
|
||||
static const struct configfs_group_operations target_fabric_wwn_group_ops = {
|
||||
.make_group = target_fabric_make_wwn,
|
||||
.drop_item = target_fabric_drop_wwn,
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user