A medium that is pulled while it is still mounted now gets the reference's
one-button "Disk Not Ejected" warning: Motif's error dialog, the device and
its stale mountpoint in the text, the Warning sound. The desktop (dtwm,
WmMcdeDesktop.c) owns the event descriptor already; it reads each event,
asks what it says, and checks the mount table before it shows anything.
McdeSys:
- mcde_sys_disk_event_info() parses both shapes the read gives: Linux's
uevent with its NULs turned into spaces ("remove@/... ACTION=remove
DEVNAME=sdb1 ...") and NetBSD's "device-detach sd0"; 1 when the device
went away, 0 for add/change/attach, -1 on bad arguments.
- mcde_sys_disk_detached(name, mountpoint, len): looks in the mount table
for a partition of NAME (sdb takes sdb1, sd0 takes sd0a), copies the
mountpoint and unmounts it the forced way -- "umount -l" on Linux,
"umount -f" on NetBSD (disk_linux.c, disk_netbsd.c) -- but never what the
computer runs from. 0 when nothing of NAME was mounted.
- test_disk_events.c: the uevent and drvctl shapes, add/change/attach,
missing DEVNAME, the bad arguments. make check: 8/8 PASS (the seven
before and this one).
Measured under Xvfb :79 with a real ext4 loop mount at /tmp/opencode/mnt:
- start of dtwm with MCDE_DESK_TEST_DEVICE="remove@/... DEVNAME=loop0":
log "desktop: loop0 (remove)", "umount: /tmp/opencode/mnt: must be
superuser to unmount.", "desktop: loop0 was mounted at
/tmp/opencode/mnt"; the dialog is 354x167 at (335,300), OK as the only
button (docs/screenshots/leopard/Device-Removal-mcde.png).
- sudo umount /tmp/opencode/mnt, the same event again: log "desktop: loop0
(remove)" and no "was mounted"; zero dialog windows -- a device that was
put away stays quiet.
- make mcde-linux MCDE_DIRS="install lib/McdeSys programs/dtwm" exit=0;
MCDE_DIRS=plist "mcde-plist-check: ok".
MCDE_DESK_TEST_DEVICE is the test hook: one event line through the same
handler a real event takes, without a kernel. The NetBSD drvctl branch is
unchanged (t0272); the force unmount there is written for it but was not
run. Still open in t0093: the Eject item in dtfile (Selected menu,
Command+E) and the qemu device_del test in a VM.
51 lines
2.3 KiB
Makefile
51 lines
2.3 KiB
Makefile
MAINTAINERCLEANFILES = Makefile.in
|
|
|
|
# McdeSys, MCDE's layer between the desktop and the operating system
|
|
# (include/Mcde/McdeSys.h): common.c is POSIX, one backend per system.
|
|
lib_LTLIBRARIES = libMcdeSys.la
|
|
|
|
# where pkgsrc installs what McdeSys runs, from configure (--with-pkg-prefix,
|
|
# --with-pkg-sysconfdir): the sources write MCDE_PKG_PREFIX "/bin/borg"
|
|
libMcdeSys_la_CPPFLAGS = -I$(top_srcdir)/include \
|
|
-DMCDE_PKG_PREFIX='"$(MCDE_PKG_PREFIX)"' \
|
|
-DMCDE_PKG_SYSCONFDIR='"$(MCDE_PKG_SYSCONFDIR)"' \
|
|
-DMCDE_DT_TOP='"$(prefix)"'
|
|
libMcdeSys_la_SOURCES = common.c text.c net.c sound.c users.c share.c netmount.c backup.c printers.c logs.c events.c mount.c private.h
|
|
if NETBSD
|
|
libMcdeSys_la_SOURCES += netbsd.c disk_netbsd.c mount_netbsd.c
|
|
# crypt(3), for the password hash; proplib(3), for the battery; libdns_sd
|
|
# (base), for the computers on the network (netbsd.c)
|
|
libMcdeSys_la_LIBADD = -lcrypt -lprop -ldns_sd
|
|
else
|
|
libMcdeSys_la_SOURCES += linux.c disk_linux.c mount_linux.c
|
|
endif
|
|
libMcdeSys_la_LDFLAGS = -version-info 1:0:0
|
|
|
|
# what the system tells about itself, for a look by hand: make check runs it
|
|
check_PROGRAMS = test_sysinfo test_netmount test_updatesource test_processes test_job test_netinput test_sysload test_disk_events
|
|
test_sysinfo_SOURCES = test_sysinfo.c
|
|
test_sysinfo_CPPFLAGS = -I$(top_srcdir)/include
|
|
test_sysinfo_LDADD = libMcdeSys.la
|
|
test_netmount_SOURCES = test_netmount.c
|
|
test_netmount_CPPFLAGS = -I$(top_srcdir)/include
|
|
test_netmount_LDADD = libMcdeSys.la
|
|
test_updatesource_SOURCES = test_updatesource.c
|
|
test_updatesource_CPPFLAGS = -I$(top_srcdir)/include
|
|
test_updatesource_LDADD = libMcdeSys.la
|
|
test_processes_SOURCES = test_processes.c
|
|
test_processes_CPPFLAGS = -I$(top_srcdir)/include
|
|
test_processes_LDADD = libMcdeSys.la
|
|
test_job_SOURCES = test_job.c
|
|
test_job_CPPFLAGS = -I$(top_srcdir)/include
|
|
test_job_LDADD = libMcdeSys.la
|
|
test_netinput_SOURCES = test_netinput.c
|
|
test_netinput_CPPFLAGS = -I$(top_srcdir)/include
|
|
test_netinput_LDADD = libMcdeSys.la
|
|
test_sysload_SOURCES = test_sysload.c
|
|
test_sysload_CPPFLAGS = -I$(top_srcdir)/include
|
|
test_sysload_LDADD = libMcdeSys.la
|
|
test_disk_events_SOURCES = test_disk_events.c
|
|
test_disk_events_CPPFLAGS = -I$(top_srcdir)/include
|
|
test_disk_events_LDADD = libMcdeSys.la
|
|
TESTS = test_sysinfo test_netmount test_updatesource test_processes test_job test_netinput test_sysload test_disk_events
|