Hi,

    Update the mdev.conf's example patch with the following:
        1. add a link from /dev/$MDEV to /dev/block/$MAJOR:$MINOR before
create a device
        2. remove the /dev/block/$MAJOR:$MINOR link before remove a device

--- mdev.conf 2018-10-17 16:39:56.322969733 +0800
+++ mdev.conf.new 2018-10-19 10:19:16.570123044 +0800
@@ -15,6 +15,11 @@
 # =: move, >: move and create a symlink
 # !: do not create device node
 # @|$|*: run@cmd if $ACTION=add,  $cmd if $ACTION=remove, *cmd in all cases
+#
+# An example for creating a link for using linux kernel's IMA/EVM feature
+# Also, need to create a folder at "/dev/block" before executing `mdev -s`
+# [hs]d[a-z]* 0:6 660 @ln -sf /dev/$MDEV /dev/block/$(printf "%d:%d"
$(stat -c "0x%t 0x%T" /dev/$MDEV))
+# [hs]d[a-z]* 0:6 660 $rm -f /dev/block/$(printf "%d:%d" $(stat -c "0x%t
0x%T" /dev/$MDEV))


趙翊廷 <jack...@csie.io> 於 2018年10月19日 週五 下午1:23寫道:

> Bernhard Reutner-Fischer <rep.dot....@gmail.com> 於 2018年10月18日 週四
> 下午4:54寫道:
>
>> On Thu, 18 Oct 2018 at 09:47, Bernhard Reutner-Fischer
>> <rep.dot....@gmail.com> wrote:
>> >
>> > On Wed, 17 Oct 2018 at 11:02, 趙翊廷 <jack...@csie.io> wrote:
>> >
>> > > 2. in /etc/mdev.confg we need to add a symbol link something like
>> /dev/block/3:0
>> > >     hd[a-z]* 0:6 660 *ln -sf /dev/$MDEV /dev/block/$(ls -l
>> /dev/$MDEV|awk '{print $5}'|tr -d ','):$(ls -l /dev/$MDEV|awk '{print $6}')
>> > >     sd[a-z]* 0:6 660 *ln -sf /dev/$MDEV /dev/block/$(ls -l
>> /dev/$MDEV|awk '{print $5}'|tr -d ','):$(ls -l /dev/$MDEV|awk '{print $6}')
>>
>> Furthermore, didn't we have a shorthand for symlinks -- aliaslink --
>> like (from memory) one of:
>> * ->symlinktarget
>> * > symlinktarget
>
>
> Indeed, using ">path" or "=path" is the preferred solution.
> But the kernel simply will not embed the MAJOR/MINOR number in the device
> node name, so we use external command instead.
>
>
>
>>
>>
> or the like?
>> Also, the '*' (IIRC) symlinks also on removal if you do not use the
>> built-in symlink support, so i'd expect you want more like (again
>> IIRC) '@', i.e. create.
>>
>
> Since ">" "=" are unavailable, we need two rules to handle After device
> create and Before device removed events.
>
> # create a MAJ:MIN link when device is created
> [hs]d[a-z]*    0:6 660 @ln -sf /dev/$MDEV /dev/block/$(printf "%d:%d"
> $(stat -c "0x%t 0x%T" /dev/$MDEV))
> # unlink when device is removed
> [hs]d[a-z]*    0:6 660 $rm -f /dev/block/$(printf "%d:%d" $(stat -c "0x%t
> 0x%T" /dev/$MDEV))
>
>
>
>> Maybe even simpler might be to create the disks as
>> /dev/block/MAJOR:MINOR and symlink back to /dev/DEVNAME, i.e. the
>> other way round.
>>
>> HTH,
>
>
--- mdev.conf	2018-10-17 16:39:56.322969733 +0800
+++ mdev.conf.new	2018-10-19 10:19:16.570123044 +0800
@@ -15,6 +15,11 @@
 # =: move, >: move and create a symlink
 # !: do not create device node
 # @|$|*: run@cmd if $ACTION=add,  $cmd if $ACTION=remove, *cmd in all cases
+#
+# An example for creating a link for using linux kernel's IMA/EVM feature
+# Also, need to create a folder at "/dev/block" before executing `mdev -s`
+# [hs]d[a-z]*	0:6 660 @ln -sf /dev/$MDEV /dev/block/$(printf "%d:%d" $(stat -c "0x%t 0x%T" /dev/$MDEV))
+# [hs]d[a-z]*	0:6 660 $rm -f /dev/block/$(printf "%d:%d" $(stat -c "0x%t 0x%T" /dev/$MDEV))
 
 null		0:0 666
 zero		0:0 666
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to