Imported Upstream version 2.3.3
[platform/upstream/cryptsetup.git] / docs / examples / crypt_log_usage.c
index 15a8a0b..d8364af 100644 (file)
@@ -1,3 +1,23 @@
+/*
+ * libcryptsetup API log example
+ *
+ * Copyright (C) 2011-2020 Red Hat, Inc. All rights reserved.
+ *
+ * This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
 #include <stdio.h>
 #include <sys/types.h>
 #include <syslog.h>
@@ -5,10 +25,8 @@
 #include <libcryptsetup.h>
 
 /*
- * This is an example of function that can be registered using crypt_set_log_callback API.
+ * This is an example of crypt_set_log_callback API callback.
  *
- * Its prototype is void (*log)(int level, const char *msg, void *usrptr) as defined
- * in crypt_set_log_callback
  */
 static void simple_syslog_wrapper(int level, const char *msg, void *usrptr)
 {
@@ -51,7 +69,7 @@ int main(void)
                return 2;
        }
 
-       /* crypt_set_log_callback() - register a log function for crypt context */
+       /* crypt_set_log_callback() - register a log callback for crypt context */
        crypt_set_log_callback(cd, &simple_syslog_wrapper, (void *)usrprefix);
 
        /* send messages ithrough the crypt_log() interface */
@@ -63,7 +81,7 @@ int main(void)
        /* release crypt context */
        crypt_free(cd);
 
-       /* Initialize default (global) log function */
+       /* Initialize default (global) log callback */
        crypt_set_log_callback(NULL, &simple_syslog_wrapper, NULL);
 
        crypt_log(NULL, CRYPT_LOG_NORMAL, "This is normal log message");