Whamcloud - gitweb
Move simple_mkdir() out of filterobd so that MDS can use it also.
authoradilger <adilger>
Wed, 3 Apr 2002 00:45:32 +0000 (00:45 +0000)
committeradilger <adilger>
Wed, 3 Apr 2002 00:45:32 +0000 (00:45 +0000)
lustre/lib/simple.c [new file with mode: 0644]

diff --git a/lustre/lib/simple.c b/lustre/lib/simple.c
new file mode 100644 (file)
index 0000000..bb56a67
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ *  lib/simple.c
+ *
+ * Copyright (C) 2002  Cluster File Systems, Inc.
+ *
+ * This code is issued under the GNU General Public License.
+ * See the file COPYING in this distribution
+ *
+ * by Peter Braam <braam@clusterfs.com>
+ * and Andreas Dilger <adilger@clusterfs.com>
+ */
+
+#define EXPORT_SYMTAB
+
+#include <linux/version.h>
+#include <linux/fs.h>
+#include <asm/unistd.h>
+
+#define DEBUG_SUBSYSTEM S_FILTER
+
+#include <linux/lustre_mds.h>
+#include <linux/lustre_lib.h>
+#include <linux/lustre_net.h>
+
+/* utility to make a directory */
+int simple_mkdir(struct dentry *dir, char *name, int mode)
+{
+        struct dentry *dchild;
+        int err;
+        ENTRY;
+
+        dchild = lookup_one_len(name, dir, strlen(name));
+        if (IS_ERR(dchild))
+                RETURN(PTR_ERR(dchild));
+
+        if (dchild->d_inode)
+                GOTO(out, err = -EEXIST);
+
+        err = vfs_mkdir(dir->d_inode, dchild, mode);
+out:
+        l_dput(dchild);
+
+        RETURN(err);
+}