Skip to content

Commit 9a08a85

Browse files
committed
Standardize CONFIG_TRUENAS checks to use #ifdef instead of #if
Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
1 parent 5aec6a5 commit 9a08a85

File tree

13 files changed

+46
-46
lines changed

13 files changed

+46
-46
lines changed

fs/attr.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ int setattr_prepare(struct mnt_idmap *idmap, struct dentry *dentry,
179179
goto kill_priv;
180180

181181
/* Make sure a caller can chown. */
182-
#if CONFIG_TRUENAS
182+
#ifdef CONFIG_TRUENAS
183183
/*
184184
* Check for ACE4_WRITE_OWNER. RFC 5661 Section 6.2.1.3.1
185185
* On UNIX systems, this is the ability to execute chown() and
@@ -201,7 +201,7 @@ int setattr_prepare(struct mnt_idmap *idmap, struct dentry *dentry,
201201
#endif
202202

203203
/* Make sure caller can chgrp. */
204-
#if CONFIG_TRUENAS
204+
#ifdef CONFIG_TRUENAS
205205
if ((ia_valid & ATTR_GID) &&
206206
!chgrp_ok(idmap, inode, attr->ia_vfsgid)) {
207207
if (!IS_NFSV4ACL(inode)) {
@@ -221,7 +221,7 @@ int setattr_prepare(struct mnt_idmap *idmap, struct dentry *dentry,
221221
if (ia_valid & ATTR_MODE) {
222222
vfsgid_t vfsgid;
223223

224-
#if CONFIG_TRUENAS
224+
#ifdef CONFIG_TRUENAS
225225
/*
226226
* Check for ACE4_WRITE_ACL. RFC 5661 Section 6.2.1.3.1
227227
* Permission to write the acl or mode attributes.
@@ -432,7 +432,7 @@ int may_setattr(struct mnt_idmap *idmap, struct inode *inode,
432432
return -EPERM;
433433

434434
if (!inode_owner_or_capable(idmap, inode)) {
435-
#if CONFIG_TRUENAS
435+
#ifdef CONFIG_TRUENAS
436436
if (IS_NFSV4ACL(inode)) {
437437
error = inode_permission(idmap, inode,
438438
MAY_WRITE);

fs/namei.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ static inline int do_inode_permission(struct mnt_idmap *idmap,
543543
*/
544544
static int sb_permission(struct super_block *sb, struct inode *inode, int mask)
545545
{
546-
#if CONFIG_TRUENAS
546+
#ifdef CONFIG_TRUENAS
547547
/*
548548
* NFSv4 ACLs have more granular write permissions. Same logic
549549
* should apply here as with generic MAY_WRITE. Specifically, protect
@@ -583,7 +583,7 @@ int inode_permission(struct mnt_idmap *idmap,
583583
if (unlikely(retval))
584584
return retval;
585585

586-
#if CONFIG_TRUENAS
586+
#ifdef CONFIG_TRUENAS
587587
/*
588588
* NFSv4 ACLs have more granular write permissions. Same logic
589589
* should apply here as with generic MAY_WRITE.
@@ -3287,7 +3287,7 @@ static int may_delete(struct mnt_idmap *idmap, struct inode *dir,
32873287
return -EOVERFLOW;
32883288

32893289
audit_inode_child(dir, victim, AUDIT_TYPE_CHILD_DELETE);
3290-
#if CONFIG_TRUENAS
3290+
#ifdef CONFIG_TRUENAS
32913291
if (IS_NFSV4ACL(inode)) {
32923292
/*
32933293
* See RFC 5661 Section 6.2.1.3.2

fs/nfs/nfs4proc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171

7272
#include "nfs4trace.h"
7373

74-
#if CONFIG_TRUENAS
74+
#ifdef CONFIG_TRUENAS
7575
#include "../nfs_common/nfs41acl_xdr.h"
7676

7777
/* 0xFFFFFFFFFFFFFFFF == 18446744073709551615, len('18446744073709551615') == 20 */
@@ -8051,7 +8051,7 @@ static bool nfs4_xattr_list_nfs4_sacl(struct dentry *dentry)
80518051
return nfs4_server_supports_acls(NFS_SB(dentry->d_sb), NFS4ACL_SACL);
80528052
}
80538053

8054-
#if CONFIG_TRUENAS
8054+
#ifdef CONFIG_TRUENAS
80558055
/*
80568056
* We will publish the DACL thru NA41_NAME ("system.nfs4_acl_xdr")
80578057
*
@@ -11585,7 +11585,7 @@ static const struct xattr_handler nfs4_xattr_nfs4_sacl_handler = {
1158511585
.set = nfs4_xattr_set_nfs4_sacl,
1158611586
};
1158711587

11588-
#if CONFIG_TRUENAS
11588+
#ifdef CONFIG_TRUENAS
1158911589
static const struct xattr_handler nfs4_xattr_nfs4_acl_xdr_handler = {
1159011590
.name = NA41_NAME,
1159111591
.list = nfs4_xattr_list_nfs4_acl_xdr,
@@ -11608,7 +11608,7 @@ const struct xattr_handler * const nfs4_xattr_handlers[] = {
1160811608
#if defined(CONFIG_NFS_V4_1)
1160911609
&nfs4_xattr_nfs4_dacl_handler,
1161011610
&nfs4_xattr_nfs4_sacl_handler,
11611-
#if CONFIG_TRUENAS
11611+
#ifdef CONFIG_TRUENAS
1161211612
&nfs4_xattr_nfs4_acl_xdr_handler,
1161311613
#endif /* CONFIG_TRUENAS */
1161411614
#endif

fs/nfs_common/nfsacl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include <linux/nfsacl.h>
2929
#include <linux/nfs3.h>
3030
#include <linux/sort.h>
31-
#if CONFIG_TRUENAS
31+
#ifdef CONFIG_TRUENAS
3232
#include "nfs41acl_xdr.h"
3333

3434
/* Value from zfs/include/os/linux/spl/sys/acl.h */
@@ -429,7 +429,7 @@ bool nfs_stream_decode_acl(struct xdr_stream *xdr, unsigned int *aclcnt,
429429
}
430430
EXPORT_SYMBOL_GPL(nfs_stream_decode_acl);
431431

432-
#if CONFIG_TRUENAS
432+
#ifdef CONFIG_TRUENAS
433433
static int
434434
convert_to_nfs40_ace(u32 *xdrbuf, size_t *remaining, struct nfs4_ace *ace)
435435
{

fs/nfsd/acl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct svc_fh;
4040
struct svc_rqst;
4141
struct nfsd_attrs;
4242
enum nfs_ftype4;
43-
#if CONFIG_TRUENAS
43+
#ifdef CONFIG_TRUENAS
4444
enum nfs4_acl_type;
4545
#endif /* CONFIG_TRUENAS */
4646

@@ -50,7 +50,7 @@ __be32 nfs4_acl_write_who(struct xdr_stream *xdr, int who);
5050

5151
void nfsd4_setup_attr(struct dentry *dentry, struct nfsd_attrs *attr);
5252
int nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry,
53-
#if CONFIG_TRUENAS
53+
#ifdef CONFIG_TRUENAS
5454
struct nfs4_acl **acl, enum nfs4_acl_type acl_type);
5555
#else
5656
struct nfs4_acl **acl);

fs/nfsd/nfs4proc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ check_attr_support(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
9292
if ((bmval[0] & FATTR4_WORD0_ACL) && !IS_POSIXACL(d_inode(dentry)) &&
9393
!IS_NFSV4ACL(d_inode(dentry)))
9494
return nfserr_attrnotsupp;
95-
#if CONFIG_TRUENAS
95+
#ifdef CONFIG_TRUENAS
9696
if ((bmval[1] & FATTR4_WORD1_DACL) && !IS_NFSV4ACL(d_inode(dentry)))
9797
return nfserr_attrnotsupp;
9898
#endif /* CONFIG_TRUENAS */
@@ -384,7 +384,7 @@ nfsd4_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp,
384384

385385
if (attrs.na_labelerr)
386386
open->op_bmval[2] &= ~FATTR4_WORD2_SECURITY_LABEL;
387-
#if CONFIG_TRUENAS
387+
#ifdef CONFIG_TRUENAS
388388
if (attrs.na_aclerr) {
389389
open->op_bmval[0] &= ~FATTR4_WORD0_ACL;
390390
open->op_bmval[1] &= ~FATTR4_WORD1_DACL;
@@ -877,7 +877,7 @@ nfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
877877

878878
if (attrs.na_labelerr)
879879
create->cr_bmval[2] &= ~FATTR4_WORD2_SECURITY_LABEL;
880-
#if CONFIG_TRUENAS
880+
#ifdef CONFIG_TRUENAS
881881
if (attrs.na_aclerr) {
882882
create->cr_bmval[0] &= ~FATTR4_WORD0_ACL;
883883
create->cr_bmval[1] &= ~FATTR4_WORD1_DACL;
@@ -3098,7 +3098,7 @@ static u32 nfsd4_getattr_rsize(const struct svc_rqst *rqstp,
30983098
return nfsd4_max_payload(rqstp);
30993099
if (bmap0 & FATTR4_WORD0_FS_LOCATIONS)
31003100
return nfsd4_max_payload(rqstp);
3101-
#if CONFIG_TRUENAS
3101+
#ifdef CONFIG_TRUENAS
31023102
if (bmap1 & FATTR4_WORD1_DACL)
31033103
return nfsd4_max_payload(rqstp);
31043104
#endif /* CONFIG_TRUENAS */

fs/nfsd/nfs4xdr.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ nfsd4_decode_nfsace4(struct nfsd4_compoundargs *argp, struct nfs4_ace *ace)
319319

320320
/* A counted array of nfsace4's */
321321
static noinline __be32
322-
#if CONFIG_TRUENAS
322+
#ifdef CONFIG_TRUENAS
323323
nfsd4_decode_acl(struct nfsd4_compoundargs *argp, struct nfs4_acl **acl,
324324
enum nfs4_acl_type acl_type)
325325
{
@@ -365,7 +365,7 @@ nfsd4_decode_acl(struct nfsd4_compoundargs *argp, struct nfs4_acl **acl)
365365
if (*acl == NULL)
366366
return nfserr_jukebox;
367367

368-
#if CONFIG_TRUENAS
368+
#ifdef CONFIG_TRUENAS
369369
(*acl)->flag = acl_flag;
370370
#endif /* CONFIG_TRUENAS */
371371
(*acl)->naces = count;
@@ -440,7 +440,7 @@ nfsd4_decode_fattr4(struct nfsd4_compoundargs *argp, u32 *bmval, u32 bmlen,
440440
iattr->ia_valid |= ATTR_SIZE;
441441
}
442442
if (bmval[0] & FATTR4_WORD0_ACL) {
443-
#if CONFIG_TRUENAS
443+
#ifdef CONFIG_TRUENAS
444444
status = nfsd4_decode_acl(argp, acl, NFS4ACL_ACL);
445445
#else
446446
status = nfsd4_decode_acl(argp, acl);
@@ -533,7 +533,7 @@ nfsd4_decode_fattr4(struct nfsd4_compoundargs *argp, u32 *bmval, u32 bmlen,
533533
return nfserr_bad_xdr;
534534
}
535535
}
536-
#if CONFIG_TRUENAS
536+
#ifdef CONFIG_TRUENAS
537537
/*
538538
* This is based on the FATTR4_WORD0_ACL handling above.
539539
*/
@@ -3010,7 +3010,7 @@ static __be32 nfsd4_encode_fattr4_supported_attrs(struct xdr_stream *xdr,
30103010
if (!IS_POSIXACL(d_inode(args->dentry)) &&
30113011
!IS_NFSV4ACL(d_inode(args->dentry)))
30123012
supp[0] &= ~FATTR4_WORD0_ACL;
3013-
#if CONFIG_TRUENAS
3013+
#ifdef CONFIG_TRUENAS
30143014
if (!IS_NFSV4ACL(d_inode(args->dentry)))
30153015
supp[1] &= ~FATTR4_WORD1_DACL;
30163016
#endif /* CONFIG_TRUENAS */
@@ -3629,7 +3629,7 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
36293629
__be32 attrlen, status;
36303630
u32 attrmask[3];
36313631
int err;
3632-
#if CONFIG_TRUENAS
3632+
#ifdef CONFIG_TRUENAS
36333633
/*
36343634
* Even though we expect *either* ACL or DACL to be fetched,
36353635
* lets be cautious and use separate variables.
@@ -3731,7 +3731,7 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
37313731
args.fhp = fhp;
37323732

37333733
if (attrmask[0] & FATTR4_WORD0_ACL) {
3734-
#if CONFIG_TRUENAS
3734+
#ifdef CONFIG_TRUENAS
37353735
/*
37363736
* In TrueNAS we have renamed the existing nfsd4_get_nfs4_acl
37373737
* to get_nfs4_posix_acl, so that we can implement a nfsd4_get_nfs4_acl
@@ -3753,7 +3753,7 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
37533753
goto out_nfserr;
37543754
}
37553755

3756-
#if CONFIG_TRUENAS
3756+
#ifdef CONFIG_TRUENAS
37573757
if (attrmask[1] & FATTR4_WORD1_DACL) {
37583758
err = nfsd4_get_nfs4_acl(rqstp, dentry, &dacl, NFS4ACL_DACL);
37593759
if (err == -EOPNOTSUPP)
@@ -3804,7 +3804,7 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
38043804
if (status != nfs_ok)
38053805
goto out;
38063806
}
3807-
#if CONFIG_TRUENAS
3807+
#ifdef CONFIG_TRUENAS
38083808
/* See FATTR4_WORD0_ACL above */
38093809
if (attrmask[1] & FATTR4_WORD1_DACL) {
38103810
struct nfs4_ace *ace;
@@ -3859,7 +3859,7 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
38593859
security_release_secctx(&args.context);
38603860
#endif /* CONFIG_NFSD_V4_SECURITY_LABEL */
38613861
kfree(args.acl);
3862-
#if CONFIG_TRUENAS
3862+
#ifdef CONFIG_TRUENAS
38633863
kfree(dacl);
38643864
#endif /* CONFIG_TRUENAS */
38653865
if (tempfh) {

fs/nfsd/nfsd.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ enum {
438438
#define NFSD4_1_SUPPORTED_ATTRS_WORD0 \
439439
NFSD4_SUPPORTED_ATTRS_WORD0
440440

441-
#if CONFIG_TRUENAS
441+
#ifdef CONFIG_TRUENAS
442442
#define NFSD4_1_SUPPORTED_ATTRS_WORD1 \
443443
(NFSD4_SUPPORTED_ATTRS_WORD1 | PNFSD_SUPPORTED_ATTRS_WORD1 | FATTR4_WORD1_DACL)
444444
#else
@@ -522,7 +522,7 @@ static inline bool nfsd_attrs_supported(u32 minorversion, const u32 *bmval)
522522
*/
523523
#define NFSD_WRITEABLE_ATTRS_WORD0 \
524524
(FATTR4_WORD0_SIZE | FATTR4_WORD0_ACL)
525-
#if CONFIG_TRUENAS
525+
#ifdef CONFIG_TRUENAS
526526
#define NFSD_WRITEABLE_ATTRS_WORD1 \
527527
(FATTR4_WORD1_MODE | FATTR4_WORD1_OWNER | FATTR4_WORD1_OWNER_GROUP \
528528
| FATTR4_WORD1_TIME_ACCESS_SET | FATTR4_WORD1_TIME_CREATE \

fs/nfsd/vfs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ nfserrno (int errno)
127127
* we also know that the current dentry is for an auto-
128128
* mounted snapshot.
129129
*/
130-
#if CONFIG_TRUENAS
130+
#ifdef CONFIG_TRUENAS
131131
static int
132132
is_in_zfs_snapdir(struct dentry *dentry)
133133
{
@@ -168,14 +168,14 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
168168
.dentry = dget(dentry)};
169169
unsigned int follow_flags = 0;
170170
int err = 0;
171-
#if CONFIG_TRUENAS
171+
#ifdef CONFIG_TRUENAS
172172
int is_snapdir = 0;
173173
#endif /* CONFIG_TRUENAS */
174174

175175
if (exp->ex_flags & NFSEXP_CROSSMOUNT)
176176
follow_flags = LOOKUP_AUTOMOUNT;
177177

178-
#if CONFIG_TRUENAS
178+
#ifdef CONFIG_TRUENAS
179179
// ZFS ctldir specific handling
180180
if (exp->ex_flags & NFSEXP_SNAPDIR) {
181181
is_snapdir = is_in_zfs_snapdir(dentry);
@@ -210,7 +210,7 @@ nfsd_cross_mnt(struct svc_rqst *rqstp, struct dentry **dpp,
210210
goto out;
211211
}
212212

213-
#if CONFIG_TRUENAS
213+
#ifdef CONFIG_TRUENAS
214214
if (nfsd_v4client(rqstp) || is_snapdir ||
215215
#else
216216
if (nfsd_v4client(rqstp) ||

fs/xattr.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ static int
113113
xattr_permission(struct mnt_idmap *idmap, struct inode *inode,
114114
const char *name, int mask)
115115
{
116-
#if CONFIG_TRUENAS
116+
#ifdef CONFIG_TRUENAS
117117
if (mask & (MAY_WRITE | MAY_WRITE_NAMED_ATTRS)) {
118118
#else
119119
if (mask & MAY_WRITE) {
@@ -138,7 +138,7 @@ xattr_permission(struct mnt_idmap *idmap, struct inode *inode,
138138
*/
139139
if (!strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN)) {
140140
if (!capable(CAP_SYS_ADMIN))
141-
#if CONFIG_TRUENAS
141+
#ifdef CONFIG_TRUENAS
142142
return (mask & (MAY_WRITE | MAY_WRITE_NAMED_ATTRS)) ? -EPERM : -ENODATA;
143143
#else
144144
return (mask & MAY_WRITE) ? -EPERM : -ENODATA;
@@ -153,13 +153,13 @@ xattr_permission(struct mnt_idmap *idmap, struct inode *inode,
153153
*/
154154
if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) {
155155
if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode))
156-
#if CONFIG_TRUENAS
156+
#ifdef CONFIG_TRUENAS
157157
return (mask & (MAY_WRITE | MAY_WRITE_NAMED_ATTRS)) ? -EPERM : -ENODATA;
158158
#else
159159
return (mask & MAY_WRITE) ? -EPERM : -ENODATA;
160160
#endif
161161
if (S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX) &&
162-
#if CONFIG_TRUENAS
162+
#ifdef CONFIG_TRUENAS
163163
(mask & (MAY_WRITE | MAY_WRITE_NAMED_ATTRS)) &&
164164
#else
165165
(mask & MAY_WRITE) &&
@@ -294,7 +294,7 @@ __vfs_setxattr_locked(struct mnt_idmap *idmap, struct dentry *dentry,
294294
{
295295
struct inode *inode = dentry->d_inode;
296296
int error;
297-
#if CONFIG_TRUENAS
297+
#ifdef CONFIG_TRUENAS
298298
if (IS_NFSV4ACL(inode)) {
299299
error = xattr_permission(idmap, inode, name, MAY_WRITE);
300300
if (error) {
@@ -565,7 +565,7 @@ __vfs_removexattr_locked(struct mnt_idmap *idmap,
565565
{
566566
struct inode *inode = dentry->d_inode;
567567
int error;
568-
#if CONFIG_TRUENAS
568+
#ifdef CONFIG_TRUENAS
569569
if (IS_NFSV4ACL(inode)) {
570570
error = xattr_permission(idmap, inode, name, MAY_WRITE);
571571
if (error) {

0 commit comments

Comments
 (0)