Skip to content

Commit 272e42b

Browse files
Christoph HellwigAlex Elder
authored andcommitted
xfs: constify xfs_item_ops
The log item ops aren't nessecarily the biggest exploit vector, but marking them const is easy enough. Also remove the unused xfs_item_ops_t typedef while we're at it. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Alex Elder <aelder@sgi.com>
1 parent b52a360 commit 272e42b

7 files changed

Lines changed: 12 additions & 12 deletions

File tree

‎fs/xfs/xfs_buf_item.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ xfs_buf_item_committing(
656656
/*
657657
* This is the ops vector shared by all buf log items.
658658
*/
659-
static struct xfs_item_ops xfs_buf_item_ops = {
659+
static const struct xfs_item_ops xfs_buf_item_ops = {
660660
.iop_size = xfs_buf_item_size,
661661
.iop_format = xfs_buf_item_format,
662662
.iop_pin = xfs_buf_item_pin,

‎fs/xfs/xfs_dquot_item.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ xfs_qm_dquot_logitem_committing(
295295
/*
296296
* This is the ops vector for dquots
297297
*/
298-
static struct xfs_item_ops xfs_dquot_item_ops = {
298+
static const struct xfs_item_ops xfs_dquot_item_ops = {
299299
.iop_size = xfs_qm_dquot_logitem_size,
300300
.iop_format = xfs_qm_dquot_logitem_format,
301301
.iop_pin = xfs_qm_dquot_logitem_pin,
@@ -483,7 +483,7 @@ xfs_qm_qoff_logitem_committing(
483483
{
484484
}
485485

486-
static struct xfs_item_ops xfs_qm_qoffend_logitem_ops = {
486+
static const struct xfs_item_ops xfs_qm_qoffend_logitem_ops = {
487487
.iop_size = xfs_qm_qoff_logitem_size,
488488
.iop_format = xfs_qm_qoff_logitem_format,
489489
.iop_pin = xfs_qm_qoff_logitem_pin,
@@ -498,7 +498,7 @@ static struct xfs_item_ops xfs_qm_qoffend_logitem_ops = {
498498
/*
499499
* This is the ops vector shared by all quotaoff-start log items.
500500
*/
501-
static struct xfs_item_ops xfs_qm_qoff_logitem_ops = {
501+
static const struct xfs_item_ops xfs_qm_qoff_logitem_ops = {
502502
.iop_size = xfs_qm_qoff_logitem_size,
503503
.iop_format = xfs_qm_qoff_logitem_format,
504504
.iop_pin = xfs_qm_qoff_logitem_pin,

‎fs/xfs/xfs_extfree_item.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ xfs_efi_item_committing(
217217
/*
218218
* This is the ops vector shared by all efi log items.
219219
*/
220-
static struct xfs_item_ops xfs_efi_item_ops = {
220+
static const struct xfs_item_ops xfs_efi_item_ops = {
221221
.iop_size = xfs_efi_item_size,
222222
.iop_format = xfs_efi_item_format,
223223
.iop_pin = xfs_efi_item_pin,
@@ -477,7 +477,7 @@ xfs_efd_item_committing(
477477
/*
478478
* This is the ops vector shared by all efd log items.
479479
*/
480-
static struct xfs_item_ops xfs_efd_item_ops = {
480+
static const struct xfs_item_ops xfs_efd_item_ops = {
481481
.iop_size = xfs_efd_item_size,
482482
.iop_format = xfs_efd_item_format,
483483
.iop_pin = xfs_efd_item_pin,

‎fs/xfs/xfs_inode_item.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ xfs_inode_item_committing(
795795
/*
796796
* This is the ops vector shared by all buf log items.
797797
*/
798-
static struct xfs_item_ops xfs_inode_item_ops = {
798+
static const struct xfs_item_ops xfs_inode_item_ops = {
799799
.iop_size = xfs_inode_item_size,
800800
.iop_format = xfs_inode_item_format,
801801
.iop_pin = xfs_inode_item_pin,

‎fs/xfs/xfs_log.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ xfs_log_item_init(
626626
struct xfs_mount *mp,
627627
struct xfs_log_item *item,
628628
int type,
629-
struct xfs_item_ops *ops)
629+
const struct xfs_item_ops *ops)
630630
{
631631
item->li_mountp = mp;
632632
item->li_ailp = mp->m_ail;

‎fs/xfs/xfs_log.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ struct xfs_trans;
137137
void xfs_log_item_init(struct xfs_mount *mp,
138138
struct xfs_log_item *item,
139139
int type,
140-
struct xfs_item_ops *ops);
140+
const struct xfs_item_ops *ops);
141141

142142
xfs_lsn_t xfs_log_done(struct xfs_mount *mp,
143143
struct xlog_ticket *ticket,

‎fs/xfs/xfs_trans.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ typedef struct xfs_log_item {
326326
struct xfs_log_item *);
327327
/* buffer item iodone */
328328
/* callback func */
329-
struct xfs_item_ops *li_ops; /* function list */
329+
const struct xfs_item_ops *li_ops; /* function list */
330330

331331
/* delayed logging */
332332
struct list_head li_cil; /* CIL pointers */
@@ -341,7 +341,7 @@ typedef struct xfs_log_item {
341341
{ XFS_LI_IN_AIL, "IN_AIL" }, \
342342
{ XFS_LI_ABORTED, "ABORTED" }
343343

344-
typedef struct xfs_item_ops {
344+
struct xfs_item_ops {
345345
uint (*iop_size)(xfs_log_item_t *);
346346
void (*iop_format)(xfs_log_item_t *, struct xfs_log_iovec *);
347347
void (*iop_pin)(xfs_log_item_t *);
@@ -352,7 +352,7 @@ typedef struct xfs_item_ops {
352352
void (*iop_push)(xfs_log_item_t *);
353353
bool (*iop_pushbuf)(xfs_log_item_t *);
354354
void (*iop_committing)(xfs_log_item_t *, xfs_lsn_t);
355-
} xfs_item_ops_t;
355+
};
356356

357357
#define IOP_SIZE(ip) (*(ip)->li_ops->iop_size)(ip)
358358
#define IOP_FORMAT(ip,vp) (*(ip)->li_ops->iop_format)(ip, vp)

0 commit comments

Comments
 (0)