~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/smb/server/mgmt/share_config.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  *   Copyright (C) 2018 Samsung Electronics Co., Ltd.
  4  */
  5 
  6 #ifndef __SHARE_CONFIG_MANAGEMENT_H__
  7 #define __SHARE_CONFIG_MANAGEMENT_H__
  8 
  9 #include <linux/workqueue.h>
 10 #include <linux/hashtable.h>
 11 #include <linux/path.h>
 12 #include <linux/unicode.h>
 13 
 14 struct ksmbd_work;
 15 
 16 struct ksmbd_share_config {
 17         char                    *name;
 18         char                    *path;
 19 
 20         unsigned int            path_sz;
 21         unsigned int            flags;
 22         struct list_head        veto_list;
 23 
 24         struct path             vfs_path;
 25 
 26         atomic_t                refcount;
 27         struct hlist_node       hlist;
 28         unsigned short          create_mask;
 29         unsigned short          directory_mask;
 30         unsigned short          force_create_mode;
 31         unsigned short          force_directory_mode;
 32         unsigned short          force_uid;
 33         unsigned short          force_gid;
 34 };
 35 
 36 #define KSMBD_SHARE_INVALID_UID ((__u16)-1)
 37 #define KSMBD_SHARE_INVALID_GID ((__u16)-1)
 38 
 39 static inline umode_t
 40 share_config_create_mode(struct ksmbd_share_config *share,
 41                          umode_t posix_mode)
 42 {
 43         umode_t mode = (posix_mode ?: (umode_t)-1) & share->create_mask;
 44 
 45         return mode | share->force_create_mode;
 46 }
 47 
 48 static inline umode_t
 49 share_config_directory_mode(struct ksmbd_share_config *share,
 50                             umode_t posix_mode)
 51 {
 52         umode_t mode = (posix_mode ?: (umode_t)-1) & share->directory_mask;
 53 
 54         return mode | share->force_directory_mode;
 55 }
 56 
 57 static inline int test_share_config_flag(struct ksmbd_share_config *share,
 58                                          int flag)
 59 {
 60         return share->flags & flag;
 61 }
 62 
 63 void ksmbd_share_config_del(struct ksmbd_share_config *share);
 64 void __ksmbd_share_config_put(struct ksmbd_share_config *share);
 65 
 66 static inline void ksmbd_share_config_put(struct ksmbd_share_config *share)
 67 {
 68         if (!atomic_dec_and_test(&share->refcount))
 69                 return;
 70         __ksmbd_share_config_put(share);
 71 }
 72 
 73 struct ksmbd_share_config *ksmbd_share_config_get(struct ksmbd_work *work,
 74                                                   const char *name);
 75 bool ksmbd_share_veto_filename(struct ksmbd_share_config *share,
 76                                const char *filename);
 77 #endif /* __SHARE_CONFIG_MANAGEMENT_H__ */
 78 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php