Skip to content

Commit 2ee8333

Browse files
t-8chDarrick J. Wong
authored andcommitted
xfs: make kobj_type structures constant
Since commit ee6d3dd ("driver core: make kobj_type constant.") the driver core allows the usage of const struct kobj_type. Take advantage of this to constify the structure definitions to prevent modification at runtime. Signed-off-by: Thomas Weißschuh <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 167ce4c commit 2ee8333

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

fs/xfs/xfs_error.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ static struct attribute *xfs_errortag_attrs[] = {
228228
};
229229
ATTRIBUTE_GROUPS(xfs_errortag);
230230

231-
static struct kobj_type xfs_errortag_ktype = {
231+
static const struct kobj_type xfs_errortag_ktype = {
232232
.release = xfs_sysfs_release,
233233
.sysfs_ops = &xfs_errortag_sysfs_ops,
234234
.default_groups = xfs_errortag_groups,

fs/xfs/xfs_sysfs.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static struct attribute *xfs_mp_attrs[] = {
6969
};
7070
ATTRIBUTE_GROUPS(xfs_mp);
7171

72-
struct kobj_type xfs_mp_ktype = {
72+
const struct kobj_type xfs_mp_ktype = {
7373
.release = xfs_sysfs_release,
7474
.sysfs_ops = &xfs_sysfs_ops,
7575
.default_groups = xfs_mp_groups,
@@ -266,7 +266,7 @@ static struct attribute *xfs_dbg_attrs[] = {
266266
};
267267
ATTRIBUTE_GROUPS(xfs_dbg);
268268

269-
struct kobj_type xfs_dbg_ktype = {
269+
const struct kobj_type xfs_dbg_ktype = {
270270
.release = xfs_sysfs_release,
271271
.sysfs_ops = &xfs_sysfs_ops,
272272
.default_groups = xfs_dbg_groups,
@@ -324,7 +324,7 @@ static struct attribute *xfs_stats_attrs[] = {
324324
};
325325
ATTRIBUTE_GROUPS(xfs_stats);
326326

327-
struct kobj_type xfs_stats_ktype = {
327+
const struct kobj_type xfs_stats_ktype = {
328328
.release = xfs_sysfs_release,
329329
.sysfs_ops = &xfs_sysfs_ops,
330330
.default_groups = xfs_stats_groups,
@@ -410,7 +410,7 @@ static struct attribute *xfs_log_attrs[] = {
410410
};
411411
ATTRIBUTE_GROUPS(xfs_log);
412412

413-
struct kobj_type xfs_log_ktype = {
413+
const struct kobj_type xfs_log_ktype = {
414414
.release = xfs_sysfs_release,
415415
.sysfs_ops = &xfs_sysfs_ops,
416416
.default_groups = xfs_log_groups,
@@ -564,13 +564,13 @@ static struct attribute *xfs_error_attrs[] = {
564564
};
565565
ATTRIBUTE_GROUPS(xfs_error);
566566

567-
static struct kobj_type xfs_error_cfg_ktype = {
567+
static const struct kobj_type xfs_error_cfg_ktype = {
568568
.release = xfs_sysfs_release,
569569
.sysfs_ops = &xfs_sysfs_ops,
570570
.default_groups = xfs_error_groups,
571571
};
572572

573-
static struct kobj_type xfs_error_ktype = {
573+
static const struct kobj_type xfs_error_ktype = {
574574
.release = xfs_sysfs_release,
575575
.sysfs_ops = &xfs_sysfs_ops,
576576
};

fs/xfs/xfs_sysfs.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
#ifndef __XFS_SYSFS_H__
88
#define __XFS_SYSFS_H__
99

10-
extern struct kobj_type xfs_mp_ktype; /* xfs_mount */
11-
extern struct kobj_type xfs_dbg_ktype; /* debug */
12-
extern struct kobj_type xfs_log_ktype; /* xlog */
13-
extern struct kobj_type xfs_stats_ktype; /* stats */
10+
extern const struct kobj_type xfs_mp_ktype; /* xfs_mount */
11+
extern const struct kobj_type xfs_dbg_ktype; /* debug */
12+
extern const struct kobj_type xfs_log_ktype; /* xlog */
13+
extern const struct kobj_type xfs_stats_ktype; /* stats */
1414

1515
static inline struct xfs_kobj *
1616
to_kobj(struct kobject *kobject)
@@ -28,7 +28,7 @@ xfs_sysfs_release(struct kobject *kobject)
2828
static inline int
2929
xfs_sysfs_init(
3030
struct xfs_kobj *kobj,
31-
struct kobj_type *ktype,
31+
const struct kobj_type *ktype,
3232
struct xfs_kobj *parent_kobj,
3333
const char *name)
3434
{

0 commit comments

Comments
 (0)