udev_utils.c revision b9a8c4821a98df33ba2cc5b18b15d7175709c376
/*
* udev_lib - generic stuff used by udev
*
* Copyright (C) 2004 Kay Sievers <kay@vrfy.org>
*
* under the terms of the GNU General Public License as published by the
* Free Software Foundation version 2 of the License.
*
* 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, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
#include <dirent.h>
#include "udev.h"
#include "logging.h"
#include "udev_utils.h"
#include "list.h"
{
if (devpath)
if (subsystem)
}
{
static int kversion = 0;
static int kpatchlevel;
static int ksublevel;
if (kversion == 0) {
return -1;
kversion = 0;
return -1;
}
}
return 1;
else
return 0;
}
int create_path(const char *path)
{
char p[NAME_SIZE];
char *pos;
return 0;
pos--;
pos[0] = '\0';
dbg("stat '%s'\n", p);
return 0;
if (create_path (p) != 0)
return -1;
dbg("mkdir '%s'\n", p);
return mkdir(p, 0755);
}
{
char *temp;
char *string = *orig_string;
if (!string)
return -ENODEV;
/* eat any whitespace */
++string;
/* split based on '=' */
if (!string)
return -ENODEV;
/* take the right side and strip off the '"' */
++string;
if (*string == '"')
++string;
else
return -ENODEV;
return -ENODEV;
*orig_string = string;
return 0;
}
{
int fd;
if (fd < 0) {
return -1;
}
return -1;
}
if (*buf == MAP_FAILED) {
return -1;
}
return 0;
}
{
}
/* return number of chars until the next newline, skip escaped newline */
{
int escape = 0;
break;
escape = 1;
else
escape = 0;
}
}
void no_trailing_slash(char *path)
{
int len;
}
struct files {
};
/* sort files in lexical order */
{
break;
}
}
dbg("error malloc");
return -ENOMEM;
}
return 0;
}
/* calls function for every file found in specified directory */
{
char *ext;
return -1;
}
while (1) {
break;
continue;
/* look for file with specified suffix */
continue;
continue;
}
/* call function for every file in the list */
}
return 0;
}