Re: [systemd-devel] systemd-way for initialization zram swap

2013-01-05 Thread Maksim Melnikau
On Tue, Nov 20, 2012 at 2:30 AM, Lennart Poettering
lenn...@poettering.net wrote:
 If this is upstream in the kernel I think the nicest way to handle this
 would be to extend util-linux to learn a new zram option or so we can
 just add to the fstab lines, which sets up everything as needed. This
 would then be similar to /dev/loop may be handled through fstab.
FYI, I redirected similar question to util-linux ML
http://article.gmane.org/gmane.linux.utilities.util-linux-ng/6967
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd-way for initialization zram swap

2012-11-19 Thread Oleksii Shevchuk
That's enough for me:

# cat /etc/udev/rules.d/01-zram.rules 
KERNEL==zram[0-9], ENV{SYSTEMD_WANTS}=zram-swap@zram%n.service, 
TAG+=systemd

# cat /etc/systemd/system/zram-swap\@.service 
[Unit]
Description=Setup swap on zram based device %i
BindsTo=dev-%i.swap
After=dev-%i.device
Requires=dev-%i.device
Before=dev-%i.swap
Wants=dev-%i.swap

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=-/etc/conf.d/%i-size
ExecStart=-/bin/sh -c 'echo $SIZE  /sys/class/block/%i/disksize'
ExecStart=-/sbin/mkswap /dev/%i
ExecStop=-/bin/sh -c 'echo 1  /sys/class/block/%i/reset'

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd-way for initialization zram swap

2012-11-19 Thread Oleksii Shevchuk
 1. this service is kind of duplicating swap.target
 2. echo inside duplicates things, which tmpfiles.d could do

Maybe. 

IMO semantically, you have new device, that should be configured
before use. It can appears after loading module. As for man 7 bootup,
there is no deps between early targets. So tmpfiles could start earlier
then zram device appears, and so on. I think separate service for device
configuration should be used anyway. 

 3. service still based on some internals of swap.target - it doesn't
 do swaoff before ExecStop

I should add RefuseManualStart=/RefuseManualStop= to unit
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel