summaryrefslogtreecommitdiff
path: root/libudev
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2011-10-06 00:45:06 +0200
committerKay Sievers <kay.sievers@vrfy.org>2011-10-06 00:45:06 +0200
commit289a1821a4a7636ce42a6c7adc3a9bb49421a5ea (patch)
treeb4499dad1a81ed60a1cb5cb74c2714cf0b759f37 /libudev
parenta13d90aec63db6b3d3b90da41b5274fd81ab790e (diff)
remove 'udevadm trigger --type=failed' and SYSFS, ID, BUS keys
Diffstat (limited to 'libudev')
-rw-r--r--libudev/docs/libudev-sections.txt1
-rw-r--r--libudev/libudev-private.h1
-rw-r--r--libudev/libudev-queue-private.c45
-rw-r--r--libudev/libudev-queue.c47
-rw-r--r--libudev/libudev.h1
-rw-r--r--libudev/test-libudev.c4
6 files changed, 3 insertions, 96 deletions
diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt
index 4cd383b4f8..a686c4558e 100644
--- a/libudev/docs/libudev-sections.txt
+++ b/libudev/docs/libudev-sections.txt
@@ -116,7 +116,6 @@ udev_queue_get_queue_is_empty
udev_queue_get_seqnum_is_finished
udev_queue_get_seqnum_sequence_is_finished
udev_queue_get_queued_list_entry
-udev_queue_get_failed_list_entry
udev_queue_get_kernel_seqnum
udev_queue_get_udev_seqnum
</SECTION>
diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h
index 2873b4d2c7..1bcd2e3236 100644
--- a/libudev/libudev-private.h
+++ b/libudev/libudev-private.h
@@ -165,7 +165,6 @@ struct udev_queue_export *udev_queue_export_unref(struct udev_queue_export *udev
void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export);
int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device);
int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device);
-int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device);
/* libudev-util.c */
#define UTIL_PATH_SIZE 1024
diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c
index 6e13d8a3d9..e0a7b53b81 100644
--- a/libudev/libudev-queue-private.c
+++ b/libudev/libudev-queue-private.c
@@ -56,7 +56,6 @@ static int rebuild_queue_file(struct udev_queue_export *udev_queue_export);
struct udev_queue_export {
struct udev *udev;
- int failed_count; /* number of failed events exported */
int queued_count; /* number of unfinished events exported in queue file */
FILE *queue_file;
unsigned long long int seqnum_max; /* earliest sequence number in queue file */
@@ -328,7 +327,6 @@ write_error:
enum device_state {
DEVICE_QUEUED,
DEVICE_FINISHED,
- DEVICE_FAILED,
};
static inline size_t queue_record_size(size_t devpath_len)
@@ -394,47 +392,9 @@ static int update_queue(struct udev_queue_export *udev_queue_export,
return err;
}
-static void update_failed(struct udev_queue_export *udev_queue_export,
- struct udev_device *udev_device, enum device_state state)
-{
- struct udev *udev = udev_device_get_udev(udev_device);
- char filename[UTIL_PATH_SIZE];
-
- if (state != DEVICE_FAILED && udev_queue_export->failed_count == 0)
- return;
-
- /* location of failed file */
- util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/failed/",
- udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL);
-
- switch (state) {
- case DEVICE_FAILED:
- /* record event in the failed directory */
- udev_queue_export->failed_count++;
- util_create_path(udev, filename);
- symlink(udev_device_get_devpath(udev_device), filename);
- break;
-
- case DEVICE_QUEUED:
- /* delete failed file */
- if (unlink(filename) == 0) {
- util_delete_path(udev, filename);
- udev_queue_export->failed_count--;
- }
- break;
-
- case DEVICE_FINISHED:
- break;
- }
-
- return;
-}
-
static int update(struct udev_queue_export *udev_queue_export,
struct udev_device *udev_device, enum device_state state)
{
- update_failed(udev_queue_export, udev_device, state);
-
if (update_queue(udev_queue_export, udev_device, state) != 0)
return -1;
@@ -450,8 +410,3 @@ int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_expor
{
return update(udev_queue_export, udev_device, DEVICE_FINISHED);
}
-
-int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device)
-{
- return update(udev_queue_export, udev_device, DEVICE_FAILED);
-}
diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c
index 744696df2b..3d46b67d19 100644
--- a/libudev/libudev-queue.c
+++ b/libudev/libudev-queue.c
@@ -43,7 +43,6 @@ struct udev_queue {
struct udev *udev;
int refcount;
struct udev_list queue_list;
- struct udev_list failed_list;
};
/**
@@ -68,7 +67,6 @@ UDEV_EXPORT struct udev_queue *udev_queue_new(struct udev *udev)
udev_queue->refcount = 1;
udev_queue->udev = udev;
udev_list_init(udev, &udev_queue->queue_list, false);
- udev_list_init(udev, &udev_queue->failed_list, false);
return udev_queue;
}
@@ -103,7 +101,6 @@ UDEV_EXPORT void udev_queue_unref(struct udev_queue *udev_queue)
if (udev_queue->refcount > 0)
return;
udev_list_cleanup(&udev_queue->queue_list);
- udev_list_cleanup(&udev_queue->failed_list);
free(udev_queue);
}
@@ -469,47 +466,9 @@ UDEV_EXPORT struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev
return udev_list_get_entry(&udev_queue->queue_list);
}
-/**
- * udev_queue_get_failed_list_entry:
- * @udev_queue: udev queue context
- *
- * Returns: the first entry of the list of recorded failed events.
- **/
+struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue);
UDEV_EXPORT struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue)
{
- char path[UTIL_PATH_SIZE];
- DIR *dir;
- struct dirent *dent;
-
- if (udev_queue == NULL)
- return NULL;
- udev_list_cleanup(&udev_queue->failed_list);
- util_strscpyl(path, sizeof(path), udev_get_run_path(udev_queue->udev), "/failed", NULL);
- dir = opendir(path);
- if (dir == NULL)
- return NULL;
- for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
- char filename[UTIL_PATH_SIZE];
- char syspath[UTIL_PATH_SIZE];
- char *s;
- size_t l;
- ssize_t len;
- struct stat statbuf;
-
- if (dent->d_name[0] == '.')
- continue;
- s = syspath;
- l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL);
- len = readlinkat(dirfd(dir), dent->d_name, s, l);
- if (len <= 0 || (size_t)len == l)
- continue;
- s[len] = '\0';
- dbg(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name);
- util_strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL);
- if (stat(filename, &statbuf) != 0)
- continue;
- udev_list_entry_add(&udev_queue->failed_list, syspath, NULL);
- }
- closedir(dir);
- return udev_list_get_entry(&udev_queue->failed_list);
+ errno = ENOSYS;
+ return NULL;
}
diff --git a/libudev/libudev.h b/libudev/libudev.h
index d8eb7dff77..47b56bb17a 100644
--- a/libudev/libudev.h
+++ b/libudev/libudev.h
@@ -173,7 +173,6 @@ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned lo
int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue,
unsigned long long int start, unsigned long long int end);
struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue);
-struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/libudev/test-libudev.c b/libudev/test-libudev.c
index 966a406507..c325f8eef5 100644
--- a/libudev/test-libudev.c
+++ b/libudev/test-libudev.c
@@ -323,10 +323,6 @@ static int test_queue(struct udev *udev)
udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue))
printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry));
printf("\n");
- printf("get failed list\n");
- udev_list_entry_foreach(list_entry, udev_queue_get_failed_list_entry(udev_queue))
- printf("failed: '%s'\n", udev_list_entry_get_name(list_entry));
- printf("\n");
list_entry = udev_queue_get_queued_list_entry(udev_queue);
if (list_entry != NULL) {