libudev-queue.c revision a5d8cffad9020247c9ba81a9e0a9b9cee5c4a4d5
/*
* libudev - interface to udev device information
*
* Copyright (C) 2008 Kay Sievers <kay.sievers@vrfy.org>
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <dirent.h>
#include <fcntl.h>
#include "libudev.h"
#include "libudev-private.h"
struct udev_queue {
int refcount;
unsigned long long int last_seen_udev_seqnum;
struct udev_list_node queue_list;
struct udev_list_node failed_list;
};
{
struct udev_queue *udev_queue;
return NULL;
if (udev_queue == NULL)
return NULL;
return udev_queue;
}
{
if (udev_queue == NULL)
return NULL;
udev_queue->refcount++;
return udev_queue;
}
{
if (udev_queue == NULL)
return;
udev_queue->refcount--;
if (udev_queue->refcount > 0)
return;
}
{
if (udev_queue == NULL)
return NULL;
return udev_queue->udev;
}
{
char filename[UTIL_PATH_SIZE];
unsigned long long int seqnum;
int fd;
char buf[32];
if (udev_queue == NULL)
return -EINVAL;
if (fd < 0)
return 0;
if (len <= 2)
return 0;
return seqnum;
}
{
char filename[UTIL_PATH_SIZE];
unsigned long long int seqnum;
int fd;
char buf[32];
if (udev_queue == NULL)
return -EINVAL;
if (fd < 0)
return 0;
if (len <= 2)
return 0;
return seqnum;
}
{
char filename[UTIL_PATH_SIZE];
if (udev_queue == NULL)
return 0;
return 1;
return 0;
}
{
char queuename[UTIL_PATH_SIZE];
unsigned long long int seqnum_kernel;
if (udev_queue == NULL)
return -EINVAL;
return 0;
}
return 1;
}
/* update udev seqnum, and check if udev is still running */
if (udev_queue_get_udev_seqnum(udev_queue) == 0)
return 1;
return 1;
}
return 0;
}
{
char filename[UTIL_PATH_SIZE];
if (udev_queue == NULL)
return -EINVAL;
return 0;
}
return 0;
return 1;
}
{
char path[UTIL_PATH_SIZE];
if (udev_queue == NULL)
return NULL;
return NULL;
char filename[UTIL_PATH_SIZE];
char syspath[UTIL_PATH_SIZE];
continue;
continue;
}
}
{
char path[UTIL_PATH_SIZE];
if (udev_queue == NULL)
return NULL;
return NULL;
char filename[UTIL_PATH_SIZE];
char syspath[UTIL_PATH_SIZE];
continue;
continue;
continue;
}
}
{
return -1;
}
extern int udev_queue_export_device_queued(struct udev_queue *udev_queue, struct udev_device *udev_device)
{
return -1;
}
extern int udev_queue_export_device_finished(struct udev_queue *udev_queue, struct udev_device *udev_device)
{
return -1;
}
extern int udev_queue_export_device_failed(struct udev_queue *udev_queue, struct udev_device *udev_device)
{
return -1;
}