X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Flustre_mds.h;h=cb43281574890c0b5b9f0ce8d1a70a34629dbdc3;hb=a21c13d4df4bea1bec0f5804136740ed53d5a57f;hp=32ab1eda1d4c66ca364f0dc4ee5f441013fd01c3;hpb=23b2d47818996a825ab8eadd64ce29089b3d114b;p=fs%2Flustre-release.git diff --git a/lustre/include/lustre_mds.h b/lustre/include/lustre_mds.h index 32ab1ed..cb43281 100644 --- a/lustre/include/lustre_mds.h +++ b/lustre/include/lustre_mds.h @@ -68,10 +68,26 @@ struct md_rejig_data { #define MDD_OBD_NAME "mdd_obd" #define MDD_OBD_UUID "mdd_obd_uuid" -static inline int md_should_create(__u64 flags) +static inline int md_should_create(u64 open_flags) { - return !(flags & MDS_OPEN_DELAY_CREATE) && (flags & FMODE_WRITE) && - !(flags & MDS_OPEN_LEASE); + return !(open_flags & MDS_OPEN_DELAY_CREATE) && + (open_flags & MDS_FMODE_WRITE) && + !(open_flags & MDS_OPEN_LEASE); +} + +/* do NOT or the MAY_*'s, you'll get the weakest */ +static inline int mds_accmode(u64 open_flags) +{ + int res = 0; + + if (open_flags & MDS_FMODE_READ) + res |= MAY_READ; + if (open_flags & (MDS_FMODE_WRITE | MDS_OPEN_TRUNC | MDS_OPEN_APPEND)) + res |= MAY_WRITE; + if (open_flags & MDS_FMODE_EXEC) + res = MAY_EXEC; + + return res; } /** @} mds */