at master 67 lines 2.1 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-or-later */ 2/* 3 * Copyright (C) 2018 Samsung Electronics Co., Ltd. 4 */ 5 6#ifndef __KSMBD_MISC_H__ 7#define __KSMBD_MISC_H__ 8 9#ifdef CONFIG_PROC_FS 10#include <linux/proc_fs.h> 11#endif 12struct ksmbd_share_config; 13struct nls_table; 14struct kstat; 15struct ksmbd_file; 16 17int match_pattern(const char *str, size_t len, const char *pattern); 18int ksmbd_validate_filename(char *filename); 19int parse_stream_name(char *filename, char **stream_name, int *s_type); 20char *convert_to_nt_pathname(struct ksmbd_share_config *share, 21 const struct path *path); 22int get_nlink(struct kstat *st); 23void ksmbd_conv_path_to_unix(char *path); 24void ksmbd_strip_last_slash(char *path); 25void ksmbd_conv_path_to_windows(char *path); 26char *ksmbd_casefold_sharename(struct unicode_map *um, const char *name); 27char *ksmbd_extract_sharename(struct unicode_map *um, const char *treename); 28char *convert_to_unix_name(struct ksmbd_share_config *share, const char *name); 29 30#define KSMBD_DIR_INFO_ALIGNMENT 8 31struct ksmbd_dir_info; 32char *ksmbd_convert_dir_info_name(struct ksmbd_dir_info *d_info, 33 const struct nls_table *local_nls, 34 int *conv_len); 35 36#define NTFS_TIME_OFFSET ((u64)(369 * 365 + 89) * 24 * 3600 * 10000000) 37struct timespec64 ksmbd_NTtimeToUnix(__le64 ntutc); 38u64 ksmbd_UnixTimeToNT(struct timespec64 t); 39long long ksmbd_systime(void); 40 41#ifdef CONFIG_PROC_FS 42struct ksmbd_const_name { 43 unsigned int const_value; 44 const char *name; 45}; 46 47void ksmbd_proc_init(void); 48void ksmbd_proc_cleanup(void); 49void ksmbd_proc_reset(void); 50struct proc_dir_entry *ksmbd_proc_create(const char *name, 51 int (*show)(struct seq_file *m, void *v), 52 void *v); 53void ksmbd_proc_show_flag_names(struct seq_file *m, 54 const struct ksmbd_const_name *table, 55 int count, 56 unsigned int flags); 57void ksmbd_proc_show_const_name(struct seq_file *m, 58 const char *format, 59 const struct ksmbd_const_name *table, 60 int count, 61 unsigned int const_value); 62#else 63static inline void ksmbd_proc_init(void) {} 64static inline void ksmbd_proc_cleanup(void) {} 65static inline void ksmbd_proc_reset(void) {} 66#endif 67#endif /* __KSMBD_MISC_H__ */