mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zdev: Implement internal device attributes
This change adds base infrastructure for implementing internal device
attributes. In the context of the zdev tools, an internal device
attribute is a new type of device attribute with the following
characteristics:
- Can be set and removed like normal device attributes
- Affects zdev-internal handling only
- Does not correspond to an actual device attribute, that is
it has no representation in SysFS
- Can not be set in the active configuration
- Name starts with "zdev:" to prevent conflicts with actual
device attributes
Values for internal device attributes are stored in udev rules alongside
the normal persistent configuration of a device. They are encoded as
udev environment variables. Note that they have no further effect on
udev processing.
Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
3c5644ccfd
commit
c0392efa39
@@ -189,6 +189,7 @@ struct value_map {
|
||||
* in the persistent configuration
|
||||
* @nounload: (Device type attributes only) This attribute can be set while
|
||||
* the corresponding kernel module remains loaded.
|
||||
* @internal: This attribute only affects internal handling
|
||||
* @order: A number indicating the order in which to apply attribute
|
||||
* @order_cmp: A function determining if a setting for this attribute should
|
||||
* be applied before (-1) or after (1) another setting, or
|
||||
@@ -216,6 +217,7 @@ struct attrib {
|
||||
unsigned int activerem :1;
|
||||
unsigned int defunset :1;
|
||||
unsigned int nounload :1;
|
||||
unsigned int internal :1;
|
||||
|
||||
/* Optional */
|
||||
int order;
|
||||
|
||||
20
zdev/include/internal.h
Normal file
20
zdev/include/internal.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* zdev - Modify and display the persistent configuration of devices
|
||||
*
|
||||
* Copyright IBM Corp. 2017
|
||||
*
|
||||
* s390-tools is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the MIT license. See LICENSE for details.
|
||||
*/
|
||||
|
||||
#ifndef INTERNAL_H
|
||||
#define INTERNAL_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#define INTERNAL_ATTR_PREFIX "zdev:"
|
||||
|
||||
const char *internal_get_name(const char *name);
|
||||
bool internal_by_name(const char *name);
|
||||
|
||||
#endif /* INTERNAL_H */
|
||||
@@ -183,6 +183,7 @@ bool str_to_config(const char *, config_t *);
|
||||
char *quote_str(const char *, int);
|
||||
char *unquote_str(const char *);
|
||||
char *shrink_str(const char *);
|
||||
char *misc_strrstr(const char *haystack, const char *needle);
|
||||
|
||||
struct util_list *strlist_new(void);
|
||||
void strlist_free(struct util_list *);
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
#include "lib/util_list.h"
|
||||
#include "exit_code.h"
|
||||
|
||||
struct attrib;
|
||||
struct setting_list;
|
||||
|
||||
extern int udev_need_settle;
|
||||
extern int udev_no_settle;
|
||||
|
||||
@@ -46,4 +49,8 @@ exit_code_t udev_remove_rule(const char *type, const char *id, bool autoconf);
|
||||
|
||||
void udev_settle(void);
|
||||
|
||||
void udev_add_internal_from_entry(struct setting_list *list,
|
||||
struct udev_entry_node *entry,
|
||||
struct attrib **attribs);
|
||||
|
||||
#endif /* UDEV_H */
|
||||
|
||||
Reference in New Issue
Block a user