])
]) # LIBCFS_TIMER_DELETE
+#
+# LIBCFS_CONSTIFY_CTR_TABLE
+#
+# Linux commit v6.10-12269-g78eb4ea25cd5
+# sysctl: treewide: constify the ctl_table argument of proc_handlers
+#
+AC_DEFUN([LIBCFS_SRC_CONSTIFY_CTR_TABLE],[
+ LB2_LINUX_TEST_SRC([constify_struct_ctl_table], [
+ #include <linux/sysctl.h>
+
+ static int handler(const struct ctl_table *table, int write,
+ void __user *buf, size_t *lenp, loff_t *ppos)
+ {
+ return 0;
+ }
+ ],[
+ static struct ctl_table ctl_tbl __attribute__ ((unused)) = {
+ .proc_handler = &handler,
+ };
+ ],[-Werror])
+])
+AC_DEFUN([LIBCFS_CONSTIFY_CTR_TABLE],[
+ LB2_MSG_LINUX_TEST_RESULT(
+ [if struct ctl_table argument to proc_handler() is const],
+ [constify_struct_ctl_table], [
+ AC_DEFINE(HAVE_CONST_CTR_TABLE, 1,
+ [struct ctl_table argument to proc_handler() is const])
+ ])
+]) # LIBCFS_CONSTIFY_CTR_TABLE
+
+#
+# LIBCFS_BLK_INTEGRITY_NOVERIFY
+#
+# Linux commit v6.10-rc3-25-g9f4aa46f2a74
+# block: invert the BLK_INTEGRITY_{GENERATE,VERIFY} flags
+#
+AC_DEFUN([LIBCFS_SRC_BLK_INTEGRITY_NOVERIFY], [
+ LB2_LINUX_TEST_SRC([blk_integrity_noverify], [
+ #include <linux/blk-integrity.h>
+ ],[
+ int flag __attribute__ ((unused)) = BLK_INTEGRITY_NOVERIFY;
+ ],[-Werror])
+])
+AC_DEFUN([LIBCFS_BLK_INTEGRITY_NOVERIFY], [
+ LB2_MSG_LINUX_TEST_RESULT([if BLK_INTEGRITY_NOVERIFY is available],
+ [blk_integrity_noverify], [
+ AC_DEFINE(HAVE_BLK_INTEGRITY_NOVERIFY, 1,
+ [BLK_INTEGRITY_NOVERIFY is available])
+ ])
+]) # LIBCFS_BLK_INTEGRITY_NOVERIFY
+
dnl #
dnl # Generate and compile all of the kernel API test cases to determine
dnl # which interfaces are available. By invoking the kernel build system
# 6.2
LIBCFS_SRC_TIMER_DELETE_SYNC
LIBCFS_SRC_TIMER_DELETE
+ # 6.11
+ LIBCFS_SRC_CONSTIFY_CTR_TABLE
+ LIBCFS_SRC_BLK_INTEGRITY_NOVERIFY
])
dnl #
# 6.2
LIBCFS_TIMER_DELETE_SYNC
LIBCFS_TIMER_DELETE
+ # 6.11
+ LIBCFS_CONSTIFY_CTR_TABLE
+ LIBCFS_BLK_INTEGRITY_NOVERIFY
])
#
extern struct workqueue_struct *cfs_rehash_wq;
-void lnet_insert_debugfs(struct ctl_table *table, struct module *mod,
- void **statep);
-void lnet_remove_debugfs(struct ctl_table *table);
+#ifdef HAVE_CONST_CTR_TABLE
+#define DEFINE_CTL_TABLE_INIT(__name, init)\
+ const struct ctl_table *__name = init
+#define cfs_proc_handler(h) (h)
+#else
+#define DEFINE_CTL_TABLE_INIT(__name, init)\
+ struct ctl_table *__name = init
+typedef int (*cfs_ctl_table_handler_t)(struct ctl_table *,
+ int, void __user *, size_t *, loff_t *);
+#define cfs_proc_handler(h) ((cfs_ctl_table_handler_t)(h))
+#endif
+
+void lnet_insert_debugfs(const struct ctl_table *table,
+ struct module *mod, void **statep);
+void lnet_remove_debugfs(const struct ctl_table *table);
void lnet_debugfs_fini(void **statep);
/* helper for sysctl handlers */
-int debugfs_doint(struct ctl_table *table, int write,
+int debugfs_doint(const struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos);
/*
EXPORT_SYMBOL(libcfs_ioctl);
#endif
-static int proc_dobitmasks(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int proc_dobitmasks(const struct ctl_table *table,
+ int write, void __user *buffer, size_t *lenp,
+ loff_t *ppos)
{
const int tmpstrlen = 512;
char *tmpstr = NULL;
static int min_watchdog_ratelimit; /* disable ratelimiting */
static int max_watchdog_ratelimit = (24*60*60); /* limit to once per day */
-static int proc_dump_kernel(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int proc_dump_kernel(const struct ctl_table *table,
+ int write, void __user *buffer, size_t *lenp,
+ loff_t *ppos)
{
size_t nob = *lenp;
return cfs_trace_dump_debug_buffer_usrstr(buffer, nob);
}
-static int proc_daemon_file(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int proc_daemon_file(const struct ctl_table *table,
+ int write, void __user *buffer, size_t *lenp,
+ loff_t *ppos)
{
size_t nob = *lenp;
loff_t pos = *ppos;
return cfs_trace_daemon_command_usrstr(buffer, nob);
}
-static int libcfs_force_lbug(struct ctl_table *table, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos)
+static int libcfs_force_lbug(const struct ctl_table *table,
+ int write, void __user *buffer, size_t *lenp,
+ loff_t *ppos)
{
if (write)
LBUG();
return 0;
}
-static int proc_fail_loc(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int proc_fail_loc(const struct ctl_table *table,
+ int write, void __user *buffer, size_t *lenp,
+ loff_t *ppos)
{
int rc;
long old_fail_loc = cfs_fail_loc;
return rc;
}
-static int libcfs_debug_marker(struct ctl_table *table, int write,
- void __user *buffer,
+static int libcfs_debug_marker(const struct ctl_table *table,
+ int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
size_t len = min(*lenp, 4000UL);
return *lenp > 4000 ? -EOVERFLOW : 0;
}
-int debugfs_doint(struct ctl_table *table, int write,
+int debugfs_doint(const struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
int rc;
}
EXPORT_SYMBOL(debugfs_doint);
-static int debugfs_dou64(struct ctl_table *table, int write,
+static int debugfs_dou64(const struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
int rc;
return rc;
}
-static int debugfs_dostring(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int debugfs_dostring(const struct ctl_table *table,
+ int write, void __user *buffer, size_t *lenp,
+ loff_t *ppos)
{
int len = *lenp;
char *kbuf = table->data;
.data = &libcfs_debug,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = &proc_dobitmasks,
+ .proc_handler = cfs_proc_handler(&proc_dobitmasks),
},
{
.procname = "subsystem_debug",
.data = &libcfs_subsystem_debug,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = &proc_dobitmasks,
+ .proc_handler = cfs_proc_handler(&proc_dobitmasks),
},
{
.procname = "printk",
.data = &libcfs_printk,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = &proc_dobitmasks,
+ .proc_handler = cfs_proc_handler(&proc_dobitmasks),
},
{
.procname = "debug_log_upcall",
.data = lnet_debug_log_upcall,
.maxlen = sizeof(lnet_debug_log_upcall),
.mode = 0644,
- .proc_handler = &debugfs_dostring,
+ .proc_handler = cfs_proc_handler(&debugfs_dostring),
},
{
.procname = "lnet_memused",
.data = (u64 *)&libcfs_kmem.counter,
.maxlen = sizeof(u64),
.mode = 0444,
- .proc_handler = &debugfs_dou64,
+ .proc_handler = cfs_proc_handler(&debugfs_dou64),
},
{
.procname = "catastrophe",
.data = &libcfs_catastrophe,
.maxlen = sizeof(int),
.mode = 0444,
- .proc_handler = &debugfs_doint,
+ .proc_handler = cfs_proc_handler(&debugfs_doint),
},
{
.procname = "dump_kernel",
.maxlen = 256,
.mode = 0200,
- .proc_handler = &proc_dump_kernel,
+ .proc_handler = cfs_proc_handler(&proc_dump_kernel),
},
{
.procname = "daemon_file",
.mode = 0644,
.maxlen = 256,
- .proc_handler = &proc_daemon_file,
+ .proc_handler = cfs_proc_handler(&proc_daemon_file),
},
{
.procname = "watchdog_ratelimit",
.data = &libcfs_watchdog_ratelimit,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = &debugfs_doint,
+ .proc_handler = cfs_proc_handler(&debugfs_doint),
.extra1 = &min_watchdog_ratelimit,
.extra2 = &max_watchdog_ratelimit,
},
{
.procname = "debug_marker",
.mode = 0200,
- .proc_handler = &libcfs_debug_marker
+ .proc_handler = cfs_proc_handler(&libcfs_debug_marker)
},
{
.procname = "force_lbug",
.data = NULL,
.maxlen = 0,
.mode = 0200,
- .proc_handler = &libcfs_force_lbug
+ .proc_handler = cfs_proc_handler(&libcfs_force_lbug)
},
{
.procname = "fail_loc",
.data = &cfs_fail_loc,
.maxlen = sizeof(cfs_fail_loc),
.mode = 0644,
- .proc_handler = &proc_fail_loc
+ .proc_handler = cfs_proc_handler(&proc_fail_loc)
},
{
.procname = "fail_val",
.data = &cfs_fail_val,
.maxlen = sizeof(int),
.mode = 0644,
- .proc_handler = &debugfs_doint
+ .proc_handler = cfs_proc_handler(&debugfs_doint)
},
{
.procname = "fail_err",
.data = &cfs_fail_err,
.maxlen = sizeof(cfs_fail_err),
.mode = 0644,
- .proc_handler = &debugfs_doint,
+ .proc_handler = cfs_proc_handler(&debugfs_doint),
},
{
}
static ssize_t lnet_debugfs_read(struct file *filp, char __user *buf,
size_t count, loff_t *ppos)
{
- struct ctl_table *table = filp->private_data;
+ DEFINE_CTL_TABLE_INIT(table, filp->private_data);
loff_t old_pos = *ppos;
ssize_t rc = -EINVAL;
static ssize_t lnet_debugfs_write(struct file *filp, const char __user *buf,
size_t count, loff_t *ppos)
{
- struct ctl_table *table = filp->private_data;
+ DEFINE_CTL_TABLE_INIT(table, filp->private_data);
loff_t old_pos = *ppos;
ssize_t rc = -EINVAL;
return &state[2];
}
-void lnet_insert_debugfs(struct ctl_table *table, struct module *mod,
- void **statep)
+void lnet_insert_debugfs(const struct ctl_table *table,
+ struct module *mod, void **statep)
{
struct file_operations *state = *statep;
if (!lnet_debugfs_root)
*/
for (; table && table->procname; table++)
debugfs_create_file(table->procname, table->mode,
- lnet_debugfs_root, table,
+ lnet_debugfs_root, (void *)table,
lnet_debugfs_fops_select(table->mode,
(const struct file_operations *)state));
}
symlinks->target);
}
-void lnet_remove_debugfs(struct ctl_table *table)
+void lnet_remove_debugfs(const struct ctl_table *table)
{
for (; table && table->procname; table++) {
struct qstr dname = QSTR_INIT(table->procname,
#define LNET_PROC_VERSION(v) ((unsigned int)((v) & LNET_PROC_VER_MASK))
-static int proc_cpt_table(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int proc_cpt_table(const struct ctl_table *table,
+ int write, void __user *buffer, size_t *lenp,
+ loff_t *ppos)
{
size_t nob = *lenp;
loff_t pos = *ppos;
return rc;
}
-static int proc_cpt_distance(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int proc_cpt_distance(const struct ctl_table *table,
+ int write, void __user *buffer, size_t *lenp,
+ loff_t *ppos)
{
size_t nob = *lenp;
loff_t pos = *ppos;
return rc;
}
-static int proc_lnet_stats(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int proc_lnet_stats(const struct ctl_table *table,
+ int write, void __user *buffer, size_t *lenp,
+ loff_t *ppos)
{
int rc;
struct lnet_counters *ctrs;
}
static int
-proc_lnet_routes(struct ctl_table *table, int write, void __user *buffer,
- size_t *lenp, loff_t *ppos)
+proc_lnet_routes(const struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
{
const int tmpsiz = 256;
char *tmpstr;
}
static int
-proc_lnet_routers(struct ctl_table *table, int write, void __user *buffer,
- size_t *lenp, loff_t *ppos)
+proc_lnet_routers(const struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
{
int rc = 0;
char *tmpstr;
/* TODO: there should be no direct access to ptable. We should add a set
* of APIs that give access to the ptable and its members */
static int
-proc_lnet_peers(struct ctl_table *table, int write, void __user *buffer,
- size_t *lenp, loff_t *ppos)
+proc_lnet_peers(const struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
{
const int tmpsiz = 256;
struct lnet_peer_table *ptable;
return rc;
}
-static int proc_lnet_buffers(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp, loff_t *ppos)
+static int proc_lnet_buffers(const struct ctl_table *table,
+ int write, void __user *buffer, size_t *lenp,
+ loff_t *ppos)
{
size_t nob = *lenp;
loff_t pos = *ppos;
}
static int
-proc_lnet_nis(struct ctl_table *table, int write, void __user *buffer,
- size_t *lenp, loff_t *ppos)
+proc_lnet_nis(const struct ctl_table *table, int write,
+ void __user *buffer, size_t *lenp, loff_t *ppos)
{
int tmpsiz = 128 * LNET_CPT_NUMBER;
int rc = 0;
},
};
-static int proc_lnet_portal_rotor(struct ctl_table *table, int write,
- void __user *buffer, size_t *lenp,
+static int proc_lnet_portal_rotor(const struct ctl_table *table,
+ int write, void __user *buffer, size_t *lenp,
loff_t *ppos)
{
const int buf_len = 128;
.procname = "cpu_partition_table",
.maxlen = 128,
.mode = 0444,
- .proc_handler = &proc_cpt_table,
+ .proc_handler = cfs_proc_handler(&proc_cpt_table),
},
{
.procname = "cpu_partition_distance",
.maxlen = 128,
.mode = 0444,
- .proc_handler = &proc_cpt_distance,
+ .proc_handler = cfs_proc_handler(&proc_cpt_distance),
},
{
.procname = "stats",
.mode = 0644,
- .proc_handler = &proc_lnet_stats,
+ .proc_handler = cfs_proc_handler(&proc_lnet_stats),
},
{
.procname = "routes",
.mode = 0444,
- .proc_handler = &proc_lnet_routes,
+ .proc_handler = cfs_proc_handler(&proc_lnet_routes),
},
{
.procname = "routers",
.mode = 0444,
- .proc_handler = &proc_lnet_routers,
+ .proc_handler = cfs_proc_handler(&proc_lnet_routers),
},
{
.procname = "peers",
.mode = 0644,
- .proc_handler = &proc_lnet_peers,
+ .proc_handler = cfs_proc_handler(&proc_lnet_peers),
},
{
.procname = "buffers",
.mode = 0444,
- .proc_handler = &proc_lnet_buffers,
+ .proc_handler = cfs_proc_handler(&proc_lnet_buffers),
},
{
.procname = "nis",
.mode = 0644,
- .proc_handler = &proc_lnet_nis,
+ .proc_handler = cfs_proc_handler(&proc_lnet_nis),
},
{
.procname = "portal_rotor",
.mode = 0644,
- .proc_handler = &proc_lnet_portal_rotor,
+ .proc_handler = cfs_proc_handler(&proc_lnet_portal_rotor),
},
{
.procname = "lnet_lnd_timeout",
.data = &lnet_lnd_timeout,
.maxlen = sizeof(lnet_lnd_timeout),
.mode = 0444,
- .proc_handler = &debugfs_doint,
+ .proc_handler = cfs_proc_handler(&debugfs_doint),
},
{ .procname = NULL }
};
]) # LC_IOP_GET_INODE_ACL
#
+# LC_HAVE_FOLIO_MAPCOUNT
+#
+# linux kernel v6.1-rc4-186-gcb67f4282bf9
+# mm,thp,rmap: simplify compound page mapcount handling
+#
+AC_DEFUN([LC_SRC_HAVE_FOLIO_MAPCOUNT], [
+ LB2_LINUX_TEST_SRC([folio_mapcount], [
+ #include <linux/mm.h>
+ ],[
+ (void)folio_mapcount((const struct folio *)NULL);
+ ],[-Werror])
+])
+AC_DEFUN([LC_HAVE_FOLIO_MAPCOUNT], [
+ LB2_MSG_LINUX_TEST_RESULT([if 'folio_mapcount()' is available],
+ [folio_mapcount], [
+ AC_DEFINE(HAVE_FOLIO_MAPCOUNT, 1,
+ ['folio_mapcount()' is available])
+ ])
+]) # LC_HAVE_FOLIO_MAPCOUNT
+
+#
# LC_HAVE_U64_CAPABILITY
#
# linux kernel v6.2-13111-gf122a08b197d
# 6.2
LC_SRC_HAVE_GET_RANDOM_U32_BELOW
LC_SRC_HAVE_ACL_WITH_DENTRY
+ LC_SRC_HAVE_FOLIO_MAPCOUNT
# 6.3
LC_SRC_HAVE_MNT_IDMAP_ARG
# 6.2
LC_HAVE_GET_RANDOM_U32_BELOW
LC_HAVE_ACL_WITH_DENTRY
+ LC_HAVE_FOLIO_MAPCOUNT
# 6.3
LC_HAVE_MNT_IDMAP_ARG
}
# endif /* HAVE_FOLIO_BATCH_REINIT */
+# define folio_index_page(pg) folio_index(page_folio((pg)))
+
#else /* !HAVE_FOLIO_BATCH && !HAVE_FILEMAP_GET_FOLIOS */
# ifdef HAVE_PAGEVEC
# define fbatch_at(pvec, n) ((pvec)->pages[(n)])
# define fbatch_at_npgs(pvec, n) 1
# define fbatch_at_pg(pvec, n, pg) ((pvec)->pages[(n)])
+# define folio_index_page(pg) page_index((pg))
+
#endif /* HAVE_FOLIO_BATCH && HAVE_FILEMAP_GET_FOLIOS */
#ifndef HAVE_FLUSH___WORKQUEUE
}
#endif /* !HAVE_INODE_GET_MTIME_SEC */
+#ifdef HAVE_FOLIO_MAPCOUNT
+/* clone of fs/proc/internal.h:
+ * folio_precise_page_mapcount(struct folio *folio, struct page *page)
+ */
+static inline int folio_mapcount_page(struct page *page)
+{
+ struct folio *folio = page_folio(page);
+ int mapcount = atomic_read(&page->_mapcount) + 1;
+
+ if (mapcount < PAGE_MAPCOUNT_RESERVE + 1)
+ mapcount = 0;
+ if (folio_test_large(folio))
+ mapcount += folio_entire_mapcount(folio);
+
+ return mapcount;
+}
+#else /* !HAVE_FOLIO_MAPCOUNT */
+#define folio_mapcount_page(pg) page_mapcount((pg))
+#endif /* HAVE_FOLIO_MAPCOUNT */
+
#endif /* _LUSTRE_COMPAT_H */
#ifndef HAVE_RADIX_TREE_TAG_SET
__xa_set_mark(&mapping->i_pages, page_index(page), PAGECACHE_TAG_DIRTY);
#else
- radix_tree_tag_set(&mapping->page_tree, page_index(page),
+ radix_tree_tag_set(&mapping->page_tree, folio_index_page(page),
PAGECACHE_TAG_DIRTY);
#endif
}
if (vmpage != NULL) {
(*printer)(env, cookie, " %lx %d:%d %lx %lu %slru",
(long)vmpage->flags, page_count(vmpage),
- page_mapcount(vmpage), vmpage->private,
- page_index(vmpage),
+ folio_mapcount_page(vmpage), vmpage->private,
+ folio_index_page(vmpage),
list_empty(&vmpage->lru) ? "not-" : "");
}
struct page *vmpage = cl_page_vmpage(page);
/* vmpage have two known users: cl_page and VM page cache */
- if (page_count(vmpage) - page_mapcount(vmpage) > 2)
+ if ((page_count(vmpage) - folio_mapcount_page(vmpage)) > 2)
return true;
}
return false;
static inline const char *blk_integrity_name(struct blk_integrity *bi)
{
-#ifdef HAVE_INTERVAL_EXP_BLK_INTEGRITY
+#ifdef HAVE_BLK_INTEGRITY_NOVERIFY
+ return blk_integrity_profile_name(bi);
+#elif defined HAVE_INTERVAL_EXP_BLK_INTEGRITY
return bi->profile->name;
#else
return bi->name;
static inline unsigned int bip_size(struct bio_integrity_payload *bip)
{
-#ifdef HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
+#ifdef HAVE_BLK_INTEGRITY_NOVERIFY
+ return bip->bip_iter.bi_size;
+#elif defined HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
return bip->bip_iter.bi_size;
#else
return bip->bip_size;
}
#endif /* !CONFIG_BLK_DEV_INTEGRITY */
+#ifdef HAVE_BLK_INTEGRITY_NOVERIFY
+#define INTEGRITY_READ(flag) (!(BLK_INTEGRITY_NOVERIFY & (flag)))
+#define INTEGRITY_WRITE(flag) (!(BLK_INTEGRITY_NOGENERATE & (flag)))
+
+#else /* !HAVE_BLK_INTEGRITY_NOVERIFY */
+
#ifndef INTEGRITY_FLAG_READ
#define INTEGRITY_FLAG_READ BLK_INTEGRITY_VERIFY
#endif
#define INTEGRITY_FLAG_WRITE BLK_INTEGRITY_GENERATE
#endif
+#define INTEGRITY_READ(flag) (INTEGRITY_FLAG_READ & (flag))
+#define INTEGRITY_WRITE(flag) (INTEGRITY_FLAG_WRITE & (flag))
+#endif /* HAVE_BLK_INTEGRITY_NOVERIFY */
+
static inline bool bdev_integrity_enabled(struct block_device *bdev, int rw)
{
#if IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY)
if (bi == NULL)
return false;
-#ifdef HAVE_INTERVAL_EXP_BLK_INTEGRITY
+#ifdef HAVE_BLK_INTEGRITY_NOVERIFY
+ if (rw == 0 && INTEGRITY_READ(bi->flags))
+ return true;
+
+ if (rw == 1 && INTEGRITY_WRITE(bi->flags))
+ return true;
+
+#elif defined HAVE_INTERVAL_EXP_BLK_INTEGRITY
if (rw == 0 && bi->profile->verify_fn != NULL &&
- (bi->flags & INTEGRITY_FLAG_READ))
+ INTEGRITY_READ(bi->flags))
return true;
if (rw == 1 && bi->profile->generate_fn != NULL &&
- (bi->flags & INTEGRITY_FLAG_WRITE))
+ INTEGRITY_WRITE(bi->flags))
return true;
#else
- if (rw == 0 && bi->verify_fn != NULL &&
- (bi->flags & INTEGRITY_FLAG_READ))
+ if (rw == 0 && bi->verify_fn != NULL && INTEGRITY_READ(bi->flags))
return true;
- if (rw == 1 && bi->generate_fn != NULL &&
- (bi->flags & INTEGRITY_FLAG_WRITE))
+ if (rw == 1 && bi->generate_fn != NULL && INTEGRITY_WRITE(bi->flags))
return true;
#endif /* !HAVE_INTERVAL_EXP_BLK_INTEGRITY */
#endif /* !CONFIG_BLK_DEV_INTEGRITY */
return -ENAMETOOLONG;
}
- strncpy(fsname, param, fsname_len);
- fsname[fsname_len] = '\0';
+ snprintf(fsname, fsname_len + 1, "%s", param);
if (!ptr)
return 0;