chiark / gitweb /
remove duplicate semicolons
[elogind.git] / src / libudev / libudev-device.c
index 972ace5d396146cbfed7c5002c256c9c0cd5bd32..acf8e24d159abc42d0e9ab9db9d54b1f151921f7 100644 (file)
@@ -1,13 +1,21 @@
-/*
- * libudev - interface to udev device information
- *
- * Copyright (C) 2008-2010 Kay Sievers <kay.sievers@vrfy.org>
- *
- * 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>
+
+  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>
@@ -67,7 +75,7 @@ struct udev_device {
         struct udev_list sysattr_list;
         struct udev_list tags_list;
         unsigned long long int seqnum;
-        unsigned long long int usec_initialized;
+        usec_t usec_initialized;
         int devlink_priority;
         int refcount;
         dev_t devnum;
@@ -246,7 +254,7 @@ static int udev_device_set_devtype(struct udev_device *udev_device, const char *
         return 0;
 }
 
-static int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem)
+int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem)
 {
         free(udev_device->subsystem);
         udev_device->subsystem = strdup(subsystem);
@@ -378,12 +386,12 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device,
                 next = strchr(slink, ' ');
                 while (next != NULL) {
                         next[0] = '\0';
-                        udev_device_add_devlink(udev_device, slink, 0);
+                        udev_device_add_devlink(udev_device, slink);
                         slink = &next[1];
                         next = strchr(slink, ' ');
                 }
                 if (slink[0] != '\0')
-                        udev_device_add_devlink(udev_device, slink, 0);
+                        udev_device_add_devlink(udev_device, slink);
         } else if (startswith(property, "TAGS=")) {
                 char tags[UTIL_PATH_SIZE];
                 char *next;
@@ -503,7 +511,7 @@ int udev_device_read_db(struct udev_device *udev_device, const char *dbfile)
                 switch(line[0]) {
                 case 'S':
                         util_strscpyl(filename, sizeof(filename), "/dev/", val, NULL);
-                        udev_device_add_devlink(udev_device, filename, 0);
+                        udev_device_add_devlink(udev_device, filename);
                         break;
                 case 'L':
                         udev_device_set_devlink_priority(udev_device, atoi(val));
@@ -1267,7 +1275,7 @@ _public_ const char *udev_device_get_action(struct udev_device *udev_device)
  **/
 _public_ unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device)
 {
-        unsigned long long now_ts;
+        usec_t now_ts;
 
         if (udev_device == NULL)
                 return 0;
@@ -1275,23 +1283,23 @@ _public_ unsigned long long int udev_device_get_usec_since_initialized(struct ud
                 udev_device_read_db(udev_device, NULL);
         if (udev_device->usec_initialized == 0)
                 return 0;
-        now_ts = now_usec();
+        now_ts = now(CLOCK_MONOTONIC);
         if (now_ts == 0)
                 return 0;
         return now_ts - udev_device->usec_initialized;
 }
 
-unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device)
+usec_t udev_device_get_usec_initialized(struct udev_device *udev_device)
 {
         return udev_device->usec_initialized;
 }
 
-void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized)
+void udev_device_set_usec_initialized(struct udev_device *udev_device, usec_t usec_initialized)
 {
         char num[32];
 
         udev_device->usec_initialized = usec_initialized;
-        snprintf(num, sizeof(num), "%llu", usec_initialized);
+        snprintf(num, sizeof(num), "%llu", (unsigned long long)usec_initialized);
         udev_device_add_property(udev_device, "USEC_INITIALIZED", num);
 }
 
@@ -1505,7 +1513,7 @@ int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode
         return 0;
 }
 
-int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink, int unique)
+int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink)
 {
         struct udev_list_entry *list_entry;
 
@@ -1513,8 +1521,6 @@ int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink
         list_entry = udev_list_entry_add(&udev_device->devlinks_list, devlink, NULL);
         if (list_entry == NULL)
                 return -ENOMEM;
-        if (unique)
-                udev_list_entry_set_num(list_entry, true);
         return 0;
 }