1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

const: _ops text handler

Making sure these structures ends in '.data.rel.ro' section.
(instead of plain '.data' section).
This commit is contained in:
Zdenek Kabelac 2024-05-02 20:52:40 +02:00
parent 2a1e200f7a
commit effafa8fc8
4 changed files with 8 additions and 13 deletions

View File

@ -1958,7 +1958,7 @@ static void _text_destroy(struct format_type *fmt)
free(fmt);
}
static struct metadata_area_ops _metadata_text_file_ops = {
static const struct metadata_area_ops _metadata_text_file_ops = {
.vg_read = _vg_read_file,
.vg_read_precommit = _vg_read_precommit_file,
.vg_write = _vg_write_file,
@ -1966,14 +1966,14 @@ static struct metadata_area_ops _metadata_text_file_ops = {
.vg_commit = _vg_commit_file
};
static struct metadata_area_ops _metadata_text_file_backup_ops = {
static const struct metadata_area_ops _metadata_text_file_backup_ops = {
.vg_read = _vg_read_file,
.vg_write = _vg_write_file,
.vg_remove = _vg_remove_file,
.vg_commit = _vg_commit_file_backup
};
static struct metadata_area_ops _metadata_text_raw_ops = {
static const struct metadata_area_ops _metadata_text_raw_ops = {
.vg_read = _vg_read_raw,
.vg_read_precommit = _vg_read_precommit_raw,
.vg_write = _vg_write_raw,
@ -2571,7 +2571,7 @@ static struct format_instance *_text_create_text_instance(const struct format_ty
return fid;
}
static struct format_handler _text_handler = {
static const struct format_handler _text_handler = {
.pv_initialise = _text_pv_initialise,
.pv_setup = _text_pv_setup,
.pv_add_metadata_area = _text_pv_add_metadata_area,
@ -2618,9 +2618,6 @@ struct format_type *create_text_format(struct cmd_context *cmd)
mda_lists->raw_ops = &_metadata_text_raw_ops;
fmt->private = (void *) mda_lists;
dm_list_init(&fmt->mda_ops);
dm_list_add(&fmt->mda_ops, &_metadata_text_raw_ops.list);
if (!(fmt->labeller = text_labeller_create(fmt))) {
log_error("Couldn't create text label handler.");
goto bad;

View File

@ -85,8 +85,8 @@ struct mda_header *raw_read_mda_header(const struct format_type *fmt,
uint32_t *bad_fields);
struct mda_lists {
struct metadata_area_ops *file_ops;
struct metadata_area_ops *raw_ops;
const struct metadata_area_ops *file_ops;
const struct metadata_area_ops *raw_ops;
};
struct mda_context {

View File

@ -372,8 +372,7 @@ struct labeller;
struct format_type {
struct dm_list list;
struct cmd_context *cmd;
struct format_handler *ops;
struct dm_list mda_ops; /* List of permissible mda ops. */
const struct format_handler *ops;
struct labeller *labeller;
const char *name;
const char *alias;

View File

@ -73,7 +73,6 @@ struct cached_vg_fmtdata;
/* Per-format per-metadata area operations */
struct metadata_area_ops {
struct dm_list list;
struct volume_group *(*vg_read) (struct cmd_context *cmd,
struct format_instance * fi,
const char *vg_name,
@ -183,7 +182,7 @@ struct metadata_area_ops {
struct metadata_area {
struct dm_list list;
struct metadata_area_ops *ops;
const struct metadata_area_ops *ops;
void *metadata_locn;
uint32_t status;
uint64_t header_start; /* mda_header.start */