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 } 5338760e24SMark Fasheh int ocfs2_update_entry(struct inode *dir, handle_t *handle, 5438760e24SMark Fasheh struct buffer_head *de_bh, struct ocfs2_dir_entry *de, 5538760e24SMark Fasheh struct inode *new_entry_inode); 56316f4b9fSMark Fasheh 57ccd979bdSMark Fasheh int ocfs2_check_dir_for_entry(struct inode *dir, 58ccd979bdSMark Fasheh const char *name, 59ccd979bdSMark Fasheh int namelen); 600bfbbf62SMark Fasheh int ocfs2_empty_dir(struct inode *inode); 61ccd979bdSMark Fasheh int ocfs2_find_files_on_disk(const char *name, 62ccd979bdSMark Fasheh int namelen, 63ccd979bdSMark Fasheh u64 *blkno, 64ccd979bdSMark Fasheh struct inode *inode, 65ccd979bdSMark Fasheh struct buffer_head **dirent_bh, 66ccd979bdSMark Fasheh struct ocfs2_dir_entry **dirent); 67be94d117SMark Fasheh int ocfs2_lookup_ino_from_name(struct inode *dir, const char *name, 68be94d117SMark Fasheh int namelen, u64 *blkno); 69ccd979bdSMark Fasheh int ocfs2_readdir(struct file *filp, void *dirent, filldir_t filldir); 705eae5b96SMark Fasheh int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv, 715eae5b96SMark Fasheh filldir_t filldir); 72ccd979bdSMark Fasheh int ocfs2_prepare_dir_for_insert(struct ocfs2_super *osb, 73ccd979bdSMark Fasheh struct inode *dir, 74ccd979bdSMark Fasheh struct buffer_head *parent_fe_bh, 75ccd979bdSMark Fasheh const char *name, 76ccd979bdSMark Fasheh int namelen, 77ccd979bdSMark Fasheh struct buffer_head **ret_de_bh); 78ccd979bdSMark Fasheh struct ocfs2_alloc_context; 79316f4b9fSMark Fasheh int ocfs2_fill_new_dir(struct ocfs2_super *osb, 801fabe148SMark Fasheh handle_t *handle, 81316f4b9fSMark Fasheh struct inode *parent, 82316f4b9fSMark Fasheh struct inode *inode, 83316f4b9fSMark Fasheh struct buffer_head *fe_bh, 84316f4b9fSMark Fasheh struct ocfs2_alloc_context *data_ac); 85316f4b9fSMark Fasheh 86c175a518SJoel Becker struct ocfs2_dir_block_trailer *ocfs2_dir_trailer_from_size(int blocksize, 87c175a518SJoel Becker void *data); 88ccd979bdSMark Fasheh #endif /* OCFS2_DIR_H */ 89