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