libudev-queue.c revision e6c1a2bde7609cc703a5fad34c3bc1d15d19bbdc
/*
* 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 <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;
util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev_queue->udev), "/kernel/uevent_seqnum", NULL);
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;
util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue->udev), "/.udev/uevent_seqnum", NULL);
if (fd < 0)
return 0;
if (len <= 2)
return 0;
return seqnum;
}
{
char filename[UTIL_PATH_SIZE];
if (udev_queue == NULL)
return 0;
util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue->udev), "/.udev/uevent_seqnum", NULL);
return 1;
return 0;
}
{
char queuename[UTIL_PATH_SIZE];
unsigned long long int seqnum_kernel;
if (udev_queue == NULL)
return -EINVAL;
util_strscpyl(queuename, sizeof(queuename), udev_get_dev_path(udev_queue->udev), "/.udev/queue", NULL);
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;
/* did it reach the queue? */
return 0;
/* is it still in the queue? */
return 0;
return 1;
}
{
char path[UTIL_PATH_SIZE];
if (udev_queue == NULL)
return NULL;
return NULL;
char syspath[UTIL_PATH_SIZE];
char *s;
size_t l;
continue;
s = syspath;
continue;
s[len] = '\0';
}
}
{
char path[UTIL_PATH_SIZE];
if (udev_queue == NULL)
return NULL;
return NULL;
char filename[UTIL_PATH_SIZE];
char syspath[UTIL_PATH_SIZE];
char *s;
size_t l;
continue;
s = syspath;
continue;
s[len] = '\0';
continue;
}
}
{
return -1;
}
{
return -1;
}
int udev_queue_export_device_finished(struct udev_queue *udev_queue, struct udev_device *udev_device)
{
return -1;
}
{
return -1;
}