linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Christoph Hellwig <hch@lst.de>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	Namjae Jeon <linkinjeon@kernel.org>,
	linux-kernel@vger.kernel.org,
	Andreas Gruenbacher <agruenba@redhat.com>,
	Al Viro <viro@ZenIV.linux.org.uk>
Subject: Re: [PATCH] posix_acl.h: define missing ACL functions on non-posix-acl build
Date: Sun, 29 Nov 2020 20:00:44 -0800	[thread overview]
Message-ID: <c96f60f4-f525-2957-6a8a-ae9e3288b04a@infradead.org> (raw)
In-Reply-To: <X8RpFo+5m1i4L5Gn@jagdpanzerIV.localdomain>

On 11/29/20 7:37 PM, Sergey Senozhatsky wrote:
> A quick question, shouldn't there be dummy definitions for
> the EXPORT_SYMBOL-s? So that external modules can be modprobed
> and used.
> 
> Some of posix_acl exported symbols have dummy definitions,
> others don't.
> 
> E.g. posix_acl_create() is exported symbol and it's defined for
> both FS_POSIX_ACL and !FS_POSIX_ACL. While exported set_posix_acl()
> is defined only for FS_POSIX_ACL config.

Hi,

Currently CONFIG_FS_POSIX_ACL differences seem to be handled in
each source file as needed:

fs/inode.c:#ifdef CONFIG_FS_POSIX_ACL
fs/inode.c:#ifdef CONFIG_FS_POSIX_ACL
fs/namei.c:#ifdef CONFIG_FS_POSIX_ACL
fs/overlayfs/dir.c:     if (!IS_ENABLED(CONFIG_FS_POSIX_ACL) || !acl)
fs/overlayfs/inode.c:   if (!IS_ENABLED(CONFIG_FS_POSIX_ACL) || !IS_POSIXACL(realinode))
fs/overlayfs/inode.c:#ifdef CONFIG_FS_POSIX_ACL
fs/overlayfs/super.c:#ifdef CONFIG_FS_POSIX_ACL
fs/xattr.c:#ifdef CONFIG_FS_POSIX_ACL
include/linux/evm.h:#ifdef CONFIG_FS_POSIX_ACL
include/linux/fs.h:#ifdef CONFIG_FS_POSIX_ACL
include/linux/posix_acl.h:#ifdef CONFIG_FS_POSIX_ACL
include/linux/posix_acl.h:#endif /* CONFIG_FS_POSIX_ACL */
include/linux/posix_acl_xattr.h:#ifdef CONFIG_FS_POSIX_ACL

However, I have no objection to your patch.

I am adding Andreas & Al for their viewpoints.


> ---
> 
> diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h
> index 90797f1b421d..8a6c77a69761 100644
> --- a/include/linux/posix_acl.h
> +++ b/include/linux/posix_acl.h
> @@ -59,19 +59,19 @@ posix_acl_release(struct posix_acl *acl)
>  
>  /* posix_acl.c */
>  
> +extern int posix_acl_permission(struct inode *, const struct posix_acl *, int);
> +
> +extern struct posix_acl *get_posix_acl(struct inode *, int);
> +
> +#ifdef CONFIG_FS_POSIX_ACL
>  extern void posix_acl_init(struct posix_acl *, int);
>  extern struct posix_acl *posix_acl_alloc(int, gfp_t);
> -extern int posix_acl_valid(struct user_namespace *, const struct posix_acl *);
> -extern int posix_acl_permission(struct inode *, const struct posix_acl *, int);
> -extern struct posix_acl *posix_acl_from_mode(umode_t, gfp_t);
>  extern int posix_acl_equiv_mode(const struct posix_acl *, umode_t *);
> +extern struct posix_acl *posix_acl_from_mode(umode_t, gfp_t);
>  extern int __posix_acl_create(struct posix_acl **, gfp_t, umode_t *);
>  extern int __posix_acl_chmod(struct posix_acl **, gfp_t, umode_t);
> -
> -extern struct posix_acl *get_posix_acl(struct inode *, int);
>  extern int set_posix_acl(struct inode *, int, struct posix_acl *);
> -
> -#ifdef CONFIG_FS_POSIX_ACL
> +extern int posix_acl_valid(struct user_namespace *, const struct posix_acl *);
>  extern int posix_acl_chmod(struct inode *, umode_t);
>  extern int posix_acl_create(struct inode *, umode_t *, struct posix_acl **,
>  		struct posix_acl **);
> @@ -91,18 +91,61 @@ static inline void cache_no_acl(struct inode *inode)
>  	inode->i_acl = NULL;
>  	inode->i_default_acl = NULL;
>  }
> +
> +struct posix_acl *get_acl(struct inode *inode, int type);
>  #else
> +static inline void posix_acl_init(struct posix_acl *, int)
> +{
> +}
> +
> +static inline struct posix_acl *posix_acl_alloc(int, gfp_t)
> +{
> +	return NULL;
> +}
> +
> +static inline int posix_acl_valid(struct user_namespace *,
> +				  const struct posix_acl *)
> +{
> +	return 0;
> +}
> +
> +static inline int posix_acl_equiv_mode(const struct posix_acl *, umode_t *)
> +{
> +	return 0;
> +}
> +
> +static inline struct posix_acl *posix_acl_from_mode(umode_t, gfp_t)
> +{
> +	return NULL;
> +}
> +
>  static inline int posix_acl_chmod(struct inode *inode, umode_t mode)
>  {
>  	return 0;
>  }
>  
> +static inline int set_posix_acl(struct inode *, int, struct posix_acl *)
> +{
> +	return 0;
> +}
> +
>  #define simple_set_acl		NULL
>  
>  static inline int simple_acl_create(struct inode *dir, struct inode *inode)
>  {
>  	return 0;
>  }
> +
> +static inline int __posix_acl_create(struct posix_acl **, gfp_t, umode_t *)
> +{
> +	return 0;
> +}
> +
> +static inline int __posix_acl_chmod(struct posix_acl **, gfp_t, umode_t)
> +{
> +	return 0;
> +}
> +
>  static inline void cache_no_acl(struct inode *inode)
>  {
>  }
> @@ -117,8 +160,38 @@ static inline int posix_acl_create(struct inode *inode, umode_t *mode,
>  static inline void forget_all_cached_acls(struct inode *inode)
>  {
>  }
> +
> +static inline struct posix_acl *get_cached_acl(struct inode *inode, int type)
> +{
> +	return NULL;
> +}
> +
> +static inline struct posix_acl *get_cached_acl_rcu(struct inode *inode,
> +						   int type)
> +{
> +	return NULL;
> +}
> +
> +static inline void set_cached_acl(struct inode *inode, int type,
> +				  struct posix_acl *acl)
> +{
> +}
> +
> +static inline void forget_cached_acl(struct inode *inode, int type)
> +{
> +}
> +
> +static inline struct posix_acl *get_acl(struct inode *inode, int type)
> +{
> +	return NULL;
> +}
> +
> +static inline int posix_acl_update_mode(struct inode *, umode_t *,
> +					struct posix_acl **)
> +{
> +	return 0;
> +}
>  #endif /* CONFIG_FS_POSIX_ACL */
>  
> -struct posix_acl *get_acl(struct inode *inode, int type);
>  
>  #endif  /* __LINUX_POSIX_ACL_H */
> 


-- 
~Randy


  reply	other threads:[~2020-11-30  4:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30  1:44 [PATCH] posix_acl.h: define missing ACL functions on non-posix-acl build Sergey Senozhatsky
2020-11-30  2:00 ` Randy Dunlap
2020-11-30  3:15   ` Sergey Senozhatsky
2020-11-30  3:17     ` Sergey Senozhatsky
2020-11-30  3:37       ` Sergey Senozhatsky
2020-11-30  4:00         ` Randy Dunlap [this message]
2020-11-30 13:09           ` Andreas Gruenbacher
2020-11-30 13:13             ` Andreas Gruenbacher
2020-11-30 13:28             ` Sergey Senozhatsky
2020-11-30  6:05 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c96f60f4-f525-2957-6a8a-ae9e3288b04a@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=agruenba@redhat.com \
    --cc=gustavo@embeddedor.com \
    --cc=hch@lst.de \
    --cc=linkinjeon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).