dir.h revision 0bfbbf62a8b5a129ba2c689283bfece80a601aba
1ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh/* -*- mode: c; c-basic-offset: 8; -*-
2ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh * vim: noexpandtab sw=8 ts=8 sts=0:
3ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh *
4ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh * dir.h
5ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh *
6ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh * Function prototypes
7ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh *
8ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh * Copyright (C) 2002, 2004 Oracle.  All rights reserved.
9ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh *
10ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh * This program is free software; you can redistribute it and/or
11ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh * modify it under the terms of the GNU General Public
12ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh * License as published by the Free Software Foundation; either
13ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh * version 2 of the License, or (at your option) any later version.
14ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh *
15ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh * This program is distributed in the hope that it will be useful,
16ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh * but WITHOUT ANY WARRANTY; without even the implied warranty of
17ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh * General Public License for more details.
19ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh *
20ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh * You should have received a copy of the GNU General Public
21ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh * License along with this program; if not, write to the
22ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh * Boston, MA 021110-1307, USA.
24ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh */
25ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh
26ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh#ifndef OCFS2_DIR_H
27ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh#define OCFS2_DIR_H
28ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh
29316f4b9f98a353ac1be93199694fd97272378815Mark Fashehstruct buffer_head *ocfs2_find_entry(const char *name,
30316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh				     int namelen,
31316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh				     struct inode *dir,
32316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh				     struct ocfs2_dir_entry **res_dir);
33316f4b9f98a353ac1be93199694fd97272378815Mark Fashehint ocfs2_delete_entry(handle_t *handle,
34316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh		       struct inode *dir,
35316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh		       struct ocfs2_dir_entry *de_del,
36316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh		       struct buffer_head *bh);
37316f4b9f98a353ac1be93199694fd97272378815Mark Fashehint __ocfs2_add_entry(handle_t *handle,
38316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh		      struct inode *dir,
39316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh		      const char *name, int namelen,
40316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh		      struct inode *inode, u64 blkno,
41316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh		      struct buffer_head *parent_fe_bh,
42316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh		      struct buffer_head *insert_bh);
43316f4b9f98a353ac1be93199694fd97272378815Mark Fashehstatic inline int ocfs2_add_entry(handle_t *handle,
44316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh				  struct dentry *dentry,
45316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh				  struct inode *inode, u64 blkno,
46316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh				  struct buffer_head *parent_fe_bh,
47316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh				  struct buffer_head *insert_bh)
48316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh{
49316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh	return __ocfs2_add_entry(handle, dentry->d_parent->d_inode,
50316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh				 dentry->d_name.name, dentry->d_name.len,
51316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh				 inode, blkno, parent_fe_bh, insert_bh);
52316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh}
53316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh
54ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fashehint ocfs2_check_dir_for_entry(struct inode *dir,
55ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh			      const char *name,
56ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh			      int namelen);
570bfbbf62a8b5a129ba2c689283bfece80a601abaMark Fashehint ocfs2_empty_dir(struct inode *inode);
58ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fashehint ocfs2_find_files_on_disk(const char *name,
59ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh			     int namelen,
60ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh			     u64 *blkno,
61ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh			     struct inode *inode,
62ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh			     struct buffer_head **dirent_bh,
63ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh			     struct ocfs2_dir_entry **dirent);
64ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fashehint ocfs2_readdir(struct file *filp, void *dirent, filldir_t filldir);
655eae5b96fc86e6c85f5f90e90fe9e6966f1fec63Mark Fashehint ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv,
665eae5b96fc86e6c85f5f90e90fe9e6966f1fec63Mark Fasheh		      filldir_t filldir);
67ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fashehint ocfs2_prepare_dir_for_insert(struct ocfs2_super *osb,
68ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh				 struct inode *dir,
69ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh				 struct buffer_head *parent_fe_bh,
70ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh				 const char *name,
71ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh				 int namelen,
72ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh				 struct buffer_head **ret_de_bh);
73ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fashehstruct ocfs2_alloc_context;
74316f4b9f98a353ac1be93199694fd97272378815Mark Fashehint ocfs2_fill_new_dir(struct ocfs2_super *osb,
75316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh		       handle_t *handle,
76316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh		       struct inode *parent,
77316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh		       struct inode *inode,
78316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh		       struct buffer_head *fe_bh,
79316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh		       struct ocfs2_alloc_context *data_ac);
80316f4b9f98a353ac1be93199694fd97272378815Mark Fasheh
81ccd979bdbce9fba8412beb3f1de68a9d0171b12cMark Fasheh#endif /* OCFS2_DIR_H */
82