libudev-device-db-write.c revision 065db052211d3bf08d9b0f698a79a8798faf11d2
/*
* libudev - interface to udev device information
*
* Copyright (C) 2008 Kay Sievers <kay.sievers@vrfy.org>
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include "udev.h"
static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len)
{
char *s;
size_t l;
s = filename;
}
{
char filename[UTIL_PATH_SIZE];
FILE *f;
char *s;
size_t l;
struct udev_list_entry *list_entry;
int ret;
goto file;
if (udev_device_get_num_fake_partitions(udev_device) != 0)
goto file;
goto file;
if (udev_device_get_devlink_priority(udev_device) != 0)
goto file;
if (udev_device_get_event_timeout(udev_device) >= 0)
goto file;
if (udev_device_get_watch_handle(udev_device) >= 0)
goto file;
goto out;
/*
* if we have only the node and symlinks to store, try not to waste
* tmpfs memory -- store values, if they fit, in a symlink target
*/
s = target;
if (l == 0) {
goto file;
}
}
if (ret == 0)
goto out;
file:
if (f == NULL) {
return -1;
}
}
if (udev_device_get_devlink_priority(udev_device) != 0)
if (udev_device_get_event_timeout(udev_device) >= 0)
if (udev_device_get_num_fake_partitions(udev_device) != 0)
if (udev_device_get_watch_handle(udev_device) >= 0)
continue;
fprintf(f, "E:%s=%s\n",
}
fclose(f);
out:
return 0;
}
{
char filename[UTIL_PATH_SIZE];
return 0;
}
{
char filename_old[UTIL_PATH_SIZE];
char filename[UTIL_PATH_SIZE];
}