return blkid_do_safeprobe(pr);
}
-static int builtin_blkid(struct udev_device *_dev, int argc, char *argv[], bool test) {
+static int builtin_blkid(sd_device *dev, int argc, char *argv[], bool test) {
const char *devnode, *root_partition = NULL, *data, *name;
_cleanup_(blkid_free_probep) blkid_probe pr = NULL;
bool noraid = false, is_gpt = false;
_cleanup_close_ int fd = -1;
int64_t offset = 0;
int nvals, i, r;
- sd_device *dev = _dev->device;
static const struct option options[] = {
{ "offset", required_argument, NULL, 'o' },
#include "udev-builtin.h"
#include "util.h"
-static int builtin_btrfs(struct udev_device *dev, int argc, char *argv[], bool test) {
+static int builtin_btrfs(sd_device *dev, int argc, char *argv[], bool test) {
struct btrfs_ioctl_vol_args args = {};
_cleanup_close_ int fd = -1;
int err;
if (err < 0)
return EXIT_FAILURE;
- udev_builtin_add_property(dev->device, test, "ID_BTRFS_READY", one_zero(err == 0));
+ udev_builtin_add_property(dev, test, "ID_BTRFS_READY", one_zero(err == 0));
return EXIT_SUCCESS;
}
return r;
}
-static int builtin_hwdb(struct udev_device *_dev, int argc, char *argv[], bool test) {
+static int builtin_hwdb(sd_device *dev, int argc, char *argv[], bool test) {
static const struct option options[] = {
{ "filter", required_argument, NULL, 'f' },
{ "device", required_argument, NULL, 'd' },
const char *subsystem = NULL;
const char *prefix = NULL;
_cleanup_(sd_device_unrefp) sd_device *srcdev = NULL;
- sd_device *dev = _dev->device;
if (!hwdb)
return EXIT_FAILURE;
return ret;
}
-static int builtin_input_id(struct udev_device *_dev, int argc, char *argv[], bool test) {
- sd_device *pdev, *dev = _dev->device;
+static int builtin_input_id(sd_device *dev, int argc, char *argv[], bool test) {
+ sd_device *pdev;
unsigned long bitmask_ev[NBITS(EV_MAX)];
unsigned long bitmask_abs[NBITS(ABS_MAX)];
unsigned long bitmask_key[NBITS(KEY_MAX)];
return fd;
}
-static int builtin_keyboard(struct udev_device *_dev, int argc, char *argv[], bool test) {
+static int builtin_keyboard(sd_device *dev, int argc, char *argv[], bool test) {
unsigned release[1024];
unsigned release_count = 0;
_cleanup_close_ int fd = -1;
const char *node, *key, *value;
int has_abs = -1, r;
- sd_device *dev = _dev->device;
r = sd_device_get_devname(dev, &node);
if (r < 0) {
log_internalv(priority, 0, file, line, fn, format, args);
}
-static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test) {
+static int builtin_kmod(sd_device *dev, int argc, char *argv[], bool test) {
int i;
if (!ctx)
return 0;
}
-static int builtin_net_id(struct udev_device *_dev, int argc, char *argv[], bool test) {
+static int builtin_net_id(sd_device *dev, int argc, char *argv[], bool test) {
const char *s, *p, *devtype, *prefix = "en";
struct netnames names = {};
unsigned long i;
int r;
- sd_device *dev = _dev->device;
/* handle only ARPHRD_ETHER, ARPHRD_SLIP and ARPHRD_INFINIBAND devices */
r = sd_device_get_sysattr_value(dev, "type", &s);
static link_config_ctx *ctx = NULL;
-static int builtin_net_setup_link(struct udev_device *_dev, int argc, char **argv, bool test) {
+static int builtin_net_setup_link(sd_device *dev, int argc, char **argv, bool test) {
_cleanup_free_ char *driver = NULL;
const char *name = NULL;
link_config *link;
int r;
- sd_device *dev = _dev->device;
if (argc > 1) {
log_error("This program takes no arguments.");
return skip_subsystem(parent, "ap");
}
-static int builtin_path_id(struct udev_device *_dev, int argc, char *argv[], bool test) {
+static int builtin_path_id(sd_device *dev, int argc, char *argv[], bool test) {
sd_device *parent;
_cleanup_free_ char *path = NULL;
bool supported_transport = false;
bool supported_parent = false;
const char *subsystem;
- sd_device *dev = _dev->device;
assert(dev);
#include "log.h"
#include "udev-builtin.h"
-static int builtin_uaccess(struct udev_device *_dev, int argc, char *argv[], bool test) {
+static int builtin_uaccess(sd_device *dev, int argc, char *argv[], bool test) {
int r;
const char *path = NULL, *seat;
bool changed_acl = false;
uid_t uid;
- sd_device *dev = _dev->device;
umask(0022);
* 6.) If the device supplies a serial number, this number
* is concatenated with the identification with an underscore '_'.
*/
-static int builtin_usb_id(struct udev_device *_dev, int argc, char *argv[], bool test) {
+static int builtin_usb_id(sd_device *dev, int argc, char *argv[], bool test) {
char vendor_str[64] = "";
char vendor_str_enc[256];
const char *vendor_id;
const char *syspath, *sysname, *devtype, *interface_syspath;
int r;
- sd_device *dev = _dev->device;
assert(dev);
#include <string.h>
#include "device-private.h"
+#include "libudev-device-internal.h"
#include "string-util.h"
#include "strv.h"
#include "udev-builtin.h"
/* we need '0' here to reset the internal state */
optind = 0;
- return builtins[cmd]->cmd(dev, strv_length(argv), argv, test);
+ return builtins[cmd]->cmd(dev->device, strv_length(argv), argv, test);
}
int udev_builtin_add_property(sd_device *dev, bool test, const char *key, const char *val) {
#include <stdbool.h>
+#include "sd-device.h"
+
#include "libudev.h"
-#include "libudev-device-internal.h"
enum udev_builtin_cmd {
#if HAVE_BLKID
struct udev_builtin {
const char *name;
- int (*cmd)(struct udev_device *dev, int argc, char *argv[], bool test);
+ int (*cmd)(sd_device *dev, int argc, char *argv[], bool test);
const char *help;
int (*init)(void);
void (*exit)(void);