Hello,

These are all the files for the different xattr handlers.  Note that the ACL
stuff is just there as a placeholder for now, it doesn't actually do anything.
Thank you,

Josef

diff -r 9cb5f0f5c713 acl.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/acl.c     Tue Nov 06 21:46:45 2007 -0500
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2007 Red Hat.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+#include <linux/fs.h>
+#include <linux/string.h>
+#include <linux/xattr.h>
+#include <linux/posix_acl_xattr.h>
+#include "ctree.h"
+#include "xattr.h"
+
+static size_t btrfs_xattr_acl_access_list(struct inode *inode, char *list,
+                                         size_t list_size, const char *name,
+                                         size_t name_len)
+{
+       if (list && (name_len+1) <= list_size) {
+               memcpy(list, name, name_len);
+               list[name_len] = '\0';
+       } else
+               return -ERANGE;
+
+       return name_len+1;
+}
+
+static int btrfs_xattr_acl_access_get(struct inode *inode, const char *name,
+                                     void *value, size_t size)
+{
+       if (strcmp(name, "") == 0)
+               return -EINVAL;
+       return btrfs_xattr_get(inode, BTRFS_XATTR_INDEX_POSIX_ACL_ACCESS, name,
+                              value, size);
+}
+
+static int btrfs_xattr_acl_access_set(struct inode *inode, const char *name,
+                                     const void *value, size_t size, int flags)
+{
+       if (strcmp(name, "") == 0)
+               return -EINVAL;
+       return btrfs_xattr_set(inode, BTRFS_XATTR_INDEX_POSIX_ACL_ACCESS, name,
+                              value, size, flags);
+}
+
+static size_t btrfs_xattr_acl_default_list(struct inode *inode, char *list,
+                                          size_t list_size, const char *name,
+                                          size_t name_len)
+{
+       if (list && (name_len+1) <= list_size) {
+               memcpy(list, name, name_len);
+               list[name_len] = '\0';
+       } else
+               return -ERANGE;
+
+       return name_len+1;
+}
+
+static int btrfs_xattr_acl_default_get(struct inode *inode, const char *name,
+                                      void *value, size_t size)
+{
+       if (strcmp(name, "") == 0)
+               return -EINVAL;
+       return btrfs_xattr_get(inode, BTRFS_XATTR_INDEX_POSIX_ACL_DEFAULT,
+                              name, value, size);
+}
+
+static int btrfs_xattr_acl_default_set(struct inode *inode, const char *name,
+                                      const void *value, size_t size, int 
flags)
+{
+       if (strcmp(name, "") == 0)
+               return -EINVAL;
+       return btrfs_xattr_set(inode, BTRFS_XATTR_INDEX_POSIX_ACL_DEFAULT,
+                              name, value, size, flags);
+}
+
+struct xattr_handler btrfs_xattr_acl_default_handler = {
+       .prefix = POSIX_ACL_XATTR_DEFAULT,
+       .list   = btrfs_xattr_acl_default_list,
+       .get    = btrfs_xattr_acl_default_get,
+       .set    = btrfs_xattr_acl_default_set,
+};
+
+struct xattr_handler btrfs_xattr_acl_access_handler = {
+       .prefix = POSIX_ACL_XATTR_ACCESS,
+       .list   = btrfs_xattr_acl_access_list,
+       .get    = btrfs_xattr_acl_access_get,
+       .set    = btrfs_xattr_acl_access_set,
+};
diff -r 9cb5f0f5c713 xattr_security.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xattr_security.c  Tue Nov 06 21:44:56 2007 -0500
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2007 Red Hat.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+#include <linux/fs.h>
+#include <linux/string.h>
+#include "ctree.h"
+#include "xattr.h"
+
+static size_t btrfs_xattr_security_list(struct inode *inode, char *list,
+                                       size_t list_size, const char *name,
+                                       size_t name_len)
+{
+       if (list && (name_len+1) <= list_size) {
+               memcpy(list, name, name_len);
+               list[name_len] = '\0';
+       } else
+               return -ERANGE;
+
+       return name_len+1;
+}
+
+static int btrfs_xattr_security_get(struct inode *inode, const char *name,
+                                   void *value, size_t size)
+{
+       if (strcmp(name, "") == 0)
+               return -EINVAL;
+       return btrfs_xattr_get(inode, BTRFS_XATTR_INDEX_SECURITY, name, value,
+                              size);
+}
+
+static int btrfs_xattr_security_set(struct inode *inode, const char *name,
+                                   const void *value, size_t size, int flags)
+{
+       if (strcmp(name, "") == 0)
+               return -EINVAL;
+       return btrfs_xattr_set(inode, BTRFS_XATTR_INDEX_SECURITY, name, value,
+                              size, flags);
+}
+
+struct xattr_handler btrfs_xattr_security_handler = {
+       .prefix = XATTR_SECURITY_PREFIX,
+       .list   = btrfs_xattr_security_list,
+       .get    = btrfs_xattr_security_get,
+       .set    = btrfs_xattr_security_set,
+};
diff -r 9cb5f0f5c713 xattr_system.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xattr_system.c    Tue Nov 06 21:44:15 2007 -0500
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2007 Red Hat.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+#include <linux/fs.h>
+#include <linux/string.h>
+#include "ctree.h"
+#include "xattr.h"
+
+static size_t btrfs_xattr_system_list(struct inode *inode, char *list,
+                                   size_t list_size, const char *name,
+                                   size_t name_len)
+{
+       if (list && (name_len+1) <= list_size) {
+               memcpy(list, name, name_len);
+               list[name_len] = '\0';
+       } else
+               return -ERANGE;
+
+       return name_len+1;
+}
+
+static int btrfs_xattr_system_get(struct inode *inode, const char *name,
+                               void *value, size_t size)
+{
+       if (strcmp(name, "") == 0)
+               return -EINVAL;
+       return btrfs_xattr_get(inode, BTRFS_XATTR_INDEX_SYSTEM, name, value,
+                              size);
+}
+
+static int btrfs_xattr_system_set(struct inode *inode, const char *name,
+                               const void *value, size_t size, int flags)
+{
+       if (strcmp(name, "") == 0)
+               return -EINVAL;
+       return btrfs_xattr_set(inode, BTRFS_XATTR_INDEX_SYSTEM, name, value,
+                              size, flags);
+}
+
+struct xattr_handler btrfs_xattr_system_handler = {
+       .prefix = XATTR_SYSTEM_PREFIX,
+       .list   = btrfs_xattr_system_list,
+       .get    = btrfs_xattr_system_get,
+       .set    = btrfs_xattr_system_set,
+};
diff -r 9cb5f0f5c713 xattr_user.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xattr_user.c      Tue Nov 06 21:43:39 2007 -0500
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2007 Red Hat.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+#include <linux/fs.h>
+#include <linux/string.h>
+#include "ctree.h"
+#include "xattr.h"
+
+static size_t btrfs_xattr_user_list(struct inode *inode, char *list,
+                                   size_t list_size, const char *name,
+                                   size_t name_len)
+{
+       if (list && (name_len+1) <= list_size) {
+               memcpy(list, name, name_len);
+               list[name_len] = '\0';
+       } else
+               return -ERANGE;
+
+       return name_len+1;
+}
+
+static int btrfs_xattr_user_get(struct inode *inode, const char *name,
+                               void *value, size_t size)
+{
+       if (strcmp(name, "") == 0)
+               return -EINVAL;
+       return btrfs_xattr_get(inode, BTRFS_XATTR_INDEX_USER, name, value,
+                              size);
+}
+
+static int btrfs_xattr_user_set(struct inode *inode, const char *name,
+                               const void *value, size_t size, int flags)
+{
+       if (strcmp(name, "") == 0)
+               return -EINVAL;
+       return btrfs_xattr_set(inode, BTRFS_XATTR_INDEX_USER, name, value,
+                              size, flags);
+}
+
+struct xattr_handler btrfs_xattr_user_handler = {
+       .prefix = XATTR_USER_PREFIX,
+       .list   = btrfs_xattr_user_list,
+       .get    = btrfs_xattr_user_get,
+       .set    = btrfs_xattr_user_set,
+};
diff -r 9cb5f0f5c713 xattr_trusted.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/xattr_trusted.c   Tue Nov 06 21:43:34 2007 -0500
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2007 Red Hat.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+#include <linux/fs.h>
+#include <linux/string.h>
+#include "ctree.h"
+#include "xattr.h"
+
+static size_t btrfs_xattr_trusted_list(struct inode *inode, char *list,
+                                      size_t list_size, const char *name,
+                                      size_t name_len)
+{
+       if (list && (name_len+1) <= list_size) {
+               memcpy(list, name, name_len);
+               list[name_len] = '\0';
+       } else
+               return -ERANGE;
+
+       return name_len+1;
+}
+
+static int btrfs_xattr_trusted_get(struct inode *inode, const char *name,
+                                  void *value, size_t size)
+{
+       if (strcmp(name, "") == 0)
+               return -EINVAL;
+       return btrfs_xattr_get(inode, BTRFS_XATTR_INDEX_TRUSTED, name, value,
+                              size);
+}
+
+static int btrfs_xattr_trusted_set(struct inode *inode, const char *name,
+                                  const void *value, size_t size, int flags)
+{
+       if (strcmp(name, "") == 0)
+               return -EINVAL;
+       return btrfs_xattr_set(inode, BTRFS_XATTR_INDEX_TRUSTED, name, value,
+                              size, flags);
+}
+
+struct xattr_handler btrfs_xattr_trusted_handler = {
+       .prefix = XATTR_TRUSTED_PREFIX,
+       .list   = btrfs_xattr_trusted_list,
+       .get    = btrfs_xattr_trusted_get,
+       .set    = btrfs_xattr_trusted_set,
+};

_______________________________________________
Btrfs-devel mailing list
[email protected]
http://oss.oracle.com/mailman/listinfo/btrfs-devel

Reply via email to