Welcome to little lamb

Code » anopa » commit c5c51df

enable: Support auto@instance for {-,+}files

author Olivier Brunel
2015-03-20 15:19:19 UTC
committer Olivier Brunel
2015-04-04 12:47:36 UTC
parent 35721be3327af567bdd9eef6bbf587d5b66385ce

enable: Support auto@instance for {-,+}files

That is, files prefixed with '-' or '+' that end with a '@' will also
have the instance name auto-added. Don't make much sense for '+' but will
allow '-' to remove "generic" ordering/dependencies.

E.g. in mount@{proc,dev,run,sys} you can use needs/-fsck@

src/libanopa/enable_service.c +7 -0

diff --git a/src/libanopa/enable_service.c b/src/libanopa/enable_service.c
index f83fae8..50afadb 100644
--- a/src/libanopa/enable_service.c
+++ b/src/libanopa/enable_service.c
@@ -205,6 +205,13 @@ copy_dir (const char        *src,
                         && (satmp.s[i] == '-' || satmp.s[i] == '+'))
                 {
                     byte_copy (buf_dst + l_dst + 1, len, satmp.s + i + 1);
+                    /* for any file in one of the 4 special places that ends
+                     * with a '@' we append our instance name
+                     * (don't make much sense for '+' but useful for '-' to
+                     * remove "generic" ordering/dependencies) */
+                    if (depth == 1 && instance && (flags & _AA_FLAG_IS_1OF4)
+                            && satmp.s[i + len - 1] == '@')
+                        byte_copy (buf_dst + l_dst + len, l_inst + 1, instance);
 
                     if (satmp.s[i] == '-')
                     {