Remove "mode" sysfs property of casdsk_disk
After removal of PT mode this property is meaningless. Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
parent
563aeb0058
commit
16576c7a95
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright(c) 2012-2021 Intel Corporation
|
# Copyright(c) 2012-2022 Intel Corporation
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
include $(M)/config.mk
|
include $(M)/config.mk
|
||||||
@ -9,4 +9,3 @@ obj-m := cas_disk.o
|
|||||||
cas_disk-objs = main.o
|
cas_disk-objs = main.o
|
||||||
cas_disk-objs += disk.o
|
cas_disk-objs += disk.o
|
||||||
cas_disk-objs += exp_obj.o
|
cas_disk-objs += exp_obj.o
|
||||||
cas_disk-objs += sysfs.o
|
|
||||||
|
@ -10,14 +10,9 @@
|
|||||||
#include "cas_cache.h"
|
#include "cas_cache.h"
|
||||||
#include "disk.h"
|
#include "disk.h"
|
||||||
#include "exp_obj.h"
|
#include "exp_obj.h"
|
||||||
#include "sysfs.h"
|
|
||||||
|
|
||||||
#define CASDSK_DISK_OPEN_FMODE (FMODE_READ | FMODE_WRITE)
|
#define CASDSK_DISK_OPEN_FMODE (FMODE_READ | FMODE_WRITE)
|
||||||
|
|
||||||
static const char * const _casdsk_disk_modes[] = {
|
|
||||||
[CASDSK_MODE_ATTACHED] = "attached",
|
|
||||||
};
|
|
||||||
|
|
||||||
static void _casdsk_disk_release(struct kobject *kobj)
|
static void _casdsk_disk_release(struct kobject *kobj)
|
||||||
{
|
{
|
||||||
struct casdsk_disk *dsk;
|
struct casdsk_disk *dsk;
|
||||||
@ -34,28 +29,8 @@ static void _casdsk_disk_release(struct kobject *kobj)
|
|||||||
kmem_cache_free(casdsk_module->disk_cache, dsk);
|
kmem_cache_free(casdsk_module->disk_cache, dsk);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t _casdsk_disk_mode_show(struct kobject *kobj, char *page)
|
|
||||||
{
|
|
||||||
struct casdsk_disk *dsk = casdsk_kobj_to_disk(kobj);
|
|
||||||
|
|
||||||
CASDSK_DEBUG_DISK_TRACE(dsk);
|
|
||||||
|
|
||||||
return scnprintf(page, PAGE_SIZE, "%s",
|
|
||||||
_casdsk_disk_modes[atomic_read(&dsk->mode)]);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct casdsk_attribute _casdsk_disk_mode_attr =
|
|
||||||
__ATTR(mode, S_IRUGO, _casdsk_disk_mode_show, NULL);
|
|
||||||
|
|
||||||
static struct attribute *_casdsk_disk_attrs[] = {
|
|
||||||
&_casdsk_disk_mode_attr.attr,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct kobj_type casdsk_disk_ktype = {
|
static struct kobj_type casdsk_disk_ktype = {
|
||||||
.release = _casdsk_disk_release,
|
.release = _casdsk_disk_release,
|
||||||
.sysfs_ops = &casdsk_sysfs_ops,
|
|
||||||
.default_attrs = _casdsk_disk_attrs
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int __init casdsk_init_disks(void)
|
int __init casdsk_init_disks(void)
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#include "cas_disk.h"
|
#include "cas_disk.h"
|
||||||
#include "disk.h"
|
#include "disk.h"
|
||||||
#include "exp_obj.h"
|
#include "exp_obj.h"
|
||||||
#include "sysfs.h"
|
|
||||||
|
|
||||||
/* Layer information. */
|
/* Layer information. */
|
||||||
MODULE_AUTHOR("Intel(R) Corporation");
|
MODULE_AUTHOR("Intel(R) Corporation");
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright(c) 2012-2021 Intel Corporation
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
*/
|
|
||||||
#include "cas_disk_defs.h"
|
|
||||||
#include "sysfs.h"
|
|
||||||
|
|
||||||
static ssize_t _casdsk_sysfs_show(struct kobject *kobj, struct attribute *attr,
|
|
||||||
char *page)
|
|
||||||
{
|
|
||||||
struct casdsk_attribute *casdsk_attr =
|
|
||||||
container_of(attr, struct casdsk_attribute, attr);
|
|
||||||
|
|
||||||
if (!casdsk_attr->show)
|
|
||||||
return -EIO;
|
|
||||||
|
|
||||||
return casdsk_attr->show(kobj, page);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t _casdsk_sysfs_store(struct kobject *kobj, struct attribute *attr,
|
|
||||||
const char *buf, size_t len)
|
|
||||||
{
|
|
||||||
struct casdsk_attribute *casdsk_attr =
|
|
||||||
container_of(attr, struct casdsk_attribute, attr);
|
|
||||||
|
|
||||||
if (!casdsk_attr->store)
|
|
||||||
return -EIO;
|
|
||||||
|
|
||||||
return casdsk_attr->store(kobj, buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
const struct sysfs_ops casdsk_sysfs_ops = {
|
|
||||||
.show = _casdsk_sysfs_show,
|
|
||||||
.store = _casdsk_sysfs_store
|
|
||||||
};
|
|
@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright(c) 2012-2021 Intel Corporation
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
*/
|
|
||||||
#ifndef __CASDISK_SYSFS_H__
|
|
||||||
#define __CASDISK_SYSFS_H__
|
|
||||||
|
|
||||||
#include <linux/kobject.h>
|
|
||||||
#include <linux/sysfs.h>
|
|
||||||
|
|
||||||
struct casdsk_disk;
|
|
||||||
|
|
||||||
struct casdsk_attribute {
|
|
||||||
struct attribute attr;
|
|
||||||
ssize_t (*show)(struct kobject *kobj, char *page);
|
|
||||||
ssize_t (*store)(struct kobject *kobj, const char *buf, size_t len);
|
|
||||||
};
|
|
||||||
|
|
||||||
extern const struct sysfs_ops casdsk_sysfs_ops;
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue
Block a user