1 // SPDX-License-Identifier: GPL-2.0
3 * What: /sys/kernel/debug/orangefs/debug-help
5 * Contact: Mike Marshall <hubcap@omnibond.com>
7 * List of client and kernel debug keywords.
10 * What: /sys/kernel/debug/orangefs/client-debug
12 * Contact: Mike Marshall <hubcap@omnibond.com>
14 * Debug setting for "the client", the userspace
15 * helper for the kernel module.
18 * What: /sys/kernel/debug/orangefs/kernel-debug
20 * Contact: Mike Marshall <hubcap@omnibond.com>
22 * Debug setting for the orangefs kernel module.
24 * Any of the keywords, or comma-separated lists
25 * of keywords, from debug-help can be catted to
26 * client-debug or kernel-debug.
28 * "none", "all" and "verbose" are special keywords
29 * for client-debug. Setting client-debug to "all"
30 * is kind of like trying to drink water from a
31 * fire hose, "verbose" triggers most of the same
32 * output except for the constant flow of output
33 * from the main wait loop.
35 * "none" and "all" are similar settings for kernel-debug
36 * no need for a "verbose".
38 #include <linux/debugfs.h>
39 #include <linux/slab.h>
41 #include <linux/uaccess.h>
43 #include "orangefs-debugfs.h"
45 #include "orangefs-kernel.h"
47 #define DEBUG_HELP_STRING_SIZE 4096
48 #define HELP_STRING_UNINITIALIZED \
49 "Client Debug Keywords are unknown until the first time\n" \
50 "the client is started after boot.\n"
51 #define ORANGEFS_KMOD_DEBUG_HELP_FILE "debug-help"
52 #define ORANGEFS_KMOD_DEBUG_FILE "kernel-debug"
53 #define ORANGEFS_CLIENT_DEBUG_FILE "client-debug"
54 #define ORANGEFS_VERBOSE "verbose"
55 #define ORANGEFS_ALL "all"
58 * An array of client_debug_mask will be built to hold debug keyword/mask
59 * values fetched from userspace.
61 struct client_debug_mask {
67 static void orangefs_kernel_debug_init(void);
69 static int orangefs_debug_help_open(struct inode *, struct file *);
70 static void *help_start(struct seq_file *, loff_t *);
71 static void *help_next(struct seq_file *, void *, loff_t *);
72 static void help_stop(struct seq_file *, void *);
73 static int help_show(struct seq_file *, void *);
75 static int orangefs_debug_open(struct inode *, struct file *);
77 static ssize_t orangefs_debug_read(struct file *,
82 static ssize_t orangefs_debug_write(struct file *,
87 static int orangefs_prepare_cdm_array(char *);
88 static void debug_mask_to_string(void *, int);
89 static void do_k_string(void *, int);
90 static void do_c_string(void *, int);
91 static int keyword_is_amalgam(char *);
92 static int check_amalgam_keyword(void *, int);
93 static void debug_string_to_mask(char *, void *, int);
94 static void do_c_mask(int, char *, struct client_debug_mask **);
95 static void do_k_mask(int, char *, __u64 **);
97 static char kernel_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN] = "none";
98 static char *debug_help_string;
99 static char client_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN];
100 static char client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN];
102 static struct dentry *client_debug_dentry;
103 static struct dentry *debug_dir;
105 static unsigned int kernel_mask_set_mod_init;
106 static int orangefs_debug_disabled = 1;
107 static int help_string_initialized;
109 static const struct seq_operations help_debug_ops = {
116 static const struct file_operations debug_help_fops = {
117 .owner = THIS_MODULE,
118 .open = orangefs_debug_help_open,
120 .release = seq_release,
124 static const struct file_operations kernel_debug_fops = {
125 .owner = THIS_MODULE,
126 .open = orangefs_debug_open,
127 .read = orangefs_debug_read,
128 .write = orangefs_debug_write,
129 .llseek = generic_file_llseek,
132 static int client_all_index;
133 static int client_verbose_index;
135 static struct client_debug_mask *cdm_array;
136 static int cdm_element_count;
138 static struct client_debug_mask client_debug_mask;
141 * Used to protect data in ORANGEFS_KMOD_DEBUG_FILE and
142 * ORANGEFS_KMOD_DEBUG_FILE.
144 static DEFINE_MUTEX(orangefs_debug_lock);
146 /* Used to protect data in ORANGEFS_KMOD_DEBUG_HELP_FILE */
147 static DEFINE_MUTEX(orangefs_help_file_lock);
150 * initialize kmod debug operations, create orangefs debugfs dir and
151 * ORANGEFS_KMOD_DEBUG_HELP_FILE.
153 void orangefs_debugfs_init(int debug_mask)
155 /* convert input debug mask to a 64-bit unsigned integer */
156 orangefs_gossip_debug_mask = (unsigned long long)debug_mask;
159 * set the kernel's gossip debug string; invalid mask values will
162 debug_mask_to_string(&orangefs_gossip_debug_mask, 0);
164 /* remove any invalid values from the mask */
165 debug_string_to_mask(kernel_debug_string, &orangefs_gossip_debug_mask,
169 * if the mask has a non-zero value, then indicate that the mask
170 * was set when the kernel module was loaded. The orangefs dev ioctl
171 * command will look at this boolean to determine if the kernel's
172 * debug mask should be overwritten when the client-core is started.
174 if (orangefs_gossip_debug_mask != 0)
175 kernel_mask_set_mod_init = true;
177 pr_info("%s: called with debug mask: :%s: :%llx:\n",
180 (unsigned long long)orangefs_gossip_debug_mask);
182 debug_dir = debugfs_create_dir("orangefs", NULL);
184 debugfs_create_file(ORANGEFS_KMOD_DEBUG_HELP_FILE, 0444, debug_dir,
185 debug_help_string, &debug_help_fops);
187 orangefs_debug_disabled = 0;
189 orangefs_kernel_debug_init();
193 * initialize the kernel-debug file.
195 static void orangefs_kernel_debug_init(void)
198 char *k_buffer = NULL;
200 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: start\n", __func__);
202 k_buffer = kzalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL);
206 if (strlen(kernel_debug_string) + 1 < ORANGEFS_MAX_DEBUG_STRING_LEN) {
207 strcpy(k_buffer, kernel_debug_string);
208 strcat(k_buffer, "\n");
210 strcpy(k_buffer, "none\n");
211 pr_info("%s: overflow 1!\n", __func__);
214 debugfs_create_file(ORANGEFS_KMOD_DEBUG_FILE, 0444, debug_dir, k_buffer,
218 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: rc:%d:\n", __func__, rc);
222 void orangefs_debugfs_cleanup(void)
224 debugfs_remove_recursive(debug_dir);
227 /* open ORANGEFS_KMOD_DEBUG_HELP_FILE */
228 static int orangefs_debug_help_open(struct inode *inode, struct file *file)
233 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
234 "orangefs_debug_help_open: start\n");
236 if (orangefs_debug_disabled)
239 ret = seq_open(file, &help_debug_ops);
243 ((struct seq_file *)(file->private_data))->private = inode->i_private;
248 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
249 "orangefs_debug_help_open: rc:%d:\n",
255 * I think start always gets called again after stop. Start
256 * needs to return NULL when it is done. The whole "payload"
257 * in this case is a single (long) string, so by the second
258 * time we get to start (pos = 1), we're done.
260 static void *help_start(struct seq_file *m, loff_t *pos)
262 void *payload = NULL;
264 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_start: start\n");
266 mutex_lock(&orangefs_help_file_lock);
269 payload = m->private;
274 static void *help_next(struct seq_file *m, void *v, loff_t *pos)
277 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_next: start\n");
282 static void help_stop(struct seq_file *m, void *p)
284 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_stop: start\n");
285 mutex_unlock(&orangefs_help_file_lock);
288 static int help_show(struct seq_file *m, void *v)
290 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_show: start\n");
298 * initialize the client-debug file.
300 static int orangefs_client_debug_init(void)
304 char *c_buffer = NULL;
306 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: start\n", __func__);
308 c_buffer = kzalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL);
312 if (strlen(client_debug_string) + 1 < ORANGEFS_MAX_DEBUG_STRING_LEN) {
313 strcpy(c_buffer, client_debug_string);
314 strcat(c_buffer, "\n");
316 strcpy(c_buffer, "none\n");
317 pr_info("%s: overflow! 2\n", __func__);
320 client_debug_dentry = debugfs_create_file(ORANGEFS_CLIENT_DEBUG_FILE,
330 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: rc:%d:\n", __func__, rc);
334 /* open ORANGEFS_KMOD_DEBUG_FILE or ORANGEFS_CLIENT_DEBUG_FILE.*/
335 static int orangefs_debug_open(struct inode *inode, struct file *file)
339 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
340 "%s: orangefs_debug_disabled: %d\n",
342 orangefs_debug_disabled);
344 if (orangefs_debug_disabled)
348 mutex_lock(&orangefs_debug_lock);
349 file->private_data = inode->i_private;
350 mutex_unlock(&orangefs_debug_lock);
353 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
354 "orangefs_debug_open: rc: %d\n",
359 static ssize_t orangefs_debug_read(struct file *file,
366 ssize_t read_ret = -ENOMEM;
368 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "orangefs_debug_read: start\n");
370 buf = kmalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL);
374 mutex_lock(&orangefs_debug_lock);
375 sprintf_ret = sprintf(buf, "%s", (char *)file->private_data);
376 mutex_unlock(&orangefs_debug_lock);
378 read_ret = simple_read_from_buffer(ubuf, count, ppos, buf, sprintf_ret);
383 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
384 "orangefs_debug_read: ret: %zu\n",
390 static ssize_t orangefs_debug_write(struct file *file,
391 const char __user *ubuf,
399 struct orangefs_kernel_op_s *new_op = NULL;
400 struct client_debug_mask c_mask = { NULL, 0, 0 };
403 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
404 "orangefs_debug_write: %pD\n",
411 * Thwart users who try to jamb a ridiculous number
412 * of bytes into the debug file...
414 if (count > ORANGEFS_MAX_DEBUG_STRING_LEN + 1) {
416 count = ORANGEFS_MAX_DEBUG_STRING_LEN + 1;
419 buf = kzalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL);
423 if (copy_from_user(buf, ubuf, count - 1)) {
424 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
425 "%s: copy_from_user failed!\n",
431 * Map the keyword string from userspace into a valid debug mask.
432 * The mapping process involves mapping the human-inputted string
433 * into a valid mask, and then rebuilding the string from the
434 * verified valid mask.
436 * A service operation is required to set a new client-side
439 if (!strcmp(file->f_path.dentry->d_name.name,
440 ORANGEFS_KMOD_DEBUG_FILE)) {
441 debug_string_to_mask(buf, &orangefs_gossip_debug_mask, 0);
442 debug_mask_to_string(&orangefs_gossip_debug_mask, 0);
443 debug_string = kernel_debug_string;
444 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
445 "New kernel debug string is %s\n",
446 kernel_debug_string);
448 /* Can't reset client debug mask if client is not running. */
449 if (is_daemon_in_service()) {
450 pr_info("%s: Client not running :%d:\n",
452 is_daemon_in_service());
456 debug_string_to_mask(buf, &c_mask, 1);
457 debug_mask_to_string(&c_mask, 1);
458 debug_string = client_debug_string;
460 new_op = op_alloc(ORANGEFS_VFS_OP_PARAM);
462 pr_info("%s: op_alloc failed!\n", __func__);
466 new_op->upcall.req.param.op =
467 ORANGEFS_PARAM_REQUEST_OP_TWO_MASK_VALUES;
468 new_op->upcall.req.param.type = ORANGEFS_PARAM_REQUEST_SET;
469 memset(new_op->upcall.req.param.s_value,
471 ORANGEFS_MAX_DEBUG_STRING_LEN);
472 sprintf(new_op->upcall.req.param.s_value,
477 /* service_operation returns 0 on success... */
478 rc = service_operation(new_op,
480 ORANGEFS_OP_INTERRUPTIBLE);
483 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
484 "%s: service_operation failed! rc:%d:\n",
491 mutex_lock(&orangefs_debug_lock);
492 s = file_inode(file)->i_private;
493 memset(s, 0, ORANGEFS_MAX_DEBUG_STRING_LEN);
494 sprintf(s, "%s\n", debug_string);
495 mutex_unlock(&orangefs_debug_lock);
504 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
505 "orangefs_debug_write: rc: %d\n",
512 * After obtaining a string representation of the client's debug
513 * keywords and their associated masks, this function is called to build an
514 * array of these values.
516 static int orangefs_prepare_cdm_array(char *debug_array_string)
520 char *cds_head = NULL;
521 char *cds_delimiter = NULL;
524 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__);
527 * figure out how many elements the cdm_array needs.
529 for (i = 0; i < strlen(debug_array_string); i++)
530 if (debug_array_string[i] == '\n')
533 if (!cdm_element_count) {
534 pr_info("No elements in client debug array string!\n");
538 cdm_array = kcalloc(cdm_element_count, sizeof(*cdm_array), GFP_KERNEL);
544 cds_head = debug_array_string;
546 for (i = 0; i < cdm_element_count; i++) {
547 cds_delimiter = strchr(cds_head, '\n');
548 *cds_delimiter = '\0';
550 keyword_len = strcspn(cds_head, " ");
552 cdm_array[i].keyword = kzalloc(keyword_len + 1, GFP_KERNEL);
553 if (!cdm_array[i].keyword) {
560 cdm_array[i].keyword,
561 (unsigned long long *)&(cdm_array[i].mask1),
562 (unsigned long long *)&(cdm_array[i].mask2));
564 if (!strcmp(cdm_array[i].keyword, ORANGEFS_VERBOSE))
565 client_verbose_index = i;
567 if (!strcmp(cdm_array[i].keyword, ORANGEFS_ALL))
568 client_all_index = i;
570 cds_head = cds_delimiter + 1;
573 rc = cdm_element_count;
575 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: rc:%d:\n", __func__, rc);
584 * /sys/kernel/debug/orangefs/debug-help can be catted to
585 * see all the available kernel and client debug keywords.
587 * When orangefs.ko initializes, we have no idea what keywords the
588 * client supports, nor their associated masks.
590 * We pass through this function once at module-load and stamp a
591 * boilerplate "we don't know" message for the client in the
592 * debug-help file. We pass through here again when the client
593 * starts and then we can fill out the debug-help file fully.
595 * The client might be restarted any number of times between
596 * module reloads, we only build the debug-help file the first time.
598 int orangefs_prepare_debugfs_help_string(int at_boot)
600 char *client_title = "Client Debug Keywords:\n";
601 char *kernel_title = "Kernel Debug Keywords:\n";
602 size_t string_size = DEBUG_HELP_STRING_SIZE;
608 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__);
611 client_title = HELP_STRING_UNINITIALIZED;
613 /* build a new debug_help_string. */
614 new = kzalloc(DEBUG_HELP_STRING_SIZE, GFP_KERNEL);
621 * strlcat(dst, src, size) will append at most
622 * "size - strlen(dst) - 1" bytes of src onto dst,
623 * null terminating the result, and return the total
624 * length of the string it tried to create.
626 * We'll just plow through here building our new debug
627 * help string and let strlcat take care of assuring that
628 * dst doesn't overflow.
630 strlcat(new, client_title, string_size);
635 * fill the client keyword/mask array and remember
636 * how many elements there were.
639 orangefs_prepare_cdm_array(client_debug_array_string);
640 if (cdm_element_count <= 0) {
645 for (i = 0; i < cdm_element_count; i++) {
646 strlcat(new, "\t", string_size);
647 strlcat(new, cdm_array[i].keyword, string_size);
648 strlcat(new, "\n", string_size);
652 strlcat(new, "\n", string_size);
653 strlcat(new, kernel_title, string_size);
655 for (i = 0; i < num_kmod_keyword_mask_map; i++) {
656 strlcat(new, "\t", string_size);
657 strlcat(new, s_kmod_keyword_mask_map[i].keyword, string_size);
658 result_size = strlcat(new, "\n", string_size);
661 /* See if we tried to put too many bytes into "new"... */
662 if (result_size >= string_size) {
668 debug_help_string = new;
670 mutex_lock(&orangefs_help_file_lock);
671 memset(debug_help_string, 0, DEBUG_HELP_STRING_SIZE);
672 strlcat(debug_help_string, new, string_size);
673 mutex_unlock(&orangefs_help_file_lock);
686 static void debug_mask_to_string(void *mask, int type)
691 int element_count = 0;
693 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__);
696 debug_string = client_debug_string;
697 element_count = cdm_element_count;
699 debug_string = kernel_debug_string;
700 element_count = num_kmod_keyword_mask_map;
703 memset(debug_string, 0, ORANGEFS_MAX_DEBUG_STRING_LEN);
706 * Some keywords, like "all" or "verbose", are amalgams of
707 * numerous other keywords. Make a special check for those
708 * before grinding through the whole mask only to find out
711 if (check_amalgam_keyword(mask, type))
714 /* Build the debug string. */
715 for (i = 0; i < element_count; i++)
717 do_c_string(mask, i);
719 do_k_string(mask, i);
721 len = strlen(debug_string);
724 client_debug_string[len - 1] = '\0';
726 kernel_debug_string[len - 1] = '\0';
728 strcpy(client_debug_string, "none");
730 strcpy(kernel_debug_string, "none");
733 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: string:%s:\n", __func__, debug_string);
739 static void do_k_string(void *k_mask, int index)
741 __u64 *mask = (__u64 *) k_mask;
743 if (keyword_is_amalgam((char *) s_kmod_keyword_mask_map[index].keyword))
746 if (*mask & s_kmod_keyword_mask_map[index].mask_val) {
747 if ((strlen(kernel_debug_string) +
748 strlen(s_kmod_keyword_mask_map[index].keyword))
749 < ORANGEFS_MAX_DEBUG_STRING_LEN - 1) {
750 strcat(kernel_debug_string,
751 s_kmod_keyword_mask_map[index].keyword);
752 strcat(kernel_debug_string, ",");
754 gossip_err("%s: overflow!\n", __func__);
755 strcpy(kernel_debug_string, ORANGEFS_ALL);
765 static void do_c_string(void *c_mask, int index)
767 struct client_debug_mask *mask = (struct client_debug_mask *) c_mask;
769 if (keyword_is_amalgam(cdm_array[index].keyword))
772 if ((mask->mask1 & cdm_array[index].mask1) ||
773 (mask->mask2 & cdm_array[index].mask2)) {
774 if ((strlen(client_debug_string) +
775 strlen(cdm_array[index].keyword) + 1)
776 < ORANGEFS_MAX_DEBUG_STRING_LEN - 2) {
777 strcat(client_debug_string,
778 cdm_array[index].keyword);
779 strcat(client_debug_string, ",");
781 gossip_err("%s: overflow!\n", __func__);
782 strcpy(client_debug_string, ORANGEFS_ALL);
790 static int keyword_is_amalgam(char *keyword)
794 if ((!strcmp(keyword, ORANGEFS_ALL)) || (!strcmp(keyword, ORANGEFS_VERBOSE)))
804 * return 1 if we found an amalgam.
806 static int check_amalgam_keyword(void *mask, int type)
809 struct client_debug_mask *c_mask;
810 int k_all_index = num_kmod_keyword_mask_map - 1;
814 c_mask = (struct client_debug_mask *) mask;
816 if ((c_mask->mask1 == cdm_array[client_all_index].mask1) &&
817 (c_mask->mask2 == cdm_array[client_all_index].mask2)) {
818 strcpy(client_debug_string, ORANGEFS_ALL);
823 if ((c_mask->mask1 == cdm_array[client_verbose_index].mask1) &&
824 (c_mask->mask2 == cdm_array[client_verbose_index].mask2)) {
825 strcpy(client_debug_string, ORANGEFS_VERBOSE);
831 k_mask = (__u64 *) mask;
833 if (*k_mask >= s_kmod_keyword_mask_map[k_all_index].mask_val) {
834 strcpy(kernel_debug_string, ORANGEFS_ALL);
849 static void debug_string_to_mask(char *debug_string, void *mask, int type)
851 char *unchecked_keyword;
853 char *strsep_fodder = kstrdup(debug_string, GFP_KERNEL);
854 char *original_pointer;
855 int element_count = 0;
856 struct client_debug_mask *c_mask = NULL;
857 __u64 *k_mask = NULL;
859 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__);
862 c_mask = (struct client_debug_mask *)mask;
863 element_count = cdm_element_count;
865 k_mask = (__u64 *)mask;
867 element_count = num_kmod_keyword_mask_map;
870 original_pointer = strsep_fodder;
871 while ((unchecked_keyword = strsep(&strsep_fodder, ",")))
872 if (strlen(unchecked_keyword)) {
873 for (i = 0; i < element_count; i++)
884 kfree(original_pointer);
887 static void do_c_mask(int i, char *unchecked_keyword,
888 struct client_debug_mask **sane_mask)
891 if (!strcmp(cdm_array[i].keyword, unchecked_keyword)) {
892 (**sane_mask).mask1 = (**sane_mask).mask1 | cdm_array[i].mask1;
893 (**sane_mask).mask2 = (**sane_mask).mask2 | cdm_array[i].mask2;
897 static void do_k_mask(int i, char *unchecked_keyword, __u64 **sane_mask)
900 if (!strcmp(s_kmod_keyword_mask_map[i].keyword, unchecked_keyword))
901 **sane_mask = (**sane_mask) |
902 s_kmod_keyword_mask_map[i].mask_val;
905 int orangefs_debugfs_new_client_mask(void __user *arg)
907 struct dev_mask2_info_s mask2_info = {0};
910 ret = copy_from_user(&mask2_info,
912 sizeof(struct dev_mask2_info_s));
917 client_debug_mask.mask1 = mask2_info.mask1_value;
918 client_debug_mask.mask2 = mask2_info.mask2_value;
920 pr_info("%s: client debug mask has been been received "
923 (unsigned long long)client_debug_mask.mask1,
924 (unsigned long long)client_debug_mask.mask2);
929 int orangefs_debugfs_new_client_string(void __user *arg)
933 ret = copy_from_user(&client_debug_array_string,
935 ORANGEFS_MAX_DEBUG_STRING_LEN);
938 pr_info("%s: CLIENT_STRING: copy_from_user failed\n",
944 * The real client-core makes an effort to ensure
945 * that actual strings that aren't too long to fit in
946 * this buffer is what we get here. We're going to use
947 * string functions on the stuff we got, so we'll make
948 * this extra effort to try and keep from
949 * flowing out of this buffer when we use the string
950 * functions, even if somehow the stuff we end up
951 * with here is garbage.
953 client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN - 1] =
956 pr_info("%s: client debug array string has been received.\n",
959 if (!help_string_initialized) {
961 /* Build a proper debug help string. */
962 ret = orangefs_prepare_debugfs_help_string(0);
964 gossip_err("%s: no debug help string \n",
971 debug_mask_to_string(&client_debug_mask, 1);
973 debugfs_remove(client_debug_dentry);
975 orangefs_client_debug_init();
977 help_string_initialized++;
982 int orangefs_debugfs_new_debug(void __user *arg)
984 struct dev_mask_info_s mask_info = {0};
987 ret = copy_from_user(&mask_info,
994 if (mask_info.mask_type == KERNEL_MASK) {
995 if ((mask_info.mask_value == 0)
996 && (kernel_mask_set_mod_init)) {
998 * the kernel debug mask was set when the
999 * kernel module was loaded; don't override
1000 * it if the client-core was started without
1001 * a value for ORANGEFS_KMODMASK.
1005 debug_mask_to_string(&mask_info.mask_value,
1006 mask_info.mask_type);
1007 orangefs_gossip_debug_mask = mask_info.mask_value;
1008 pr_info("%s: kernel debug mask has been modified to "
1011 kernel_debug_string,
1012 (unsigned long long)orangefs_gossip_debug_mask);
1013 } else if (mask_info.mask_type == CLIENT_MASK) {
1014 debug_mask_to_string(&mask_info.mask_value,
1015 mask_info.mask_type);
1016 pr_info("%s: client debug mask has been modified to"
1019 client_debug_string,
1020 llu(mask_info.mask_value));
1022 gossip_err("Invalid mask type....\n");