~ubuntu-branches/debian/jessie/systemd/jessie

« back to all changes in this revision

Viewing changes to src/device.c

  • Committer: Package Import Robot
  • Author(s): Tollef Fog Heen, Tollef Fog Heen, Michael Biebl
  • Date: 2012-04-03 19:59:17 UTC
  • mfrom: (1.1.10) (6.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20120403195917-l532urrbg4pkreas
Tags: 44-1
[ Tollef Fog Heen ]
* New upstream version.
  - Backport 3492207: journal: PAGE_SIZE is not known on ppc and other
    archs
  - Backport 5a2a2a1: journal: react with immediate rotation to a couple
    of more errors
  - Backport 693ce21: util: never follow symlinks in rm_rf_children()
    Fixes CVE-2012-1174, closes: #664364
* Drop output message from init-functions hook, it's pointless.
* Only rmdir /lib/init/rw if it exists.
* Explicitly order debian-fixup before sysinit.target to prevent a
  possible race condition with the creation of sockets.  Thanks to
  Michael Biebl for debugging this.
* Always restart the initctl socket on upgrades, to mask sysvinit
  removing it.

[ Michael Biebl ]
* Remove workaround for non-interactive sessions from pam config again.
* Create compat /dev/initctl symlink in case we are upgrading from a system
  running a newer version of sysvinit (using /run/initctl) and sysvinit is
  replaced with systemd-sysv during the upgrade. Closes: #663219
* Install new man pages.
* Build-Depend on valac (>= 0.12) instead of valac-0.12. Closes: #663323

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
 
47
47
        /* Remove this unit from the chain of devices which share the
48
48
         * same sysfs path. */
49
 
        first = hashmap_get(d->meta.manager->devices_by_sysfs, d->sysfs);
 
49
        first = hashmap_get(UNIT(d)->manager->devices_by_sysfs, d->sysfs);
50
50
        LIST_REMOVE(Device, same_sysfs, first, d);
51
51
 
52
52
        if (first)
53
 
                hashmap_remove_and_replace(d->meta.manager->devices_by_sysfs, d->sysfs, first->sysfs, first);
 
53
                hashmap_remove_and_replace(UNIT(d)->manager->devices_by_sysfs, d->sysfs, first->sysfs, first);
54
54
        else
55
 
                hashmap_remove(d->meta.manager->devices_by_sysfs, d->sysfs);
 
55
                hashmap_remove(UNIT(d)->manager->devices_by_sysfs, d->sysfs);
56
56
 
57
57
        free(d->sysfs);
58
58
        d->sysfs = NULL;
62
62
        Device *d = DEVICE(u);
63
63
 
64
64
        assert(d);
65
 
        assert(d->meta.load_state == UNIT_STUB);
 
65
        assert(UNIT(d)->load_state == UNIT_STUB);
66
66
 
67
67
        /* In contrast to all other unit types we timeout jobs waiting
68
68
         * for devices by default. This is because they otherwise wait
69
69
         * indefinitely for plugged in devices, something which cannot
70
70
         * happen for the other units since their operations time out
71
71
         * anyway. */
72
 
        d->meta.job_timeout = DEFAULT_TIMEOUT_USEC;
 
72
        UNIT(d)->job_timeout = DEFAULT_TIMEOUT_USEC;
73
73
 
74
 
        d->meta.ignore_on_isolate = true;
75
 
        d->meta.ignore_on_snapshot = true;
 
74
        UNIT(d)->ignore_on_isolate = true;
 
75
        UNIT(d)->ignore_on_snapshot = true;
76
76
}
77
77
 
78
78
static void device_done(Unit *u) {
92
92
 
93
93
        if (state != old_state)
94
94
                log_debug("%s changed %s -> %s",
95
 
                          d->meta.id,
 
95
                          UNIT(d)->id,
96
96
                          device_state_to_string(old_state),
97
97
                          device_state_to_string(state));
98
98
 
198
198
        if (!u) {
199
199
                delete = true;
200
200
 
201
 
                if (!(u = unit_new(m)))
 
201
                u = unit_new(m, sizeof(Device));
 
202
                if (!u)
202
203
                        return -ENOMEM;
203
204
 
204
 
                if ((r = device_add_escaped_name(u, path)) < 0)
 
205
                r = device_add_escaped_name(u, path);
 
206
                if (r < 0)
205
207
                        goto fail;
206
208
 
207
209
                unit_add_to_load_queue(u);
387
389
 
388
390
        assert(d);
389
391
 
390
 
        if (startswith(u->meta.id, "sys-"))
 
392
        if (startswith(u->id, "sys-"))
391
393
                return NULL;
392
394
 
393
395
        /* Make everybody follow the unit that's named after the sysfs path */
394
396
        for (other = d->same_sysfs_next; other; other = other->same_sysfs_next)
395
 
                if (startswith(other->meta.id, "sys-"))
 
397
                if (startswith(UNIT(other)->id, "sys-"))
396
398
                        return UNIT(other);
397
399
 
398
400
        for (other = d->same_sysfs_prev; other; other = other->same_sysfs_prev) {
399
 
                if (startswith(other->meta.id, "sys-"))
 
401
                if (startswith(UNIT(other)->id, "sys-"))
400
402
                        return UNIT(other);
401
403
 
402
404
                first = other;
583
585
 
584
586
const UnitVTable device_vtable = {
585
587
        .suffix = ".device",
 
588
        .object_size = sizeof(Device),
586
589
        .sections =
587
590
                "Unit\0"
588
591
                "Device\0"