| 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 |
| 12 |
struct ksmbd_share_config; |
| 13 |
struct nls_table; |
| 14 |
struct kstat; |
| 15 |
struct ksmbd_file; |
| 16 |
|
| 17 |
int match_pattern(const char *str, size_t len, const char *pattern); |
| 18 |
int ksmbd_validate_filename(char *filename); |
| 19 |
int parse_stream_name(char *filename, char **stream_name, int *s_type); |
| 20 |
char *convert_to_nt_pathname(struct ksmbd_share_config *share, |
| 21 |
const struct path *path); |
| 22 |
int get_nlink(struct kstat *st); |
| 23 |
void ksmbd_conv_path_to_unix(char *path); |
| 24 |
void ksmbd_strip_last_slash(char *path); |
| 25 |
void ksmbd_conv_path_to_windows(char *path); |
| 26 |
char *ksmbd_casefold_sharename(struct unicode_map *um, const char *name); |
| 27 |
char *ksmbd_extract_sharename(struct unicode_map *um, const char *treename); |
| 28 |
char *convert_to_unix_name(struct ksmbd_share_config *share, const char *name); |
| 29 |
|
| 30 |
#define KSMBD_DIR_INFO_ALIGNMENT 8 |
| 31 |
struct ksmbd_dir_info; |
| 32 |
char *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) |
| 37 |
struct timespec64 ksmbd_NTtimeToUnix(__le64 ntutc); |
| 38 |
u64 ksmbd_UnixTimeToNT(struct timespec64 t); |
| 39 |
long long ksmbd_systime(void); |
| 40 |
|
| 41 |
#ifdef CONFIG_PROC_FS |
| 42 |
struct ksmbd_const_name { |
| 43 |
unsigned int const_value; |
| 44 |
const char *name; |
| 45 |
}; |
| 46 |
|
| 47 |
void ksmbd_proc_init(void); |
| 48 |
void ksmbd_proc_cleanup(void); |
| 49 |
void ksmbd_proc_reset(void); |
| 50 |
struct proc_dir_entry *ksmbd_proc_create(const char *name, |
| 51 |
int (*show)(struct seq_file *m, void *v), |
| 52 |
void *v); |
| 53 |
void ksmbd_proc_show_flag_names(struct seq_file *m, |
| 54 |
const struct ksmbd_const_name *table, |
| 55 |
int count, |
| 56 |
unsigned int flags); |
| 57 |
void 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 |
| 63 |
static inline void ksmbd_proc_init(void) {} |
| 64 |
static inline void ksmbd_proc_cleanup(void) {} |
| 65 |
static inline void ksmbd_proc_reset(void) {} |
| 66 |
#endif |
| 67 |
#endif /* __KSMBD_MISC_H__ */ |