2 * What: /sys/kernel/debug/orangefs/debug-help
4 * Contact: Mike Marshall <hubcap@omnibond.com>
6 * List of client and kernel debug keywords.
9 * What: /sys/kernel/debug/orangefs/client-debug
11 * Contact: Mike Marshall <hubcap@omnibond.com>
13 * Debug setting for "the client", the userspace
14 * helper for the kernel module.
17 * What: /sys/kernel/debug/orangefs/kernel-debug
19 * Contact: Mike Marshall <hubcap@omnibond.com>
21 * Debug setting for the orangefs kernel module.
23 * Any of the keywords, or comma-separated lists
24 * of keywords, from debug-help can be catted to
25 * client-debug or kernel-debug.
27 * "none", "all" and "verbose" are special keywords
28 * for client-debug. Setting client-debug to "all"
29 * is kind of like trying to drink water from a
30 * fire hose, "verbose" triggers most of the same
31 * output except for the constant flow of output
32 * from the main wait loop.
34 * "none" and "all" are similar settings for kernel-debug
35 * no need for a "verbose".
37 #include <linux/debugfs.h>
38 #include <linux/slab.h>
40 #include <linux/uaccess.h>
42 #include "orangefs-debugfs.h"
44 #include "orangefs-kernel.h"
46 #define DEBUG_HELP_STRING_SIZE 4096
47 #define HELP_STRING_UNINITIALIZED \
48 "Client Debug Keywords are unknown until the first time\n" \
49 "the client is started after boot.\n"
50 #define ORANGEFS_KMOD_DEBUG_HELP_FILE "debug-help"
51 #define ORANGEFS_KMOD_DEBUG_FILE "kernel-debug"
52 #define ORANGEFS_CLIENT_DEBUG_FILE "client-debug"
53 #define ORANGEFS_VERBOSE "verbose"
54 #define ORANGEFS_ALL "all"
57 * An array of client_debug_mask will be built to hold debug keyword/mask
58 * values fetched from userspace.
60 struct client_debug_mask {
66 static int orangefs_kernel_debug_init(void);
68 static int orangefs_debug_help_open(struct inode *, struct file *);
69 static void *help_start(struct seq_file *, loff_t *);
70 static void *help_next(struct seq_file *, void *, loff_t *);
71 static void help_stop(struct seq_file *, void *);
72 static int help_show(struct seq_file *, void *);
74 static int orangefs_debug_open(struct inode *, struct file *);
76 static ssize_t orangefs_debug_read(struct file *,
81 static ssize_t orangefs_debug_write(struct file *,
86 static int orangefs_prepare_cdm_array(char *);
87 static void debug_mask_to_string(void *, int);
88 static void do_k_string(void *, int);
89 static void do_c_string(void *, int);
90 static int keyword_is_amalgam(char *);
91 static int check_amalgam_keyword(void *, int);
92 static void debug_string_to_mask(char *, void *, int);
93 static void do_c_mask(int, char *, struct client_debug_mask **);
94 static void do_k_mask(int, char *, __u64 **);
96 static char kernel_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN] = "none";
97 static char *debug_help_string;
98 static char client_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN];
99 static char client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN];
101 static struct dentry *help_file_dentry;
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 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 int orangefs_debugfs_init(int debug_mask)
157 /* convert input debug mask to a 64-bit unsigned integer */
158 orangefs_gossip_debug_mask = (unsigned long long)debug_mask;
161 * set the kernel's gossip debug string; invalid mask values will
164 debug_mask_to_string(&orangefs_gossip_debug_mask, 0);
166 /* remove any invalid values from the mask */
167 debug_string_to_mask(kernel_debug_string, &orangefs_gossip_debug_mask,
171 * if the mask has a non-zero value, then indicate that the mask
172 * was set when the kernel module was loaded. The orangefs dev ioctl
173 * command will look at this boolean to determine if the kernel's
174 * debug mask should be overwritten when the client-core is started.
176 if (orangefs_gossip_debug_mask != 0)
177 kernel_mask_set_mod_init = true;
179 pr_info("%s: called with debug mask: :%s: :%llx:\n",
182 (unsigned long long)orangefs_gossip_debug_mask);
184 debug_dir = debugfs_create_dir("orangefs", NULL);
186 pr_info("%s: debugfs_create_dir failed.\n", __func__);
190 help_file_dentry = debugfs_create_file(ORANGEFS_KMOD_DEBUG_HELP_FILE,
195 if (!help_file_dentry) {
196 pr_info("%s: debugfs_create_file failed.\n", __func__);
200 orangefs_debug_disabled = 0;
202 rc = orangefs_kernel_debug_init();
210 * initialize the kernel-debug file.
212 static int orangefs_kernel_debug_init(void)
216 char *k_buffer = NULL;
218 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: start\n", __func__);
220 k_buffer = kzalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL);
224 if (strlen(kernel_debug_string) + 1 < ORANGEFS_MAX_DEBUG_STRING_LEN) {
225 strcpy(k_buffer, kernel_debug_string);
226 strcat(k_buffer, "\n");
228 strcpy(k_buffer, "none\n");
229 pr_info("%s: overflow 1!\n", __func__);
232 ret = debugfs_create_file(ORANGEFS_KMOD_DEBUG_FILE,
238 pr_info("%s: failed to create %s.\n",
240 ORANGEFS_KMOD_DEBUG_FILE);
248 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: rc:%d:\n", __func__, rc);
253 void orangefs_debugfs_cleanup(void)
255 debugfs_remove_recursive(debug_dir);
258 /* open ORANGEFS_KMOD_DEBUG_HELP_FILE */
259 static int orangefs_debug_help_open(struct inode *inode, struct file *file)
264 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
265 "orangefs_debug_help_open: start\n");
267 if (orangefs_debug_disabled)
270 ret = seq_open(file, &help_debug_ops);
274 ((struct seq_file *)(file->private_data))->private = inode->i_private;
279 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
280 "orangefs_debug_help_open: rc:%d:\n",
286 * I think start always gets called again after stop. Start
287 * needs to return NULL when it is done. The whole "payload"
288 * in this case is a single (long) string, so by the second
289 * time we get to start (pos = 1), we're done.
291 static void *help_start(struct seq_file *m, loff_t *pos)
293 void *payload = NULL;
295 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_start: start\n");
297 mutex_lock(&orangefs_help_file_lock);
300 payload = m->private;
305 static void *help_next(struct seq_file *m, void *v, loff_t *pos)
307 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_next: start\n");
312 static void help_stop(struct seq_file *m, void *p)
314 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_stop: start\n");
315 mutex_unlock(&orangefs_help_file_lock);
318 static int help_show(struct seq_file *m, void *v)
320 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "help_show: start\n");
328 * initialize the client-debug file.
330 int orangefs_client_debug_init(void)
334 char *c_buffer = NULL;
336 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: start\n", __func__);
338 c_buffer = kzalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL);
342 if (strlen(client_debug_string) + 1 < ORANGEFS_MAX_DEBUG_STRING_LEN) {
343 strcpy(c_buffer, client_debug_string);
344 strcat(c_buffer, "\n");
346 strcpy(c_buffer, "none\n");
347 pr_info("%s: overflow! 2\n", __func__);
350 client_debug_dentry = debugfs_create_file(ORANGEFS_CLIENT_DEBUG_FILE,
355 if (!client_debug_dentry) {
356 pr_info("%s: failed to create updated %s.\n",
358 ORANGEFS_CLIENT_DEBUG_FILE);
366 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "%s: rc:%d:\n", __func__, rc);
370 /* open ORANGEFS_KMOD_DEBUG_FILE or ORANGEFS_CLIENT_DEBUG_FILE.*/
371 static int orangefs_debug_open(struct inode *inode, struct file *file)
375 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
376 "%s: orangefs_debug_disabled: %d\n",
378 orangefs_debug_disabled);
380 if (orangefs_debug_disabled)
384 mutex_lock(&orangefs_debug_lock);
385 file->private_data = inode->i_private;
386 mutex_unlock(&orangefs_debug_lock);
389 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
390 "orangefs_debug_open: rc: %d\n",
395 static ssize_t orangefs_debug_read(struct file *file,
402 ssize_t read_ret = -ENOMEM;
404 gossip_debug(GOSSIP_DEBUGFS_DEBUG, "orangefs_debug_read: start\n");
406 buf = kmalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL);
410 mutex_lock(&orangefs_debug_lock);
411 sprintf_ret = sprintf(buf, "%s", (char *)file->private_data);
412 mutex_unlock(&orangefs_debug_lock);
414 read_ret = simple_read_from_buffer(ubuf, count, ppos, buf, sprintf_ret);
419 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
420 "orangefs_debug_read: ret: %zu\n",
426 static ssize_t orangefs_debug_write(struct file *file,
427 const char __user *ubuf,
435 struct orangefs_kernel_op_s *new_op = NULL;
436 struct client_debug_mask c_mask = { NULL, 0, 0 };
439 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
440 "orangefs_debug_write: %pD\n",
444 * Thwart users who try to jamb a ridiculous number
445 * of bytes into the debug file...
447 if (count > ORANGEFS_MAX_DEBUG_STRING_LEN + 1) {
449 count = ORANGEFS_MAX_DEBUG_STRING_LEN + 1;
452 buf = kzalloc(ORANGEFS_MAX_DEBUG_STRING_LEN, GFP_KERNEL);
456 if (copy_from_user(buf, ubuf, count - 1)) {
457 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
458 "%s: copy_from_user failed!\n",
464 * Map the keyword string from userspace into a valid debug mask.
465 * The mapping process involves mapping the human-inputted string
466 * into a valid mask, and then rebuilding the string from the
467 * verified valid mask.
469 * A service operation is required to set a new client-side
472 if (!strcmp(file->f_path.dentry->d_name.name,
473 ORANGEFS_KMOD_DEBUG_FILE)) {
474 debug_string_to_mask(buf, &orangefs_gossip_debug_mask, 0);
475 debug_mask_to_string(&orangefs_gossip_debug_mask, 0);
476 debug_string = kernel_debug_string;
477 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
478 "New kernel debug string is %s\n",
479 kernel_debug_string);
481 /* Can't reset client debug mask if client is not running. */
482 if (is_daemon_in_service()) {
483 pr_info("%s: Client not running :%d:\n",
485 is_daemon_in_service());
489 debug_string_to_mask(buf, &c_mask, 1);
490 debug_mask_to_string(&c_mask, 1);
491 debug_string = client_debug_string;
493 new_op = op_alloc(ORANGEFS_VFS_OP_PARAM);
495 pr_info("%s: op_alloc failed!\n", __func__);
499 new_op->upcall.req.param.op =
500 ORANGEFS_PARAM_REQUEST_OP_TWO_MASK_VALUES;
501 new_op->upcall.req.param.type = ORANGEFS_PARAM_REQUEST_SET;
502 memset(new_op->upcall.req.param.s_value,
504 ORANGEFS_MAX_DEBUG_STRING_LEN);
505 sprintf(new_op->upcall.req.param.s_value,
510 /* service_operation returns 0 on success... */
511 rc = service_operation(new_op,
513 ORANGEFS_OP_INTERRUPTIBLE);
516 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
517 "%s: service_operation failed! rc:%d:\n",
524 mutex_lock(&orangefs_debug_lock);
525 s = file_inode(file)->i_private;
526 memset(s, 0, ORANGEFS_MAX_DEBUG_STRING_LEN);
527 sprintf(s, "%s\n", debug_string);
528 mutex_unlock(&orangefs_debug_lock);
537 gossip_debug(GOSSIP_DEBUGFS_DEBUG,
538 "orangefs_debug_write: rc: %d\n",
545 * After obtaining a string representation of the client's debug
546 * keywords and their associated masks, this function is called to build an
547 * array of these values.
549 static int orangefs_prepare_cdm_array(char *debug_array_string)
553 char *cds_head = NULL;
554 char *cds_delimiter = NULL;
557 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__);
560 * figure out how many elements the cdm_array needs.
562 for (i = 0; i < strlen(debug_array_string); i++)
563 if (debug_array_string[i] == '\n')
566 if (!cdm_element_count) {
567 pr_info("No elements in client debug array string!\n");
572 kzalloc(cdm_element_count * sizeof(struct client_debug_mask),
575 pr_info("malloc failed for cdm_array!\n");
580 cds_head = debug_array_string;
582 for (i = 0; i < cdm_element_count; i++) {
583 cds_delimiter = strchr(cds_head, '\n');
584 *cds_delimiter = '\0';
586 keyword_len = strcspn(cds_head, " ");
588 cdm_array[i].keyword = kzalloc(keyword_len + 1, GFP_KERNEL);
589 if (!cdm_array[i].keyword) {
596 cdm_array[i].keyword,
597 (unsigned long long *)&(cdm_array[i].mask1),
598 (unsigned long long *)&(cdm_array[i].mask2));
600 if (!strcmp(cdm_array[i].keyword, ORANGEFS_VERBOSE))
601 client_verbose_index = i;
603 if (!strcmp(cdm_array[i].keyword, ORANGEFS_ALL))
604 client_all_index = i;
606 cds_head = cds_delimiter + 1;
609 rc = cdm_element_count;
611 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: rc:%d:\n", __func__, rc);
620 * /sys/kernel/debug/orangefs/debug-help can be catted to
621 * see all the available kernel and client debug keywords.
623 * When orangefs.ko initializes, we have no idea what keywords the
624 * client supports, nor their associated masks.
626 * We pass through this function once at module-load and stamp a
627 * boilerplate "we don't know" message for the client in the
628 * debug-help file. We pass through here again when the client
629 * starts and then we can fill out the debug-help file fully.
631 * The client might be restarted any number of times between
632 * module reloads, we only build the debug-help file the first time.
634 int orangefs_prepare_debugfs_help_string(int at_boot)
636 char *client_title = "Client Debug Keywords:\n";
637 char *kernel_title = "Kernel Debug Keywords:\n";
638 size_t string_size = DEBUG_HELP_STRING_SIZE;
644 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__);
647 client_title = HELP_STRING_UNINITIALIZED;
649 /* build a new debug_help_string. */
650 new = kzalloc(DEBUG_HELP_STRING_SIZE, GFP_KERNEL);
657 * strlcat(dst, src, size) will append at most
658 * "size - strlen(dst) - 1" bytes of src onto dst,
659 * null terminating the result, and return the total
660 * length of the string it tried to create.
662 * We'll just plow through here building our new debug
663 * help string and let strlcat take care of assuring that
664 * dst doesn't overflow.
666 strlcat(new, client_title, string_size);
671 * fill the client keyword/mask array and remember
672 * how many elements there were.
675 orangefs_prepare_cdm_array(client_debug_array_string);
676 if (cdm_element_count <= 0) {
681 for (i = 0; i < cdm_element_count; i++) {
682 strlcat(new, "\t", string_size);
683 strlcat(new, cdm_array[i].keyword, string_size);
684 strlcat(new, "\n", string_size);
688 strlcat(new, "\n", string_size);
689 strlcat(new, kernel_title, string_size);
691 for (i = 0; i < num_kmod_keyword_mask_map; i++) {
692 strlcat(new, "\t", string_size);
693 strlcat(new, s_kmod_keyword_mask_map[i].keyword, string_size);
694 result_size = strlcat(new, "\n", string_size);
697 /* See if we tried to put too many bytes into "new"... */
698 if (result_size >= string_size) {
704 debug_help_string = new;
706 mutex_lock(&orangefs_help_file_lock);
707 memset(debug_help_string, 0, DEBUG_HELP_STRING_SIZE);
708 strlcat(debug_help_string, new, string_size);
709 mutex_unlock(&orangefs_help_file_lock);
722 static void debug_mask_to_string(void *mask, int type)
727 int element_count = 0;
729 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__);
732 debug_string = client_debug_string;
733 element_count = cdm_element_count;
735 debug_string = kernel_debug_string;
736 element_count = num_kmod_keyword_mask_map;
739 memset(debug_string, 0, ORANGEFS_MAX_DEBUG_STRING_LEN);
742 * Some keywords, like "all" or "verbose", are amalgams of
743 * numerous other keywords. Make a special check for those
744 * before grinding through the whole mask only to find out
747 if (check_amalgam_keyword(mask, type))
750 /* Build the debug string. */
751 for (i = 0; i < element_count; i++)
753 do_c_string(mask, i);
755 do_k_string(mask, i);
757 len = strlen(debug_string);
760 client_debug_string[len - 1] = '\0';
762 kernel_debug_string[len - 1] = '\0';
764 strcpy(client_debug_string, "none");
766 strcpy(kernel_debug_string, "none");
769 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: string:%s:\n", __func__, debug_string);
775 static void do_k_string(void *k_mask, int index)
777 __u64 *mask = (__u64 *) k_mask;
779 if (keyword_is_amalgam((char *) s_kmod_keyword_mask_map[index].keyword))
782 if (*mask & s_kmod_keyword_mask_map[index].mask_val) {
783 if ((strlen(kernel_debug_string) +
784 strlen(s_kmod_keyword_mask_map[index].keyword))
785 < ORANGEFS_MAX_DEBUG_STRING_LEN - 1) {
786 strcat(kernel_debug_string,
787 s_kmod_keyword_mask_map[index].keyword);
788 strcat(kernel_debug_string, ",");
790 gossip_err("%s: overflow!\n", __func__);
791 strcpy(kernel_debug_string, ORANGEFS_ALL);
801 static void do_c_string(void *c_mask, int index)
803 struct client_debug_mask *mask = (struct client_debug_mask *) c_mask;
805 if (keyword_is_amalgam(cdm_array[index].keyword))
808 if ((mask->mask1 & cdm_array[index].mask1) ||
809 (mask->mask2 & cdm_array[index].mask2)) {
810 if ((strlen(client_debug_string) +
811 strlen(cdm_array[index].keyword) + 1)
812 < ORANGEFS_MAX_DEBUG_STRING_LEN - 2) {
813 strcat(client_debug_string,
814 cdm_array[index].keyword);
815 strcat(client_debug_string, ",");
817 gossip_err("%s: overflow!\n", __func__);
818 strcpy(client_debug_string, ORANGEFS_ALL);
826 static int keyword_is_amalgam(char *keyword)
830 if ((!strcmp(keyword, ORANGEFS_ALL)) || (!strcmp(keyword, ORANGEFS_VERBOSE)))
840 * return 1 if we found an amalgam.
842 static int check_amalgam_keyword(void *mask, int type)
845 struct client_debug_mask *c_mask;
846 int k_all_index = num_kmod_keyword_mask_map - 1;
850 c_mask = (struct client_debug_mask *) mask;
852 if ((c_mask->mask1 == cdm_array[client_all_index].mask1) &&
853 (c_mask->mask2 == cdm_array[client_all_index].mask2)) {
854 strcpy(client_debug_string, ORANGEFS_ALL);
859 if ((c_mask->mask1 == cdm_array[client_verbose_index].mask1) &&
860 (c_mask->mask2 == cdm_array[client_verbose_index].mask2)) {
861 strcpy(client_debug_string, ORANGEFS_VERBOSE);
867 k_mask = (__u64 *) mask;
869 if (*k_mask >= s_kmod_keyword_mask_map[k_all_index].mask_val) {
870 strcpy(kernel_debug_string, ORANGEFS_ALL);
885 static void debug_string_to_mask(char *debug_string, void *mask, int type)
887 char *unchecked_keyword;
889 char *strsep_fodder = kstrdup(debug_string, GFP_KERNEL);
890 char *original_pointer;
891 int element_count = 0;
892 struct client_debug_mask *c_mask = NULL;
893 __u64 *k_mask = NULL;
895 gossip_debug(GOSSIP_UTILS_DEBUG, "%s: start\n", __func__);
898 c_mask = (struct client_debug_mask *)mask;
899 element_count = cdm_element_count;
901 k_mask = (__u64 *)mask;
903 element_count = num_kmod_keyword_mask_map;
906 original_pointer = strsep_fodder;
907 while ((unchecked_keyword = strsep(&strsep_fodder, ",")))
908 if (strlen(unchecked_keyword)) {
909 for (i = 0; i < element_count; i++)
920 kfree(original_pointer);
923 static void do_c_mask(int i, char *unchecked_keyword,
924 struct client_debug_mask **sane_mask)
927 if (!strcmp(cdm_array[i].keyword, unchecked_keyword)) {
928 (**sane_mask).mask1 = (**sane_mask).mask1 | cdm_array[i].mask1;
929 (**sane_mask).mask2 = (**sane_mask).mask2 | cdm_array[i].mask2;
933 static void do_k_mask(int i, char *unchecked_keyword, __u64 **sane_mask)
936 if (!strcmp(s_kmod_keyword_mask_map[i].keyword, unchecked_keyword))
937 **sane_mask = (**sane_mask) |
938 s_kmod_keyword_mask_map[i].mask_val;
941 int orangefs_debugfs_new_client_mask(void __user *arg)
943 struct dev_mask2_info_s mask2_info = {0};
946 ret = copy_from_user(&mask2_info,
948 sizeof(struct dev_mask2_info_s));
953 client_debug_mask.mask1 = mask2_info.mask1_value;
954 client_debug_mask.mask2 = mask2_info.mask2_value;
956 pr_info("%s: client debug mask has been been received "
959 (unsigned long long)client_debug_mask.mask1,
960 (unsigned long long)client_debug_mask.mask2);
965 int orangefs_debugfs_new_client_string(void __user *arg)
969 ret = copy_from_user(&client_debug_array_string,
971 ORANGEFS_MAX_DEBUG_STRING_LEN);
974 pr_info("%s: CLIENT_STRING: copy_from_user failed\n",
980 * The real client-core makes an effort to ensure
981 * that actual strings that aren't too long to fit in
982 * this buffer is what we get here. We're going to use
983 * string functions on the stuff we got, so we'll make
984 * this extra effort to try and keep from
985 * flowing out of this buffer when we use the string
986 * functions, even if somehow the stuff we end up
987 * with here is garbage.
989 client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN - 1] =
992 pr_info("%s: client debug array string has been received.\n",
995 if (!help_string_initialized) {
997 /* Build a proper debug help string. */
998 ret = orangefs_prepare_debugfs_help_string(0);
1000 gossip_err("%s: no debug help string \n",
1007 debug_mask_to_string(&client_debug_mask, 1);
1009 debugfs_remove(client_debug_dentry);
1011 orangefs_client_debug_init();
1013 help_string_initialized++;
1018 int orangefs_debugfs_new_debug(void __user *arg)
1020 struct dev_mask_info_s mask_info = {0};
1023 ret = copy_from_user(&mask_info,
1030 if (mask_info.mask_type == KERNEL_MASK) {
1031 if ((mask_info.mask_value == 0)
1032 && (kernel_mask_set_mod_init)) {
1034 * the kernel debug mask was set when the
1035 * kernel module was loaded; don't override
1036 * it if the client-core was started without
1037 * a value for ORANGEFS_KMODMASK.
1041 debug_mask_to_string(&mask_info.mask_value,
1042 mask_info.mask_type);
1043 orangefs_gossip_debug_mask = mask_info.mask_value;
1044 pr_info("%s: kernel debug mask has been modified to "
1047 kernel_debug_string,
1048 (unsigned long long)orangefs_gossip_debug_mask);
1049 } else if (mask_info.mask_type == CLIENT_MASK) {
1050 debug_mask_to_string(&mask_info.mask_value,
1051 mask_info.mask_type);
1052 pr_info("%s: client debug mask has been modified to"
1055 client_debug_string,
1056 llu(mask_info.mask_value));
1058 gossip_lerr("Invalid mask type....\n");