mirror of
https://github.com/SCST-project/scst.git
synced 2026-10-22 14:12:33 +00:00
scst: Express permissions and kernel masks with standard forms
Replace attribute and daemon permission masks with their exact octal equivalents. Use BIT() for kernel session hash sizes and the target limit, including bitops explicitly in the shared kernel header. Preserve access policy, userspace protocol masks and the old 32-bit per-CPU reference bias. Checkpatch reports SYMBOLIC_PERMS: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'. Checkpatch reports BIT_MACRO: Prefer using the BIT macro
This commit is contained in:
+1
-1
@@ -87,7 +87,7 @@ struct ft_sess {
|
||||
* Hash lookup by remote port FC_ID.
|
||||
*/
|
||||
#define FT_SESS_HASH_BITS 6
|
||||
#define FT_SESS_HASH_SIZE (1 << FT_SESS_HASH_BITS)
|
||||
#define FT_SESS_HASH_SIZE BIT(FT_SESS_HASH_BITS)
|
||||
|
||||
/*
|
||||
* Per local port data.
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#undef DEFAULT_SYMBOL_NAMESPACE
|
||||
#define DEFAULT_SYMBOL_NAMESPACE SCST_NAMESPACE
|
||||
|
||||
#define MAX_NR_TARGETS (1UL << 30)
|
||||
#define MAX_NR_TARGETS BIT(30)
|
||||
|
||||
DEFINE_MUTEX(target_mgmt_mutex);
|
||||
|
||||
|
||||
@@ -967,16 +967,16 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
err = kernel_attr_add(NULL, ISCSI_ISNS_SERVER_ATTR_NAME,
|
||||
S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR, 0);
|
||||
0644, 0);
|
||||
if (err != 0)
|
||||
exit(err);
|
||||
|
||||
err = kernel_attr_add(NULL, ISCSI_ENABLED_ATTR_NAME,
|
||||
S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR, 0);
|
||||
0644, 0);
|
||||
if (err != 0)
|
||||
exit(err);
|
||||
err = kernel_attr_add(NULL, ISCSI_ISNS_ENTITY_ATTR_NAME,
|
||||
S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR, 0);
|
||||
0644, 0);
|
||||
if (err != 0)
|
||||
exit(err);
|
||||
err = kernel_attr_add(NULL, ISCSI_LINK_LOCAL_ATTR_NAME, 0644, 0);
|
||||
|
||||
@@ -107,7 +107,7 @@ static ssize_t sqa_version_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr, char *buf);
|
||||
|
||||
static struct kobj_attribute sqa_version_attr =
|
||||
__ATTR(version, S_IRUGO, sqa_version_show, NULL);
|
||||
__ATTR(version, 0444, sqa_version_show, NULL);
|
||||
|
||||
static const struct attribute *sqa_attrs[] = {
|
||||
&sqa_version_attr.attr,
|
||||
@@ -122,7 +122,7 @@ static ssize_t sqa_store_expl_conf_enabled(struct kobject *kobj,
|
||||
const char *buffer, size_t size);
|
||||
|
||||
static struct kobj_attribute sqa_expl_conf_attr =
|
||||
__ATTR(explicit_confirmation, S_IRUGO|S_IWUSR,
|
||||
__ATTR(explicit_confirmation, 0644,
|
||||
sqa_show_expl_conf_enabled, sqa_store_expl_conf_enabled);
|
||||
|
||||
static ssize_t sqa_abort_isp_store(struct kobject *kobj,
|
||||
@@ -130,20 +130,20 @@ static ssize_t sqa_abort_isp_store(struct kobject *kobj,
|
||||
const char *buffer, size_t size);
|
||||
|
||||
static struct kobj_attribute sqa_abort_isp_attr =
|
||||
__ATTR(abort_isp, S_IWUSR, NULL, sqa_abort_isp_store);
|
||||
__ATTR(abort_isp, 0200, NULL, sqa_abort_isp_store);
|
||||
|
||||
static ssize_t sqa_hw_target_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr, char *buf);
|
||||
|
||||
static struct kobj_attribute sqa_hw_target_attr =
|
||||
__ATTR(hw_target, S_IRUGO, sqa_hw_target_show, NULL);
|
||||
__ATTR(hw_target, 0444, sqa_hw_target_show, NULL);
|
||||
|
||||
static ssize_t sqa_node_name_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr, char *buf);
|
||||
|
||||
#if EXCLUDED
|
||||
static struct kobj_attribute sqa_vp_node_name_attr =
|
||||
__ATTR(node_name, S_IRUGO, sqa_node_name_show, NULL);
|
||||
__ATTR(node_name, 0444, sqa_node_name_show, NULL);
|
||||
#endif
|
||||
|
||||
static ssize_t sqa_node_name_store(struct kobject *kobj,
|
||||
@@ -151,7 +151,7 @@ static ssize_t sqa_node_name_store(struct kobject *kobj,
|
||||
const char *buffer, size_t size);
|
||||
|
||||
static struct kobj_attribute sqa_hw_node_name_attr =
|
||||
__ATTR(node_name, S_IRUGO|S_IWUSR, sqa_node_name_show,
|
||||
__ATTR(node_name, 0644, sqa_node_name_show,
|
||||
sqa_node_name_store);
|
||||
|
||||
#if EXCLUDED
|
||||
@@ -159,7 +159,7 @@ static ssize_t sqa_vp_parent_host_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr, char *buf);
|
||||
|
||||
static struct kobj_attribute sqa_vp_parent_host_attr =
|
||||
__ATTR(parent_host, S_IRUGO, sqa_vp_parent_host_show, NULL);
|
||||
__ATTR(parent_host, 0444, sqa_vp_parent_host_show, NULL);
|
||||
#endif
|
||||
|
||||
static const struct attribute *sqa_tgt_attrs[] = {
|
||||
|
||||
+2
-1
@@ -30,6 +30,7 @@
|
||||
#define CONFIG_SCST_DIF_INJECT_CORRUPTED_TAGS
|
||||
#define CONFIG_SCST_NO_TOTAL_MEM_CHECKS
|
||||
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/kref.h>
|
||||
#ifndef INSIDE_KERNEL_TREE
|
||||
@@ -1828,7 +1829,7 @@ struct scst_session {
|
||||
* tgt_dev_list_mutex. Modifying is only allowed when holding
|
||||
* tgt_dev_list_mutex.
|
||||
*/
|
||||
#define SESS_TGT_DEV_LIST_HASH_SIZE (1 << 5)
|
||||
#define SESS_TGT_DEV_LIST_HASH_SIZE BIT(5)
|
||||
#define SESS_TGT_DEV_LIST_HASH_FN(val) ((val) & (SESS_TGT_DEV_LIST_HASH_SIZE - 1))
|
||||
struct list_head sess_tgt_dev_list[SESS_TGT_DEV_LIST_HASH_SIZE];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user