From 4083a1b8cf21bf593b5358006e954a730804c7c8 Mon Sep 17 00:00:00 2001 From: adilger Date: Wed, 3 Apr 2002 07:57:25 +0000 Subject: [PATCH] Remove simple_mkdir(), push_ctxt(), and pop_ctxt() from filterobd.c and 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 | 3 +++ lustre/obdfilter/Makefile.am | 9 ++++++- lustre/obdfilter/filter.c | 51 +++------------------------------------ 3 files changed, 14 insertions(+), 49 deletions(-) diff --git a/lustre/include/linux/lustre_lib.h b/lustre/include/linux/lustre_lib.h index 81e133e..70fdeb7 100644 --- a/lustre/include/linux/lustre_lib.h +++ b/lustre/include/linux/lustre_lib.h @@ -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 diff --git a/lustre/obdfilter/Makefile.am b/lustre/obdfilter/Makefile.am index 403f2ad..4567bb9 100644 --- a/lustre/obdfilter/Makefile.am +++ b/lustre/obdfilter/Makefile.am @@ -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 diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index f8c52c7..2e805a8 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -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) { -- 1.8.3.1