diff --git a/disk-utils/partx.c b/disk-utils/partx.c index 76872907f..ac3ef1470 100644 --- a/disk-utils/partx.c +++ b/disk-utils/partx.c @@ -75,14 +75,14 @@ enum { /* column names */ struct colinfo { - const char *name; /* header */ - double whint; /* width hint (N < 1 is in percent of termwidth) */ - int flags; /* SCOLS_FL_* */ - const char *help; + const char * const name; /* header */ + double whint; /* width hint (N < 1 is in percent of termwidth) */ + int flags; /* SCOLS_FL_* */ + const char *help; }; /* columns descriptions */ -static struct colinfo infos[] = { +static const struct colinfo infos[] = { [COL_PARTNO] = { "NR", 0.25, SCOLS_FL_RIGHT, N_("partition number") }, [COL_START] = { "START", 0.30, SCOLS_FL_RIGHT, N_("start of the partition in sectors") }, [COL_END] = { "END", 0.30, SCOLS_FL_RIGHT, N_("end of the partition in sectors") }, @@ -141,7 +141,7 @@ static inline int get_column_id(int num) return columns[num]; } -static inline struct colinfo *get_column_info(int num) +static inline const struct colinfo *get_column_info(int num) { return &infos[ get_column_id(num) ]; } @@ -674,7 +674,7 @@ static int show_parts(blkid_partlist ls, int scols_flags, int lower, int upper) scols_table_enable_noheadings(table, !!(scols_flags & PARTX_NOHEADINGS)); for (i = 0; (size_t)i < ncolumns; i++) { - struct colinfo *col = get_column_info(i); + const struct colinfo *col = get_column_info(i); if (!scols_table_new_column(table, col->name, col->whint, col->flags)) { warnx(_("failed to allocate output column")); diff --git a/libblkid/src/topology/sysfs.c b/libblkid/src/topology/sysfs.c index 25debd073..d216cfccb 100644 --- a/libblkid/src/topology/sysfs.c +++ b/libblkid/src/topology/sysfs.c @@ -26,7 +26,7 @@ static const struct topology_val { /* /sys/dev/block/:/ */ - const char *attr; + const char * const attr; /* functions to set probing result */ int (*set_ulong)(blkid_probe, unsigned long); diff --git a/libfdisk/src/bsd.c b/libfdisk/src/bsd.c index 313ae5ae0..c138d54b9 100644 --- a/libfdisk/src/bsd.c +++ b/libfdisk/src/bsd.c @@ -30,7 +30,7 @@ * */ -static const char *bsd_dktypenames[] = { +static const char * const bsd_dktypenames[] = { "unknown", "SMD", "MSCP", diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c index 76d28125c..ea5afb5ba 100644 --- a/login-utils/lslogins.c +++ b/login-utils/lslogins.c @@ -64,7 +64,7 @@ * column description */ struct lslogins_coldesc { - const char *name; + const char * const name; const char *help; const char *pretty_name; diff --git a/misc-utils/fincore.c b/misc-utils/fincore.c index ead6f7aaf..e5e25e5c7 100644 --- a/misc-utils/fincore.c +++ b/misc-utils/fincore.c @@ -44,7 +44,7 @@ struct colinfo { - const char *name; + const char * const name; double whint; int flags; const char *help; @@ -57,7 +57,7 @@ enum { COL_RES }; -static struct colinfo infos[] = { +static const struct colinfo infos[] = { [COL_PAGES] = { "PAGES", 1, SCOLS_FL_RIGHT, N_("file data resident in memory in pages")}, [COL_RES] = { "RES", 5, SCOLS_FL_RIGHT, N_("file data resident in memory in bytes")}, [COL_SIZE] = { "SIZE", 5, SCOLS_FL_RIGHT, N_("size of the file")}, diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c index 733bbc13d..5a8da5dd6 100644 --- a/misc-utils/findmnt.c +++ b/misc-utils/findmnt.c @@ -90,7 +90,7 @@ enum { /* column names */ struct colinfo { - const char *name; /* header */ + const char * const name; /* header */ double whint; /* width hint (N < 1 is in percent of termwidth) */ int flags; /* libsmartcols flags */ const char *help; /* column description */ diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c index fae918bd3..96d118189 100644 --- a/misc-utils/lsblk.c +++ b/misc-utils/lsblk.c @@ -158,7 +158,7 @@ enum { /* column names */ struct colinfo { - const char *name; /* header */ + const char * const name; /* header */ double whint; /* width hint (N < 1 is in percent of termwidth) */ int flags; /* SCOLS_FL_* */ const char *help; @@ -166,7 +166,7 @@ struct colinfo { }; /* columns descriptions */ -static struct colinfo infos[] = { +static const struct colinfo infos[] = { [COL_ALIOFF] = { "ALIGNMENT", 6, SCOLS_FL_RIGHT, N_("alignment offset"), COLTYPE_NUM }, [COL_ID] = { "ID", 0.1, SCOLS_FL_NOEXTREMES, N_("udev ID (based on ID-LINK)") }, [COL_IDLINK] = { "ID-LINK", 0.1, SCOLS_FL_NOEXTREMES, N_("the shortest udev /dev/disk/by-id link name") }, @@ -324,7 +324,7 @@ static int get_column_id(int num) } /* Returns column description for the column sequential number */ -static struct colinfo *get_column_info(int num) +static const struct colinfo *get_column_info(int num) { return &infos[ get_column_id(num) ]; } @@ -2364,7 +2364,7 @@ int main(int argc, char *argv[]) } for (i = 0; i < ncolumns; i++) { - struct colinfo *ci = get_column_info(i); + const struct colinfo *ci = get_column_info(i); struct libscols_column *cl; int id = get_column_id(i), fl = ci->flags; diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c index caca13f9a..ba837d51a 100644 --- a/misc-utils/lslocks.c +++ b/misc-utils/lslocks.c @@ -64,10 +64,10 @@ enum { /* column names */ struct colinfo { - const char *name; /* header */ - double whint; /* width hint (N < 1 is in percent of termwidth) */ - int flags; /* SCOLS_FL_* */ - const char *help; + const char * const name; /* header */ + double whint; /* width hint (N < 1 is in percent of termwidth) */ + int flags; /* SCOLS_FL_* */ + const char *help; }; /* columns descriptions */ @@ -362,7 +362,7 @@ static inline int get_column_id(int num) } -static inline struct colinfo *get_column_info(unsigned num) +static inline const struct colinfo *get_column_info(unsigned num) { return &infos[ get_column_id(num) ]; } @@ -480,7 +480,7 @@ static int show_locks(struct list_head *locks) for (i = 0; i < ncolumns; i++) { struct libscols_column *cl; - struct colinfo *col = get_column_info(i); + const struct colinfo *col = get_column_info(i); cl = scols_table_new_column(table, col->name, col->whint, col->flags); if (!cl) diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c index 82ecee75f..7b19436b4 100644 --- a/sys-utils/losetup.c +++ b/sys-utils/losetup.c @@ -60,7 +60,7 @@ static int raw; static int json; struct colinfo { - const char *name; + const char * const name; double whint; int flags; const char *help; @@ -68,7 +68,7 @@ struct colinfo { int json_type; /* default is string */ }; -static struct colinfo infos[] = { +static const struct colinfo infos[] = { [COL_AUTOCLR] = { "AUTOCLEAR", 1, SCOLS_FL_RIGHT, N_("autoclear flag set"), SCOLS_JSON_BOOLEAN}, [COL_BACK_FILE] = { "BACK-FILE", 0.3, SCOLS_FL_NOEXTREMES, N_("device backing file")}, [COL_BACK_INO] = { "BACK-INO", 4, SCOLS_FL_RIGHT, N_("backing file inode number"), SCOLS_JSON_NUMBER}, @@ -94,7 +94,7 @@ static int get_column_id(int num) return columns[num]; } -static struct colinfo *get_column_info(int num) +static const struct colinfo *get_column_info(int num) { return &infos[ get_column_id(num) ]; } @@ -331,7 +331,7 @@ static int show_table(struct loopdev_cxt *lc, scols_table_set_name(tb, "loopdevices"); for (i = 0; i < ncolumns; i++) { - struct colinfo *ci = get_column_info(i); + const struct colinfo *ci = get_column_info(i); struct libscols_column *cl; cl = scols_table_new_column(tb, ci->name, ci->whint, ci->flags); diff --git a/sys-utils/lsipc.c b/sys-utils/lsipc.c index 0f3cd94bb..9ad7b1900 100644 --- a/sys-utils/lsipc.c +++ b/sys-utils/lsipc.c @@ -136,7 +136,7 @@ struct lsipc_control { }; struct lsipc_coldesc { - const char *name; + const char * const name; const char *help; const char *pretty_name; diff --git a/sys-utils/prlimit.c b/sys-utils/prlimit.c index ca69ccf98..e067c8cd7 100644 --- a/sys-utils/prlimit.c +++ b/sys-utils/prlimit.c @@ -114,14 +114,14 @@ enum { /* column names */ struct colinfo { - const char *name; /* header */ - double whint; /* width hint (N < 1 is in percent of termwidth) */ - int flags; /* SCOLS_FL_* */ - const char *help; + const char * const name; /* header */ + double whint; /* width hint (N < 1 is in percent of termwidth) */ + int flags; /* SCOLS_FL_* */ + const char *help; }; /* columns descriptions */ -static struct colinfo infos[] = { +static const struct colinfo infos[] = { [COL_RES] = { "RESOURCE", 0.25, SCOLS_FL_TRUNC, N_("resource name") }, [COL_HELP] = { "DESCRIPTION", 0.1, SCOLS_FL_TRUNC, N_("resource description")}, [COL_SOFT] = { "SOFT", 0.1, SCOLS_FL_RIGHT, N_("soft limit")}, @@ -222,7 +222,7 @@ static inline int get_column_id(int num) return columns[num]; } -static inline struct colinfo *get_column_info(unsigned num) +static inline const struct colinfo *get_column_info(unsigned num) { return &infos[ get_column_id(num) ]; } @@ -314,7 +314,7 @@ static int show_limits(struct list_head *lims) scols_table_enable_noheadings(table, no_headings); for (i = 0; i < ncolumns; i++) { - struct colinfo *col = get_column_info(i); + const struct colinfo *col = get_column_info(i); if (!scols_table_new_column(table, col->name, col->whint, col->flags)) err(EXIT_FAILURE, _("failed to allocate output column")); diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c index 87355491d..81c383a29 100644 --- a/sys-utils/swapon.c +++ b/sys-utils/swapon.c @@ -77,10 +77,10 @@ enum { /* column names */ struct colinfo { - const char *name; /* header */ - double whint; /* width hint (N < 1 is in percent of termwidth) */ - int flags; /* SCOLS_FL_* */ - const char *help; + const char * const name; /* header */ + double whint; /* width hint (N < 1 is in percent of termwidth) */ + int flags; /* SCOLS_FL_* */ + const char *help; }; enum { @@ -92,7 +92,7 @@ enum { COL_UUID, COL_LABEL }; -static struct colinfo infos[] = { +static const struct colinfo infos[] = { [COL_PATH] = { "NAME", 0.20, 0, N_("device file or partition path") }, [COL_TYPE] = { "TYPE", 0.20, SCOLS_FL_TRUNC, N_("type of the device")}, [COL_SIZE] = { "SIZE", 0.20, SCOLS_FL_RIGHT, N_("size of the swap area")}, @@ -159,7 +159,7 @@ static inline int get_column_id(const struct swapon_ctl *ctl, int num) return ctl->columns[num]; } -static inline struct colinfo *get_column_info(const struct swapon_ctl *ctl, unsigned num) +static inline const struct colinfo *get_column_info(const struct swapon_ctl *ctl, unsigned num) { return &infos[get_column_id(ctl, num)]; } @@ -299,7 +299,7 @@ static int show_table(struct swapon_ctl *ctl) scols_table_enable_noheadings(table, ctl->no_heading); for (i = 0; i < ctl->ncolumns; i++) { - struct colinfo *col = get_column_info(ctl, i); + const struct colinfo *col = get_column_info(ctl, i); if (!scols_table_new_column(table, col->name, col->whint, col->flags)) err(EXIT_FAILURE, _("failed to allocate output column")); diff --git a/sys-utils/wdctl.c b/sys-utils/wdctl.c index 2a656b85b..a5fdeaeb2 100644 --- a/sys-utils/wdctl.c +++ b/sys-utils/wdctl.c @@ -87,16 +87,16 @@ static const struct wdflag wdflags[] = { /* column names */ struct colinfo { - const char *name; /* header */ - double whint; /* width hint (N < 1 is in percent of termwidth) */ - int flags; /* SCOLS_FL_* */ - const char *help; + const char * const name; /* header */ + double whint; /* width hint (N < 1 is in percent of termwidth) */ + int flags; /* SCOLS_FL_* */ + const char *help; }; enum { COL_FLAG, COL_DESC, COL_STATUS, COL_BSTATUS, COL_DEVICE }; /* columns descriptions */ -static struct colinfo infos[] = { +static const struct colinfo infos[] = { [COL_FLAG] = { "FLAG", 14, 0, N_("flag name") }, [COL_DESC] = { "DESCRIPTION", 0.1, SCOLS_FL_TRUNC, N_("flag description") }, [COL_STATUS] = { "STATUS", 1, SCOLS_FL_RIGHT, N_("flag status") }, @@ -188,7 +188,7 @@ static int get_column_id(int num) return columns[num]; } -static struct colinfo *get_column_info(unsigned num) +static const struct colinfo *get_column_info(unsigned num) { return &infos[ get_column_id(num) ]; } @@ -354,7 +354,7 @@ static int show_flags(struct wd_control *ctl, struct wd_device *wd, uint32_t wan /* define columns */ for (i = 0; i < (size_t) ncolumns; i++) { - struct colinfo *col = get_column_info(i); + const struct colinfo *col = get_column_info(i); if (!scols_table_new_column(table, col->name, col->whint, col->flags)) { warnx(_("failed to allocate output column"));