Whamcloud - gitweb
LU-9859 libcfs: remove libcfs_debug_vmsg2 25/35225/3
authorNeilBrown <neilb@suse.com>
Thu, 13 Jun 2019 19:10:21 +0000 (15:10 -0400)
committerOleg Drokin <green@whamcloud.com>
Sun, 7 Jul 2019 15:16:01 +0000 (15:16 +0000)
Now that libcfs_debug_vmsg2 has no (external) users, we can remove it.
It is used to implement libcfs_debug_msg(), so simply move
the body of the function (suitably modified) into that one caller.

Linux-commit: d42a3aded317c97594c19995879999428de53c46

Signed-off-by: NeilBrown <neilb@suse.com>
Change-Id: I80d24abcc23a8f6e2f8b995d1337ba5038318d5a
Reviewed-on: https://review.whamcloud.com/35225
Reviewed-by: Shaun Tancheff <stancheff@cray.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/libcfs_debug.h
libcfs/libcfs/tracefile.c
libcfs/libcfs/tracefile.h

index a167cf3..9c33011 100644 (file)
@@ -288,11 +288,6 @@ extern int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata,
                             const char *format1, ...)
         __attribute__ ((format (printf, 2, 3)));
 
                             const char *format1, ...)
         __attribute__ ((format (printf, 2, 3)));
 
-extern int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
-                              const char *format1,
-                              va_list args, const char *format2, ...)
-        __attribute__ ((format (printf, 4, 5)));
-
 /* other external symbols that tracefile provides: */
 extern int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob,
                                   const char __user *usr_buffer,
 /* other external symbols that tracefile provides: */
 extern int cfs_trace_copyin_string(char *knl_buffer, int knl_buffer_nob,
                                   const char __user *usr_buffer,
index 81e9fb2..9669e87 100644 (file)
@@ -247,21 +247,6 @@ static struct cfs_trace_page *cfs_trace_get_tage(struct cfs_trace_cpu_data *tcd,
 int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata,
                      const char *format, ...)
 {
 int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata,
                      const char *format, ...)
 {
-        va_list args;
-        int     rc;
-
-        va_start(args, format);
-        rc = libcfs_debug_vmsg2(msgdata, format, args, NULL);
-        va_end(args);
-
-        return rc;
-}
-EXPORT_SYMBOL(libcfs_debug_msg);
-
-int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
-                       const char *format1, va_list args,
-                       const char *format2, ...)
-{
         struct cfs_trace_cpu_data *tcd = NULL;
         struct ptldebug_header     header = {0};
         struct cfs_trace_page     *tage;
         struct cfs_trace_cpu_data *tcd = NULL;
         struct ptldebug_header     header = {0};
         struct cfs_trace_page     *tage;
@@ -324,7 +309,7 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
                 }
 
                string_buf = (char *)page_address(tage->page) +
                 }
 
                string_buf = (char *)page_address(tage->page) +
-                                        tage->used + known_size;
+                            tage->used + known_size;
 
                max_nob = PAGE_SIZE - tage->used - known_size;
                if (max_nob <= 0) {
 
                max_nob = PAGE_SIZE - tage->used - known_size;
                if (max_nob <= 0) {
@@ -337,22 +322,14 @@ int libcfs_debug_vmsg2(struct libcfs_debug_msg_data *msgdata,
                }
 
                 needed = 0;
                }
 
                 needed = 0;
-                if (format1) {
-                        va_copy(ap, args);
-                        needed = vsnprintf(string_buf, max_nob, format1, ap);
-                        va_end(ap);
-                }
-
-                if (format2) {
-                        remain = max_nob - needed;
-                        if (remain < 0)
-                                remain = 0;
+               remain = max_nob - needed;
+               if (remain < 0)
+                       remain = 0;
 
 
-                        va_start(ap, format2);
-                        needed += vsnprintf(string_buf + needed, remain,
-                                            format2, ap);
-                        va_end(ap);
-                }
+               va_start(ap, format);
+               needed += vsnprintf(string_buf + needed, remain,
+                                   format, ap);
+               va_end(ap);
 
                 if (needed < max_nob) /* well. printing ok.. */
                         break;
 
                 if (needed < max_nob) /* well. printing ok.. */
                         break;
@@ -438,22 +415,14 @@ console:
                 string_buf = cfs_trace_get_console_buffer();
 
                 needed = 0;
                 string_buf = cfs_trace_get_console_buffer();
 
                 needed = 0;
-                if (format1 != NULL) {
-                        va_copy(ap, args);
-                        needed = vsnprintf(string_buf,
-                                           CFS_TRACE_CONSOLE_BUFFER_SIZE,
-                                           format1, ap);
-                        va_end(ap);
-                }
-                if (format2 != NULL) {
-                        remain = CFS_TRACE_CONSOLE_BUFFER_SIZE - needed;
-                        if (remain > 0) {
-                                va_start(ap, format2);
-                                needed += vsnprintf(string_buf+needed, remain,
-                                                    format2, ap);
-                                va_end(ap);
-                        }
+               remain = CFS_TRACE_CONSOLE_BUFFER_SIZE - needed;
+               if (remain > 0) {
+                       va_start(ap, format);
+                       needed += vsnprintf(string_buf+needed, remain,
+                                           format, ap);
+                       va_end(ap);
                 }
                 }
+
                 cfs_print_to_console(&header, mask,
                                      string_buf, needed, file, msgdata->msg_fn);
 
                 cfs_print_to_console(&header, mask,
                                      string_buf, needed, file, msgdata->msg_fn);
 
@@ -478,7 +447,7 @@ console:
 
         return 0;
 }
 
         return 0;
 }
-EXPORT_SYMBOL(libcfs_debug_vmsg2);
+EXPORT_SYMBOL(libcfs_debug_msg);
 
 void
 cfs_trace_assertion_failed(const char *str,
 
 void
 cfs_trace_assertion_failed(const char *str,
index 7994ab6..9497e88 100644 (file)
@@ -114,7 +114,7 @@ union cfs_trace_data_union {
                 * Even though this structure is meant to be per-CPU, locking
                 * is needed because in some places the data may be accessed
                 * from other CPUs. This lock is directly used in trace_get_tcd
                 * Even though this structure is meant to be per-CPU, locking
                 * is needed because in some places the data may be accessed
                 * from other CPUs. This lock is directly used in trace_get_tcd
-                * and trace_put_tcd, which are called in libcfs_debug_vmsg2 and
+                * and trace_put_tcd, which are called in libcfs_debug_msg and
                 * tcd_for_each_type_lock
                 */
                spinlock_t              tcd_lock;
                 * tcd_for_each_type_lock
                 */
                spinlock_t              tcd_lock;