* [PATCH] staging: lustre: mdc: use __FMODE_EXEC macro
@ 2014-11-17 22:23 Juston Li
2014-11-17 22:46 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Juston Li @ 2014-11-17 22:23 UTC (permalink / raw)
To: oleg.drokin
Cc: andreas.dilger, gregkh, HPDD-discuss, devel, linux-kernel, Juston Li
FMODE_EXEC is type fmode_t but is used in operations
with integers which leads to sparse warnings:
drivers/staging/lustre/lustre/mdc/mdc_lib.c:198:21: warning: restricted fmode_t degrades to integer
drivers/staging/lustre/lustre/mdc/mdc_locks.c:300:49: warning: restricted fmode_t degrades to integer
Fix by using __FMODE_EXEC macro defined in fs.h.
Note the same warnings occurs with other fmode flags
here but they don't have a corresponding int macro.
Signed-off-by: Juston Li <juston.h.li@gmail.com>
---
drivers/staging/lustre/lustre/mdc/mdc_lib.c | 4 ++--
drivers/staging/lustre/lustre/mdc/mdc_locks.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
index e8732cc..34c9a86 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
@@ -194,8 +194,8 @@ static __u64 mds_pack_open_flags(__u64 flags, __u32 mode)
cr_flags |= MDS_OPEN_SYNC;
if (flags & O_DIRECTORY)
cr_flags |= MDS_OPEN_DIRECTORY;
-#ifdef FMODE_EXEC
- if (flags & FMODE_EXEC)
+#ifdef __FMODE_EXEC
+ if (flags & __FMODE_EXEC)
cr_flags |= MDS_FMODE_EXEC;
#endif
if (cl_is_lov_delay_create(flags))
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
index b58147e..c05afa8 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
@@ -296,8 +296,8 @@ static struct ptlrpc_request *mdc_intent_open_pack(struct obd_export *exp,
} else {
if (it->it_flags & (FMODE_WRITE|MDS_OPEN_TRUNC))
mode = LCK_CW;
-#ifdef FMODE_EXEC
- else if (it->it_flags & FMODE_EXEC)
+#ifdef __FMODE_EXEC
+ else if (it->it_flags & __FMODE_EXEC)
mode = LCK_PR;
#endif
else
--
2.1.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: lustre: mdc: use __FMODE_EXEC macro
2014-11-17 22:23 [PATCH] staging: lustre: mdc: use __FMODE_EXEC macro Juston Li
@ 2014-11-17 22:46 ` Dan Carpenter
2014-11-18 0:23 ` Juston
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2014-11-17 22:46 UTC (permalink / raw)
To: Juston Li
Cc: oleg.drokin, devel, andreas.dilger, gregkh, linux-kernel, HPDD-discuss
On Mon, Nov 17, 2014 at 02:23:48PM -0800, Juston Li wrote:
> FMODE_EXEC is type fmode_t but is used in operations
> with integers which leads to sparse warnings:
> drivers/staging/lustre/lustre/mdc/mdc_lib.c:198:21: warning: restricted fmode_t degrades to integer
> drivers/staging/lustre/lustre/mdc/mdc_locks.c:300:49: warning: restricted fmode_t degrades to integer
>
> Fix by using __FMODE_EXEC macro defined in fs.h.
>
> Note the same warnings occurs with other fmode flags
> here but they don't have a corresponding int macro.
>
When are FMODE_EXEC and __FMODE_EXEC not defined? I think they're
always defined. I don't understand the point of these ifdefs. I guess
maybe they are for compatability with obsolete kernels?
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: lustre: mdc: use __FMODE_EXEC macro
2014-11-17 22:46 ` Dan Carpenter
@ 2014-11-18 0:23 ` Juston
2014-11-18 0:55 ` Greg KH
2014-11-18 6:43 ` Dan Carpenter
0 siblings, 2 replies; 5+ messages in thread
From: Juston @ 2014-11-18 0:23 UTC (permalink / raw)
To: Dan Carpenter
Cc: oleg.drokin, devel, andreas.dilger, gregkh, linux-kernel, HPDD-discuss
On Tue, 2014-11-18 at 01:46 +0300, Dan Carpenter wrote:
> On Mon, Nov 17, 2014 at 02:23:48PM -0800, Juston Li wrote:
> > FMODE_EXEC is type fmode_t but is used in operations
> > with integers which leads to sparse warnings:
> > drivers/staging/lustre/lustre/mdc/mdc_lib.c:198:21: warning: restricted fmode_t degrades to integer
> > drivers/staging/lustre/lustre/mdc/mdc_locks.c:300:49: warning: restricted fmode_t degrades to integer
> >
> > Fix by using __FMODE_EXEC macro defined in fs.h.
> >
> > Note the same warnings occurs with other fmode flags
> > here but they don't have a corresponding int macro.
> >
>
> When are FMODE_EXEC and __FMODE_EXEC not defined? I think they're
> always defined. I don't understand the point of these ifdefs. I guess
> maybe they are for compatability with obsolete kernels?
>
> regards,
> dan carpenter
>
Seems to be the case. Looked at some old commits (2.6.17) and found
FMODE_EXEC was mainlined to allow lustre to be installed on a vanilla
kernel.
Since you pointed it out, if we are dealing with compatability with
obselete kernels, __FMODE_EXEC was added later in 2.6.38. Wondering
if I should address the case where FMODE_EXEC is defined but
__FMODE_EXEC isn't since I currently only check __FMODE_EXEC.
Regards,
Juston Li
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: lustre: mdc: use __FMODE_EXEC macro
2014-11-18 0:23 ` Juston
@ 2014-11-18 0:55 ` Greg KH
2014-11-18 6:43 ` Dan Carpenter
1 sibling, 0 replies; 5+ messages in thread
From: Greg KH @ 2014-11-18 0:55 UTC (permalink / raw)
To: Dan Carpenter, oleg.drokin, devel, andreas.dilger, linux-kernel,
HPDD-discuss
On Mon, Nov 17, 2014 at 04:23:08PM -0800, Juston wrote:
> On Tue, 2014-11-18 at 01:46 +0300, Dan Carpenter wrote:
> > On Mon, Nov 17, 2014 at 02:23:48PM -0800, Juston Li wrote:
> > > FMODE_EXEC is type fmode_t but is used in operations
> > > with integers which leads to sparse warnings:
> > > drivers/staging/lustre/lustre/mdc/mdc_lib.c:198:21: warning: restricted fmode_t degrades to integer
> > > drivers/staging/lustre/lustre/mdc/mdc_locks.c:300:49: warning: restricted fmode_t degrades to integer
> > >
> > > Fix by using __FMODE_EXEC macro defined in fs.h.
> > >
> > > Note the same warnings occurs with other fmode flags
> > > here but they don't have a corresponding int macro.
> > >
> >
> > When are FMODE_EXEC and __FMODE_EXEC not defined? I think they're
> > always defined. I don't understand the point of these ifdefs. I guess
> > maybe they are for compatability with obsolete kernels?
> >
> > regards,
> > dan carpenter
> >
> Seems to be the case. Looked at some old commits (2.6.17) and found
> FMODE_EXEC was mainlined to allow lustre to be installed on a vanilla
> kernel.
> Since you pointed it out, if we are dealing with compatability with
> obselete kernels, __FMODE_EXEC was added later in 2.6.38. Wondering
> if I should address the case where FMODE_EXEC is defined but
> __FMODE_EXEC isn't since I currently only check __FMODE_EXEC.
Just fix it up to work the the current kernel version, no need to
support anything else in this codebase.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: lustre: mdc: use __FMODE_EXEC macro
2014-11-18 0:23 ` Juston
2014-11-18 0:55 ` Greg KH
@ 2014-11-18 6:43 ` Dan Carpenter
1 sibling, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2014-11-18 6:43 UTC (permalink / raw)
To: Juston
Cc: devel, andreas.dilger, gregkh, linux-kernel, oleg.drokin, HPDD-discuss
On Mon, Nov 17, 2014 at 04:23:08PM -0800, Juston wrote:
> Seems to be the case. Looked at some old commits (2.6.17) and found
> FMODE_EXEC was mainlined to allow lustre to be installed on a vanilla
> kernel.
We actually only care about the most recent kernel. I think you can
remove the ifdefs in this case.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-11-18 17:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-17 22:23 [PATCH] staging: lustre: mdc: use __FMODE_EXEC macro Juston Li
2014-11-17 22:46 ` Dan Carpenter
2014-11-18 0:23 ` Juston
2014-11-18 0:55 ` Greg KH
2014-11-18 6:43 ` Dan Carpenter
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).