projects/linux·blob master · refs

63 lines · 2.0 KiB

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);
28
29#define KSMBD_DIR_INFO_ALIGNMENT 8
30struct ksmbd_dir_info;
31char *ksmbd_convert_dir_info_name(struct ksmbd_dir_info *d_info,
32 const struct nls_table *local_nls,
33 int *conv_len);
34
35#define NTFS_TIME_OFFSET ((u64)(369 * 365 + 89) * 24 * 3600 * 10000000)
36struct timespec64 ksmbd_NTtimeToUnix(__le64 ntutc);
37u64 ksmbd_UnixTimeToNT(struct timespec64 t);
38long long ksmbd_systime(void);
39
40#ifdef CONFIG_PROC_FS
41struct ksmbd_const_name {
42 unsigned int const_value;
43 const char *name;
44};
45
46int ksmbd_proc_init(void);
47void ksmbd_proc_cleanup(void);
48void ksmbd_proc_reset(void);
49struct proc_dir_entry *ksmbd_proc_create(const char *name,
50 int (*show)(struct seq_file *m, void *v),
51 void *v);
52void ksmbd_proc_show_flag_names(struct seq_file *m,
53 const struct ksmbd_const_name *table,
54 int count,
55 unsigned int flags);
56const char *ksmbd_proc_const_name(const struct ksmbd_const_name *table,
57 int count, unsigned int const_value);
58#else
59static inline int ksmbd_proc_init(void) { return 0; }
60static inline void ksmbd_proc_cleanup(void) {}
61static inline void ksmbd_proc_reset(void) {}
62#endif
63#endif /* __KSMBD_MISC_H__ */