Whamcloud - gitweb
Remove simple_mkdir(), push_ctxt(), and pop_ctxt() from filterobd.c and
authoradilger <adilger>
Wed, 3 Apr 2002 07:57:25 +0000 (07:57 +0000)
committeradilger <adilger>
Wed, 3 Apr 2002 07:57:25 +0000 (07:57 +0000)
put them in lib/simple.c so we can use them in MDS.  Add simple.c to
files for obdfilter.

lustre/include/linux/lustre_lib.h
lustre/obdfilter/Makefile.am
lustre/obdfilter/filter.c

index 81e133e..70fdeb7 100644 (file)
@@ -37,6 +37,9 @@ inline void lustre_put_page(struct page *page);
 struct page * lustre_get_page(struct inode *dir, unsigned long n);
 int lustre_prepare_page(unsigned from, unsigned to, struct page *page);
 int lustre_commit_page(struct page *page, unsigned from, unsigned to);
+void push_ctxt(struct obd_run_ctxt *save, struct obd_run_ctxt *new);
+void pop_ctxt(struct obd_run_ctxt *saved);
+int simple_mkdir(struct dentry *dir, char *name, int mode);
 #endif
 
 #include <linux/portals_lib.h>
index 403f2ad..4567bb9 100644 (file)
@@ -8,8 +8,15 @@ MODULE = obdfilter
 modulefs_DATA = obdfilter.o
 EXTRA_PROGRAMS = obdfilter
 
+LINX=simple.c
+simple.c: 
+       ln -s ../lib/simple.c .
+
 EXT2C = filter.c
-obdfilter_SOURCES = filter.c
+obdfilter_SOURCES = filter.c $(LINX)
+
+dist-hook:
+       list='$(LINX)'; for f in $$list; do rm -f $(distdir)/$$f; done
 
 include $(top_srcdir)/Rules
 
index f8c52c7..2e805a8 100644 (file)
@@ -1,4 +1,6 @@
-/*
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
  *  linux/fs/ext2_obd/ext2_obd.c
  *
  * Copyright (C) 2001  Cluster File Systems, Inc.
@@ -44,53 +46,6 @@ static char * obd_type_by_mode[S_IFMT >> S_SHIFT] = {
 };
 
 
-
-/* push / pop to root of obd store */
-void push_ctxt(struct obd_run_ctxt *save, struct obd_run_ctxt *new)
-{ 
-        save->fs = get_fs();
-        save->pwd = dget(current->fs->pwd);
-        save->pwdmnt = mntget(current->fs->pwdmnt);
-
-        set_fs(new->fs);
-        set_fs_pwd(current->fs, new->pwdmnt, new->pwd);
-}
-
-void pop_ctxt(struct obd_run_ctxt *saved)
-{
-        set_fs(saved->fs);
-        set_fs_pwd(current->fs, saved->pwdmnt, saved->pwd);
-
-        dput(saved->pwd);
-        mntput(saved->pwdmnt);
-}
-
-/* utility to make a directory */
-static 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)) { 
-                EXIT;
-                return PTR_ERR(dchild); 
-        }
-
-        if (dchild->d_inode) { 
-                dput(dchild);
-                EXIT;
-                return -EEXIST;
-        }
-
-        err = vfs_mkdir(dir->d_inode, dchild, mode);
-        dput(dchild);
-        
-        EXIT;
-        return err;
-}
-
 /* write the pathname into the string */
 static void filter_id(char *buf, obd_id id, obd_mode mode)
 {