blob: 253366bd0951aa987d91c69143acc9a5d34efaa3 [file] [log] [blame]
Namjae Jeone2f34482021-03-16 10:49:09 +09001/* 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
9struct ksmbd_share_config;
10struct nls_table;
11struct kstat;
12struct ksmbd_file;
13
Namjae Jeonb24c9332021-03-21 17:32:19 +090014int match_pattern(const char *str, size_t len, const char *pattern);
Namjae Jeone2f34482021-03-16 10:49:09 +090015int ksmbd_validate_filename(char *filename);
Namjae Jeone2f34482021-03-16 10:49:09 +090016int parse_stream_name(char *filename, char **stream_name, int *s_type);
Hyunchul Lee265fd192021-09-25 00:06:16 +090017char *convert_to_nt_pathname(char *filename);
Namjae Jeone2f34482021-03-16 10:49:09 +090018int get_nlink(struct kstat *st);
Hyunchul Lee265fd192021-09-25 00:06:16 +090019void ksmbd_conv_path_to_unix(char *path);
20void ksmbd_strip_last_slash(char *path);
Namjae Jeone2f34482021-03-16 10:49:09 +090021void ksmbd_conv_path_to_windows(char *path);
Stephen Rothwell36ba3862021-03-17 17:01:15 +090022char *ksmbd_extract_sharename(char *treename);
Hyunchul Lee265fd192021-09-25 00:06:16 +090023char *convert_to_unix_name(struct ksmbd_share_config *share, const char *name);
Namjae Jeone2f34482021-03-16 10:49:09 +090024
25#define KSMBD_DIR_INFO_ALIGNMENT 8
Namjae Jeone2f34482021-03-16 10:49:09 +090026struct ksmbd_dir_info;
27char *ksmbd_convert_dir_info_name(struct ksmbd_dir_info *d_info,
28 const struct nls_table *local_nls,
29 int *conv_len);
Namjae Jeon56265182021-04-14 09:24:11 +090030
31#define NTFS_TIME_OFFSET ((u64)(369 * 365 + 89) * 24 * 3600 * 10000000)
Namjae Jeon56265182021-04-14 09:24:11 +090032struct timespec64 ksmbd_NTtimeToUnix(__le64 ntutc);
33u64 ksmbd_UnixTimeToNT(struct timespec64 t);
34long long ksmbd_systime(void);
Namjae Jeone2f34482021-03-16 10:49:09 +090035#endif /* __KSMBD_MISC_H__ */