fs/ocfs2/filecheck.c

Source file repositories/reference/linux-study-clean/fs/ocfs2/filecheck.c

File Facts

System
Linux kernel
Corpus path
fs/ocfs2/filecheck.c
Extension
.c
Size
12183 bytes
Lines
510
Domain
Core OS
Bucket
VFS And Filesystem Core
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct ocfs2_filecheck_entry {
	struct list_head fe_list;
	unsigned long fe_ino;
	unsigned int fe_type;
	unsigned int fe_done:1;
	unsigned int fe_status:31;
};

struct ocfs2_filecheck_args {
	unsigned int fa_type;
	union {
		unsigned long fa_ino;
		unsigned int fa_len;
	};
};

static const char *
ocfs2_filecheck_error(int errno)
{
	if (!errno)
		return ocfs2_filecheck_errs[errno];

	BUG_ON(errno < OCFS2_FILECHECK_ERR_START ||
	       errno > OCFS2_FILECHECK_ERR_END);
	return ocfs2_filecheck_errs[errno - OCFS2_FILECHECK_ERR_START + 1];
}

static ssize_t ocfs2_filecheck_attr_show(struct kobject *kobj,
					struct kobj_attribute *attr,
					char *buf);
static ssize_t ocfs2_filecheck_attr_store(struct kobject *kobj,
					struct kobj_attribute *attr,
					const char *buf, size_t count);
static struct kobj_attribute ocfs2_filecheck_attr_chk =
					__ATTR(check, S_IRUSR | S_IWUSR,
					ocfs2_filecheck_attr_show,
					ocfs2_filecheck_attr_store);
static struct kobj_attribute ocfs2_filecheck_attr_fix =
					__ATTR(fix, S_IRUSR | S_IWUSR,
					ocfs2_filecheck_attr_show,
					ocfs2_filecheck_attr_store);
static struct kobj_attribute ocfs2_filecheck_attr_set =
					__ATTR(set, S_IRUSR | S_IWUSR,
					ocfs2_filecheck_attr_show,
					ocfs2_filecheck_attr_store);
static struct attribute *ocfs2_filecheck_attrs[] = {
	&ocfs2_filecheck_attr_chk.attr,
	&ocfs2_filecheck_attr_fix.attr,
	&ocfs2_filecheck_attr_set.attr,
	NULL
};
ATTRIBUTE_GROUPS(ocfs2_filecheck);

static void ocfs2_filecheck_release(struct kobject *kobj)
{
	struct ocfs2_filecheck_sysfs_entry *entry = container_of(kobj,
				struct ocfs2_filecheck_sysfs_entry, fs_kobj);

	complete(&entry->fs_kobj_unregister);
}

static ssize_t
ocfs2_filecheck_show(struct kobject *kobj, struct attribute *attr, char *buf)
{
	ssize_t ret = -EIO;
	struct kobj_attribute *kattr = container_of(attr,
					struct kobj_attribute, attr);

	kobject_get(kobj);
	if (kattr->show)
		ret = kattr->show(kobj, kattr, buf);
	kobject_put(kobj);
	return ret;
}

static ssize_t
ocfs2_filecheck_store(struct kobject *kobj, struct attribute *attr,
			const char *buf, size_t count)
{
	ssize_t ret = -EIO;
	struct kobj_attribute *kattr = container_of(attr,
					struct kobj_attribute, attr);

	kobject_get(kobj);
	if (kattr->store)
		ret = kattr->store(kobj, kattr, buf, count);
	kobject_put(kobj);
	return ret;
}

Annotation

Implementation Notes