Welcome to little lamb

Code » anopa » commit ef808c2

Add aa-sync

author Olivier Brunel
2015-02-21 13:49:53 UTC
committer Olivier Brunel
2015-04-04 12:47:34 UTC
parent 150e4654f72961e62b6b38c34081046c98cf6bdb

Add aa-sync

doc/aa-sync.pod +28 -0
package/modes +1 -0
package/targets.mak +2 -0
src/utils/aa-sync.c +31 -0
src/utils/deps-exe/aa-sync +2 -0

diff --git a/doc/aa-sync.pod b/doc/aa-sync.pod
new file mode 100644
index 0000000..ef5963e
--- /dev/null
+++ b/doc/aa-sync.pod
@@ -0,0 +1,28 @@
+=head1 NAME
+
+aa-sync - Flush filesystems buffers
+
+=head1 SYNOPSIS
+
+B<aa-sync>
+
+=head1 OPTIONS
+
+=over
+
+=item B<-h, --help>
+
+Show help screen and exit.
+
+=item B<-V, --version>
+
+Show version information and exit.
+
+=back
+
+=head1 DESCRIPTION
+
+B<aa-sync>(1) causes all buffered modifications to file metadata and data to be
+written to the underlying filesystems.
+
+This is just a wrapper for B<sync>(2)
diff --git a/package/modes b/package/modes
index a5a2f3c..51a9c93 100644
--- a/package/modes
+++ b/package/modes
@@ -6,5 +6,6 @@ aa-mount                0755
 aa-pivot                0755
 aa-start                0755
 aa-stop                 0755
+aa-sync                 0755
 aa-test                 0755
 aa-umount               0755
diff --git a/package/targets.mak b/package/targets.mak
index dfb1ecc..5f923ce 100644
--- a/package/targets.mak
+++ b/package/targets.mak
@@ -9,6 +9,7 @@ aa-echo \
 aa-kill \
 aa-mount \
 aa-pivot \
+aa-sync \
 aa-test \
 aa-umount
 
@@ -22,6 +23,7 @@ aa-mount.1 \
 aa-pivot.1 \
 aa-start.1 \
 aa-stop.1 \
+aa-sync.1 \
 aa-test.1 \
 aa-umount.1
 
diff --git a/src/utils/aa-sync.c b/src/utils/aa-sync.c
new file mode 100644
index 0000000..f26b346
--- /dev/null
+++ b/src/utils/aa-sync.c
@@ -0,0 +1,31 @@
+
+#include <unistd.h>
+#include <skalibs/bytestr.h>
+#include <anopa/common.h>
+
+const char *PROG;
+
+static void
+dieusage (int rc)
+{
+    aa_die_usage (rc, "[OPTION]",
+            " -h, --help                    Show this help screen and exit\n"
+            " -V, --version                 Show version information and exit\n"
+            );
+}
+
+int
+main (int argc, char * const argv[])
+{
+    PROG = "aa-sync";
+
+    if (argc == 1)
+    {
+        sync ();
+        return 0;
+    }
+
+    if (argc == 2 && (str_equal (argv[1], "-V") || str_equal (argv[1], "--version")))
+        aa_die_version ();
+    dieusage ((argc == 2 && (str_equal (argv[1], "-h") || str_equal (argv[1], "--help"))) ? 0 : 1);
+}
diff --git a/src/utils/deps-exe/aa-sync b/src/utils/deps-exe/aa-sync
new file mode 100644
index 0000000..30987b4
--- /dev/null
+++ b/src/utils/deps-exe/aa-sync
@@ -0,0 +1,2 @@
+${LIBANOPA}
+-lskarnet