📄 cifs_debug.c
字号:
static read_proc_t packet_signing_enabled_read;static write_proc_t packet_signing_enabled_write;*/static read_proc_t experimEnabled_read;static write_proc_t experimEnabled_write;static read_proc_t linuxExtensionsEnabled_read;static write_proc_t linuxExtensionsEnabled_write;voidcifs_proc_init(void){ struct proc_dir_entry *pde; proc_fs_cifs = proc_mkdir("cifs", proc_root_fs); if (proc_fs_cifs == NULL) return; proc_fs_cifs->owner = THIS_MODULE; create_proc_read_entry("DebugData", 0, proc_fs_cifs, cifs_debug_data_read, NULL);#ifdef CONFIG_CIFS_STATS pde = create_proc_read_entry("Stats", 0, proc_fs_cifs, cifs_stats_read, NULL); if (pde) pde->write_proc = cifs_stats_write;#endif pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs, cifsFYI_read, NULL); if (pde) pde->write_proc = cifsFYI_write; pde = create_proc_read_entry("traceSMB", 0, proc_fs_cifs, traceSMB_read, NULL); if (pde) pde->write_proc = traceSMB_write; pde = create_proc_read_entry("OplockEnabled", 0, proc_fs_cifs, oplockEnabled_read, NULL); if (pde) pde->write_proc = oplockEnabled_write; pde = create_proc_read_entry("Experimental", 0, proc_fs_cifs, experimEnabled_read, NULL); if (pde) pde->write_proc = experimEnabled_write; pde = create_proc_read_entry("LinuxExtensionsEnabled", 0, proc_fs_cifs, linuxExtensionsEnabled_read, NULL); if (pde) pde->write_proc = linuxExtensionsEnabled_write; pde = create_proc_read_entry("MultiuserMount", 0, proc_fs_cifs, multiuser_mount_read, NULL); if (pde) pde->write_proc = multiuser_mount_write; pde = create_proc_read_entry("SecurityFlags", 0, proc_fs_cifs, security_flags_read, NULL); if (pde) pde->write_proc = security_flags_write; pde = create_proc_read_entry("LookupCacheEnabled", 0, proc_fs_cifs, lookupFlag_read, NULL); if (pde) pde->write_proc = lookupFlag_write;/* pde = create_proc_read_entry("NTLMV2Enabled", 0, proc_fs_cifs, ntlmv2_enabled_read, NULL); if (pde) pde->write_proc = ntlmv2_enabled_write; pde = create_proc_read_entry("PacketSigningEnabled", 0, proc_fs_cifs, packet_signing_enabled_read, NULL); if (pde) pde->write_proc = packet_signing_enabled_write;*/}voidcifs_proc_clean(void){ if (proc_fs_cifs == NULL) return; remove_proc_entry("DebugData", proc_fs_cifs); remove_proc_entry("cifsFYI", proc_fs_cifs); remove_proc_entry("traceSMB", proc_fs_cifs);#ifdef CONFIG_CIFS_STATS remove_proc_entry("Stats", proc_fs_cifs);#endif remove_proc_entry("MultiuserMount", proc_fs_cifs); remove_proc_entry("OplockEnabled", proc_fs_cifs);/* remove_proc_entry("NTLMV2Enabled",proc_fs_cifs); */ remove_proc_entry("SecurityFlags", proc_fs_cifs);/* remove_proc_entry("PacketSigningEnabled", proc_fs_cifs); */ remove_proc_entry("LinuxExtensionsEnabled", proc_fs_cifs); remove_proc_entry("Experimental", proc_fs_cifs); remove_proc_entry("LookupCacheEnabled", proc_fs_cifs); remove_proc_entry("cifs", proc_root_fs);}static intcifsFYI_read(char *page, char **start, off_t off, int count, int *eof, void *data){ int len; len = sprintf(page, "%d\n", cifsFYI); len -= off; *start = page + off; if (len > count) len = count; else *eof = 1; if (len < 0) len = 0; return len;}static intcifsFYI_write(struct file *file, const char __user *buffer, unsigned long count, void *data){ char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') cifsFYI = 0; else if (c == '1' || c == 'y' || c == 'Y') cifsFYI = 1; else if ((c > '1') && (c <= '9')) cifsFYI = (int) (c - '0'); /* see cifs_debug.h for meanings */ return count;}static intoplockEnabled_read(char *page, char **start, off_t off, int count, int *eof, void *data){ int len; len = sprintf(page, "%d\n", oplockEnabled); len -= off; *start = page + off; if (len > count) len = count; else *eof = 1; if (len < 0) len = 0; return len;}static intoplockEnabled_write(struct file *file, const char __user *buffer, unsigned long count, void *data){ char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') oplockEnabled = 0; else if (c == '1' || c == 'y' || c == 'Y') oplockEnabled = 1; return count;}static intexperimEnabled_read(char *page, char **start, off_t off, int count, int *eof, void *data){ int len; len = sprintf(page, "%d\n", experimEnabled); len -= off; *start = page + off; if (len > count) len = count; else *eof = 1; if (len < 0) len = 0; return len;}static intexperimEnabled_write(struct file *file, const char __user *buffer, unsigned long count, void *data){ char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') experimEnabled = 0; else if (c == '1' || c == 'y' || c == 'Y') experimEnabled = 1; else if (c == '2') experimEnabled = 2; return count;}static intlinuxExtensionsEnabled_read(char *page, char **start, off_t off, int count, int *eof, void *data){ int len; len = sprintf(page, "%d\n", linuxExtEnabled); len -= off; *start = page + off; if (len > count) len = count; else *eof = 1; if (len < 0) len = 0; return len;}static intlinuxExtensionsEnabled_write(struct file *file, const char __user *buffer, unsigned long count, void *data){ char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') linuxExtEnabled = 0; else if (c == '1' || c == 'y' || c == 'Y') linuxExtEnabled = 1; return count;}static intlookupFlag_read(char *page, char **start, off_t off, int count, int *eof, void *data){ int len; len = sprintf(page, "%d\n", lookupCacheEnabled); len -= off; *start = page + off; if (len > count) len = count; else *eof = 1; if (len < 0) len = 0; return len;}static intlookupFlag_write(struct file *file, const char __user *buffer, unsigned long count, void *data){ char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') lookupCacheEnabled = 0; else if (c == '1' || c == 'y' || c == 'Y') lookupCacheEnabled = 1; return count;}static inttraceSMB_read(char *page, char **start, off_t off, int count, int *eof, void *data){ int len; len = sprintf(page, "%d\n", traceSMB); len -= off; *start = page + off; if (len > count) len = count; else *eof = 1; if (len < 0) len = 0; return len;}static inttraceSMB_write(struct file *file, const char __user *buffer, unsigned long count, void *data){ char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') traceSMB = 0; else if (c == '1' || c == 'y' || c == 'Y') traceSMB = 1; return count;}static intmultiuser_mount_read(char *page, char **start, off_t off, int count, int *eof, void *data){ int len; len = sprintf(page, "%d\n", multiuser_mount); len -= off; *start = page + off; if (len > count) len = count; else *eof = 1; if (len < 0) len = 0; return len;}static intmultiuser_mount_write(struct file *file, const char __user *buffer, unsigned long count, void *data){ char c; int rc; rc = get_user(c, buffer); if (rc) return rc; if (c == '0' || c == 'n' || c == 'N') multiuser_mount = 0; else if (c == '1' || c == 'y' || c == 'Y') multiuser_mount = 1; return count;}static intsecurity_flags_read(char *page, char **start, off_t off, int count, int *eof, void *data){ int len; len = sprintf(page, "0x%x\n", extended_security); len -= off; *start = page + off; if (len > count) len = count; else *eof = 1; if (len < 0) len = 0; return len;}static intsecurity_flags_write(struct file *file, const char __user *buffer, unsigned long count, void *data){ unsigned int flags; char flags_string[12]; char c; if ((count < 1) || (count > 11)) return -EINVAL; memset(flags_string, 0, 12); if (copy_from_user(flags_string, buffer, count)) return -EFAULT; if (count < 3) { /* single char or single char followed by null */ c = flags_string[0]; if (c == '0' || c == 'n' || c == 'N') extended_security = CIFSSEC_DEF; /* default */ else if (c == '1' || c == 'y' || c == 'Y') extended_security = CIFSSEC_MAX; return count; } /* else we have a number */ flags = simple_strtoul(flags_string, NULL, 0); cFYI(1, ("sec flags 0x%x", flags)); if (flags <= 0) { cERROR(1, ("invalid security flags %s", flags_string)); return -EINVAL; } if (flags & ~CIFSSEC_MASK) { cERROR(1, ("attempt to set unsupported security flags 0x%x", flags & ~CIFSSEC_MASK)); return -EINVAL; } /* flags look ok - update the global security flags for cifs module */ extended_security = flags; if (extended_security & CIFSSEC_MUST_SIGN) { /* requiring signing implies signing is allowed */ extended_security |= CIFSSEC_MAY_SIGN; cFYI(1, ("packet signing now required")); } else if ((extended_security & CIFSSEC_MAY_SIGN) == 0) { cFYI(1, ("packet signing disabled")); } /* BB should we turn on MAY flags for other MUST options? */ return count;}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -