From 8cdb99aa0a6462a35ac584226ae66841c3b7bc2f Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Mon, 15 Mar 2021 09:34:55 +1100 Subject: [PATCH] LU-14291 lustre: further cleanup of acl code. Code in lustre/obdclass/acl.c is only used in lustre/mdd/, so move the file there, renaming to mdd_acl.c and removing EXPORT_SYMBOL() declarations. The function prototypes in lustre_eacl.h are moved to mdd_internal.h, and the remainder of that file is discarded. THe HAVE_STRUCT_ACL_XATTR stanza, in particular, is unnecessary is it exists in lustre_compat.h. Test-Parameters: trivial Signed-off-by: Mr NeilBrown Change-Id: Idb0978758640c5ad527d2c68c4fdf6dee32a731c Reviewed-on: https://review.whamcloud.com/42032 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Simmons --- lustre/include/Makefile.am | 1 - lustre/include/lustre_eacl.h | 77 -------------------------------- lustre/mdd/Makefile.in | 4 +- lustre/{obdclass/acl.c => mdd/mdd_acl.c} | 6 +-- lustre/mdd/mdd_internal.h | 14 +++++- lustre/mdt/mdt_internal.h | 1 - lustre/obdclass/Makefile.in | 2 - 7 files changed, 17 insertions(+), 88 deletions(-) rename lustre/{obdclass/acl.c => mdd/mdd_acl.c} (97%) diff --git a/lustre/include/Makefile.am b/lustre/include/Makefile.am index 3d17079..a0da174 100644 --- a/lustre/include/Makefile.am +++ b/lustre/include/Makefile.am @@ -51,7 +51,6 @@ EXTRA_DIST = \ lustre_disk.h \ lustre_dlm_flags.h \ lustre_dlm.h \ - lustre_eacl.h \ lustre_errno.h \ lustre_export.h \ lustre_fid.h \ diff --git a/lustre/include/lustre_eacl.h b/lustre/include/lustre_eacl.h index 68062dc..e69de29 100644 --- a/lustre/include/lustre_eacl.h +++ b/lustre/include/lustre_eacl.h @@ -1,77 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.gnu.org/licenses/gpl-2.0.html - * - * GPL HEADER END - */ -/* - * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * Copyright (c) 2012, 2017, Intel Corporation. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - * - * lustre/lustre/include/lustre_idmap.h - * - * MDS data structures. - * See also lustre_idl.h for wire formats of requests. - */ - -#ifndef _LUSTRE_EACL_H -#define _LUSTRE_EACL_H - -/** \defgroup eacl eacl - * - * @{ - */ - -#ifdef CONFIG_LUSTRE_FS_POSIX_ACL -# include -# include - -#ifdef HAVE_SERVER_SUPPORT -struct lu_ucred; -struct lu_attr; -struct lustre_idmap_table; - -#ifdef HAVE_STRUCT_POSIX_ACL_XATTR -# define posix_acl_xattr_header struct posix_acl_xattr_header -# define posix_acl_xattr_entry struct posix_acl_xattr_entry -#endif - -extern int lustre_posix_acl_permission(struct lu_ucred *mu, - const struct lu_attr *la, - unsigned int may_mask, - posix_acl_xattr_entry *entry, - int count); -extern int lustre_posix_acl_chmod_masq(posix_acl_xattr_entry *entry, - __u32 mode, int count); -extern int lustre_posix_acl_create_masq(posix_acl_xattr_entry *entry, - __u32 *pmode, int count); -extern int lustre_posix_acl_equiv_mode(posix_acl_xattr_entry *entry, mode_t *mode_p, - int count); -#endif /* HAVE_SERVER_SUPPORT */ -#endif /* CONFIG_LUSTRE_FS_POSIX_ACL */ - -/** @} eacl */ - -#endif diff --git a/lustre/mdd/Makefile.in b/lustre/mdd/Makefile.in index b8b0a70..46705cd 100644 --- a/lustre/mdd/Makefile.in +++ b/lustre/mdd/Makefile.in @@ -1,5 +1,7 @@ MODULES := mdd -mdd-objs := mdd_device.o \ +mdd-objs := \ + mdd_acl.o \ + mdd_device.o \ mdd_dir.o \ mdd_lock.o \ mdd_lproc.o \ diff --git a/lustre/obdclass/acl.c b/lustre/mdd/mdd_acl.c similarity index 97% rename from lustre/obdclass/acl.c rename to lustre/mdd/mdd_acl.c index 2ff7396..a32a1d9 100644 --- a/lustre/obdclass/acl.c +++ b/lustre/mdd/mdd_acl.c @@ -39,10 +39,10 @@ #define DEBUG_SUBSYSTEM S_SEC #include #include -#include #include #include #include +#include "mdd_internal.h" #ifdef CONFIG_LUSTRE_FS_POSIX_ACL @@ -149,7 +149,6 @@ check_perm: return -EACCES; } -EXPORT_SYMBOL(lustre_posix_acl_permission); /* * Modify the ACL for the chmod. @@ -198,7 +197,6 @@ int lustre_posix_acl_chmod_masq(posix_acl_xattr_entry *entry, u32 mode, return 0; } -EXPORT_SYMBOL(lustre_posix_acl_chmod_masq); /* * Returns 0 if the acl can be exactly represented in the traditional @@ -241,7 +239,6 @@ lustre_posix_acl_equiv_mode(posix_acl_xattr_entry *entry, mode_t *mode_p, *mode_p = (*mode_p & ~S_IRWXUGO) | mode; return not_equiv; } -EXPORT_SYMBOL(lustre_posix_acl_equiv_mode); /* * Modify acl when creating a new object. @@ -300,5 +297,4 @@ int lustre_posix_acl_create_masq(posix_acl_xattr_entry *entry, u32 *pmode, *pmode = (*pmode & ~S_IRWXUGO) | mode; return not_equiv; } -EXPORT_SYMBOL(lustre_posix_acl_create_masq); #endif diff --git a/lustre/mdd/mdd_internal.h b/lustre/mdd/mdd_internal.h index 842abe3..bdb6e6d 100644 --- a/lustre/mdd/mdd_internal.h +++ b/lustre/mdd/mdd_internal.h @@ -39,7 +39,6 @@ #include #include -#include #include #include #include @@ -438,6 +437,19 @@ int mdd_changelog_user_purge(const struct lu_env *env, struct mdd_device *mdd, /* mdd_prepare.c */ int mdd_compat_fixes(const struct lu_env *env, struct mdd_device *mdd); +/* acl.c */ +extern int lustre_posix_acl_permission(struct lu_ucred *mu, + const struct lu_attr *la, + unsigned int may_mask, + posix_acl_xattr_entry *entry, + int count); +extern int lustre_posix_acl_chmod_masq(posix_acl_xattr_entry *entry, + __u32 mode, int count); +extern int lustre_posix_acl_create_masq(posix_acl_xattr_entry *entry, + __u32 *pmode, int count); +extern int lustre_posix_acl_equiv_mode(posix_acl_xattr_entry *entry, + mode_t *mode_p, int count); + /* inline functions */ static inline int lu_device_is_mdd(struct lu_device *d) { diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index 64d5bef..bdecb34 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -56,7 +56,6 @@ #include #include #include -#include #include #include #include diff --git a/lustre/obdclass/Makefile.in b/lustre/obdclass/Makefile.in index 4882371..afb99fc 100644 --- a/lustre/obdclass/Makefile.in +++ b/lustre/obdclass/Makefile.in @@ -15,7 +15,6 @@ obdclass-all-objs += integrity.o obd_cksum.o obdclass-all-objs += lu_tgt_descs.o lu_tgt_pool.o obdclass-all-objs += range_lock.o interval_tree.o -@SERVER_TRUE@obdclass-all-objs += acl.o @SERVER_TRUE@obdclass-all-objs += idmap.o @SERVER_TRUE@obdclass-all-objs += upcall_cache.o @SERVER_TRUE@obdclass-all-objs += lprocfs_jobstats.o @@ -34,7 +33,6 @@ EXTRA_DIST = $(obdclass-all-objs:.o=.c) llog_test.c llog_internal.h EXTRA_DIST += cl_internal.h local_storage.h EXTRA_DIST += range_lock.c interval_tree.c -@SERVER_FALSE@EXTRA_DIST += acl.c @SERVER_FALSE@EXTRA_DIST += idmap.c @SERVER_FALSE@EXTRA_DIST += upcall_cache.c @SERVER_FALSE@EXTRA_DIST += lprocfs_jobstats.c -- 1.8.3.1