chiark / gitweb /
libudev: handle "device" link as parent, handle "class" "block" as "subsystem"
[elogind.git] / udev / udevadm-settle.c
index c519f91cd583198eb7b92278212f7d401ce7ec8b..78ac47ff41260886cc64cc3aa47be5acc4c358ce 100644 (file)
@@ -1,19 +1,18 @@
 /*
- * Copyright (C) 2006 Kay Sievers <kay@vrfy.org>
+ * Copyright (C) 2006-2008 Kay Sievers <kay@vrfy.org>
  *
- *     This program is free software; you can redistribute it and/or modify it
- *     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.,
- *     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ * This program is free software: you can redistribute it and/or modify
+ * 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 <stdlib.h>
@@ -30,7 +29,6 @@
 #include <sys/types.h>
 
 #include "udev.h"
-#include "udevd.h"
 
 #define DEFAULT_TIMEOUT                        180
 #define LOOP_PER_SECOND                        20
@@ -46,7 +44,7 @@ static void print_queue(struct udev *udev, const char *dir)
        printf("\n\nAfter the udevadm settle timeout, the events queue contains:\n\n");
 
        list_for_each_entry(item, &files, node) {
-               char target[NAME_SIZE];
+               char target[UTIL_NAME_SIZE];
                size_t len;
                const char *filename = strrchr(item->name, '/');
 
@@ -69,8 +67,8 @@ static void print_queue(struct udev *udev, const char *dir)
 
 int udevadm_settle(struct udev *udev, int argc, char *argv[])
 {
-       char queuename[PATH_SIZE];
-       char filename[PATH_SIZE];
+       char queuename[UTIL_PATH_SIZE];
+       char filename[UTIL_PATH_SIZE];
        unsigned long long seq_kernel;
        unsigned long long seq_udev;
        char seqnum[32];
@@ -109,8 +107,8 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
                }
        }
 
-       strlcpy(queuename, udev_get_dev_path(udev), sizeof(queuename));
-       strlcat(queuename, "/.udev/queue", sizeof(queuename));
+       util_strlcpy(queuename, udev_get_dev_path(udev), sizeof(queuename));
+       util_strlcat(queuename, "/.udev/queue", sizeof(queuename));
 
        loop = timeout * LOOP_PER_SECOND;
        while (loop--) {
@@ -131,8 +129,8 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
                }
 
                /* read current udev seqnum */
-               strlcpy(filename, udev_get_dev_path(udev), sizeof(filename));
-               strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename));
+               util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename));
+               util_strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename));
                fd = open(filename, O_RDONLY);
                if (fd < 0)
                        goto exit;
@@ -145,8 +143,8 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
                info(udev, "udev seqnum = %llu\n", seq_udev);
 
                /* read current kernel seqnum */
-               strlcpy(filename, udev_get_sys_path(udev), sizeof(filename));
-               strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename));
+               util_strlcpy(filename, udev_get_sys_path(udev), sizeof(filename));
+               util_strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename));
                fd = open(filename, O_RDONLY);
                if (fd < 0)
                        goto exit;