// SPDX-License-Identifier: GPL-2.0-only /* * Export the iSCSI boot info to userland via sysfs. * * Copyright (C) 2010 Red Hat, Inc. All rights reserved. * Copyright (C) 2010 Mike Christie
*/
if (sysfs_create_group(&boot_kobj->kobj, attr_group)) { /* * We do not want to free this because the caller * will assume that since the creation call failed * the boot kobj was not setup and the normal release * path is not being run.
*/
boot_kobj->release = NULL;
kobject_put(&boot_kobj->kobj); return NULL;
}
boot_kobj->attr_group = attr_group;
kobject_uevent(&boot_kobj->kobj, KOBJ_ADD); /* Nothing broke so lets add it to the list. */
list_add_tail(&boot_kobj->list, &boot_kset->kobj_list); return boot_kobj;
}
/** * iscsi_boot_create_target() - create boot target sysfs dir * @boot_kset: boot kset * @index: the target id * @data: driver specific data for target * @show: attr show function * @is_visible: attr visibility function * @release: release function * * Note: The boot sysfs lib will free the data passed in for the caller * when all refs to the target kobject have been released.
*/ struct iscsi_boot_kobj *
iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index, void *data,
ssize_t (*show) (void *data, int type, char *buf),
umode_t (*is_visible) (void *data, int type), void (*release) (void *data))
{ return iscsi_boot_create_kobj(boot_kset, &iscsi_boot_target_attr_group, "target%d", index, data, show, is_visible,
release);
}
EXPORT_SYMBOL_GPL(iscsi_boot_create_target);
/** * iscsi_boot_create_initiator() - create boot initiator sysfs dir * @boot_kset: boot kset * @index: the initiator id * @data: driver specific data * @show: attr show function * @is_visible: attr visibility function * @release: release function * * Note: The boot sysfs lib will free the data passed in for the caller * when all refs to the initiator kobject have been released.
*/ struct iscsi_boot_kobj *
iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index, void *data,
ssize_t (*show) (void *data, int type, char *buf),
umode_t (*is_visible) (void *data, int type), void (*release) (void *data))
{ return iscsi_boot_create_kobj(boot_kset,
&iscsi_boot_initiator_attr_group, "initiator", index, data, show,
is_visible, release);
}
EXPORT_SYMBOL_GPL(iscsi_boot_create_initiator);
/** * iscsi_boot_create_ethernet() - create boot ethernet sysfs dir * @boot_kset: boot kset * @index: the ethernet device id * @data: driver specific data * @show: attr show function * @is_visible: attr visibility function * @release: release function * * Note: The boot sysfs lib will free the data passed in for the caller * when all refs to the ethernet kobject have been released.
*/ struct iscsi_boot_kobj *
iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index, void *data,
ssize_t (*show) (void *data, int type, char *buf),
umode_t (*is_visible) (void *data, int type), void (*release) (void *data))
{ return iscsi_boot_create_kobj(boot_kset,
&iscsi_boot_ethernet_attr_group, "ethernet%d", index, data, show,
is_visible, release);
}
EXPORT_SYMBOL_GPL(iscsi_boot_create_ethernet);
/** * iscsi_boot_create_acpitbl() - create boot acpi table sysfs dir * @boot_kset: boot kset * @index: not used * @data: driver specific data * @show: attr show function * @is_visible: attr visibility function * @release: release function * * Note: The boot sysfs lib will free the data passed in for the caller * when all refs to the acpitbl kobject have been released.
*/ struct iscsi_boot_kobj *
iscsi_boot_create_acpitbl(struct iscsi_boot_kset *boot_kset, int index, void *data,
ssize_t (*show)(void *data, int type, char *buf),
umode_t (*is_visible)(void *data, int type), void (*release)(void *data))
{ return iscsi_boot_create_kobj(boot_kset,
&iscsi_boot_acpitbl_attr_group, "acpi_header", index, data, show,
is_visible, release);
}
EXPORT_SYMBOL_GPL(iscsi_boot_create_acpitbl);
/** * iscsi_boot_create_kset() - creates root sysfs tree * @set_name: name of root dir
*/ struct iscsi_boot_kset *iscsi_boot_create_kset(constchar *set_name)
{ struct iscsi_boot_kset *boot_kset;
boot_kset = kzalloc(sizeof(*boot_kset), GFP_KERNEL); if (!boot_kset) return NULL;
/** * iscsi_boot_destroy_kset() - destroy kset and kobjects under it * @boot_kset: boot kset * * This will remove the kset and kobjects and attrs under it.
*/ void iscsi_boot_destroy_kset(struct iscsi_boot_kset *boot_kset)
{ struct iscsi_boot_kobj *boot_kobj, *tmp_kobj;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.