~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/ocfs2/cluster/masklog.c

Version: ~ [ linux-5.0-rc6 ] ~ [ linux-4.20.10 ] ~ [ linux-4.19.23 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.101 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.158 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.174 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.134 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.63 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.39.4 ] ~ [ linux-2.6.38.8 ] ~ [ linux-2.6.37.6 ] ~ [ linux-2.6.36.4 ] ~ [ linux-2.6.35.14 ] ~ [ linux-2.6.34.15 ] ~ [ linux-2.6.33.20 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* -*- mode: c; c-basic-offset: 8; -*-
  2  * vim: noexpandtab sw=8 ts=8 sts=0:
  3  *
  4  * Copyright (C) 2004, 2005 Oracle.  All rights reserved.
  5  *
  6  * This program is free software; you can redistribute it and/or
  7  * modify it under the terms of the GNU General Public
  8  * License as published by the Free Software Foundation; either
  9  * version 2 of the License, or (at your option) any later version.
 10  *
 11  * This program is distributed in the hope that it will be useful,
 12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14  * General Public License for more details.
 15  *
 16  * You should have received a copy of the GNU General Public
 17  * License along with this program; if not, write to the
 18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 19  * Boston, MA 021110-1307, USA.
 20  */
 21 
 22 #include <linux/module.h>
 23 #include <linux/kernel.h>
 24 #include <linux/proc_fs.h>
 25 #include <linux/seq_file.h>
 26 #include <linux/string.h>
 27 #include <linux/uaccess.h>
 28 
 29 #include "masklog.h"
 30 
 31 struct mlog_bits mlog_and_bits = MLOG_BITS_RHS(MLOG_INITIAL_AND_MASK);
 32 EXPORT_SYMBOL_GPL(mlog_and_bits);
 33 struct mlog_bits mlog_not_bits = MLOG_BITS_RHS(0);
 34 EXPORT_SYMBOL_GPL(mlog_not_bits);
 35 
 36 static ssize_t mlog_mask_show(u64 mask, char *buf)
 37 {
 38         char *state;
 39 
 40         if (__mlog_test_u64(mask, mlog_and_bits))
 41                 state = "allow";
 42         else if (__mlog_test_u64(mask, mlog_not_bits))
 43                 state = "deny";
 44         else
 45                 state = "off";
 46 
 47         return snprintf(buf, PAGE_SIZE, "%s\n", state);
 48 }
 49 
 50 static ssize_t mlog_mask_store(u64 mask, const char *buf, size_t count)
 51 {
 52         if (!strncasecmp(buf, "allow", 5)) {
 53                 __mlog_set_u64(mask, mlog_and_bits);
 54                 __mlog_clear_u64(mask, mlog_not_bits);
 55         } else if (!strncasecmp(buf, "deny", 4)) {
 56                 __mlog_set_u64(mask, mlog_not_bits);
 57                 __mlog_clear_u64(mask, mlog_and_bits);
 58         } else if (!strncasecmp(buf, "off", 3)) {
 59                 __mlog_clear_u64(mask, mlog_not_bits);
 60                 __mlog_clear_u64(mask, mlog_and_bits);
 61         } else
 62                 return -