-/*
- * libudev - interface to udev device information
- *
- * Copyright (C) 2008 Kay Sievers <kay.sievers@vrfy.org>
- * Copyright (C) 2009 Alan Jenkins <alan-jenkins@tuffmail.co.uk>
- *
- * This library is free software; you can redistribute it and/or
- * 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.
- */
+/***
+ This file is part of systemd.
+
+ Copyright 2008-2012 Kay Sievers <kay@vrfy.org>
+ Copyright 2009 Alan Jenkins <alan-jenkins@tuffmail.co.uk>
+
+ systemd is free software; you can redistribute it and/or 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.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
#include <stdio.h>
#include <stdlib.h>
*
* Drop a reference of a udev queue context. If the refcount reaches zero,
* the resources of the queue context will be released.
+ *
+ * Returns: the passed queue context if it has still an active reference, or #NULL otherwise.
**/
-_public_ void udev_queue_unref(struct udev_queue *udev_queue)
+_public_ struct udev_queue *udev_queue_unref(struct udev_queue *udev_queue)
{
if (udev_queue == NULL)
- return;
+ return NULL;
udev_queue->refcount--;
if (udev_queue->refcount > 0)
- return;
+ return udev_queue;
udev_list_cleanup(&udev_queue->queue_list);
free(udev_queue);
+ return NULL;
}
/**
static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long int *seqnum_start)
{
- char filename[UTIL_PATH_SIZE];
FILE *queue_file;
- util_strscpyl(filename, sizeof(filename), "/run/udev/queue.bin", NULL);
- queue_file = fopen(filename, "re");
+ queue_file = fopen("/run/udev/queue.bin", "re");
if (queue_file == NULL)
return NULL;
if (udev_queue_read_seqnum(queue_file, seqnum_start) < 0) {
- err(udev_queue->udev, "corrupt queue file\n");
+ udev_err(udev_queue->udev, "corrupt queue file\n");
fclose(queue_file);
return NULL;
}
return udev_list_get_entry(&udev_queue->queue_list);
}
-
-struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue);
-_public_ struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue)
-{
- err(udev_queue->udev, "udev_queue_get_failed_list_entry() does not return anything; failed events are not recorded\n");
- errno = ENOSYS;
- return NULL;
-}