VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
7336d0e654f7a (Thomas Gleixner   2019-05-31 01:09:56 -0700  1) /* SPDX-License-Identifier: GPL-2.0-only */
b3b94faa5fe59 (David Teigland    2006-01-16 16:50:04 +0000  2) /*
b3b94faa5fe59 (David Teigland    2006-01-16 16:50:04 +0000  3)  * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
3a8a9a1034813 (Steven Whitehouse 2006-05-18 15:09:15 -0400  4)  * Copyright (C) 2004-2006 Red Hat, Inc.  All rights reserved.
b3b94faa5fe59 (David Teigland    2006-01-16 16:50:04 +0000  5)  */
b3b94faa5fe59 (David Teigland    2006-01-16 16:50:04 +0000  6) 
b3b94faa5fe59 (David Teigland    2006-01-16 16:50:04 +0000  7) #ifndef __DIR_DOT_H__
b3b94faa5fe59 (David Teigland    2006-01-16 16:50:04 +0000  8) #define __DIR_DOT_H__
b3b94faa5fe59 (David Teigland    2006-01-16 16:50:04 +0000  9) 
f2f7ba5237e2f (Steven Whitehouse 2006-09-05 10:39:21 -0400 10) #include <linux/dcache.h>
b52896813c2f1 (Steven Whitehouse 2008-11-26 12:49:26 +0000 11) #include <linux/crc32.h>
f2f7ba5237e2f (Steven Whitehouse 2006-09-05 10:39:21 -0400 12) 
f2f7ba5237e2f (Steven Whitehouse 2006-09-05 10:39:21 -0400 13) struct inode;
f2f7ba5237e2f (Steven Whitehouse 2006-09-05 10:39:21 -0400 14) struct gfs2_inode;
f2f7ba5237e2f (Steven Whitehouse 2006-09-05 10:39:21 -0400 15) struct gfs2_inum;
2b47dad866d04 (Steven Whitehouse 2014-01-06 12:49:43 +0000 16) struct buffer_head;
2b47dad866d04 (Steven Whitehouse 2014-01-06 12:49:43 +0000 17) struct gfs2_dirent;
f2f7ba5237e2f (Steven Whitehouse 2006-09-05 10:39:21 -0400 18) 
3c1c0ae1db74b (Steven Whitehouse 2014-01-06 11:28:41 +0000 19) struct gfs2_diradd {
3c1c0ae1db74b (Steven Whitehouse 2014-01-06 11:28:41 +0000 20) 	unsigned nr_blocks;
2b47dad866d04 (Steven Whitehouse 2014-01-06 12:49:43 +0000 21) 	struct gfs2_dirent *dent;
2b47dad866d04 (Steven Whitehouse 2014-01-06 12:49:43 +0000 22) 	struct buffer_head *bh;
19aeb5a65f1a6 (Bob Peterson      2014-09-29 08:52:04 -0400 23) 	int save_loc;
3c1c0ae1db74b (Steven Whitehouse 2014-01-06 11:28:41 +0000 24) };
3c1c0ae1db74b (Steven Whitehouse 2014-01-06 11:28:41 +0000 25) 
8d1235852b462 (Steven Whitehouse 2010-09-17 12:30:23 +0100 26) extern struct inode *gfs2_dir_search(struct inode *dir,
5a00f3cc978be (Steven Whitehouse 2013-06-11 13:45:29 +0100 27) 				     const struct qstr *filename,
5a00f3cc978be (Steven Whitehouse 2013-06-11 13:45:29 +0100 28) 				     bool fail_on_exist);
8d1235852b462 (Steven Whitehouse 2010-09-17 12:30:23 +0100 29) extern int gfs2_dir_check(struct inode *dir, const struct qstr *filename,
8d1235852b462 (Steven Whitehouse 2010-09-17 12:30:23 +0100 30) 			  const struct gfs2_inode *ip);
8d1235852b462 (Steven Whitehouse 2010-09-17 12:30:23 +0100 31) extern int gfs2_dir_add(struct inode *inode, const struct qstr *filename,
2b47dad866d04 (Steven Whitehouse 2014-01-06 12:49:43 +0000 32) 			const struct gfs2_inode *ip, struct gfs2_diradd *da);
2b47dad866d04 (Steven Whitehouse 2014-01-06 12:49:43 +0000 33) static inline void gfs2_dir_no_add(struct gfs2_diradd *da)
2b47dad866d04 (Steven Whitehouse 2014-01-06 12:49:43 +0000 34) {
bccaef9073858 (Markus Elfring    2019-09-03 15:10:05 +0200 35) 	brelse(da->bh);
2b47dad866d04 (Steven Whitehouse 2014-01-06 12:49:43 +0000 36) 	da->bh = NULL;
2b47dad866d04 (Steven Whitehouse 2014-01-06 12:49:43 +0000 37) }
855d23ce2665c (Steven Whitehouse 2011-05-09 16:42:37 +0100 38) extern int gfs2_dir_del(struct gfs2_inode *dip, const struct dentry *dentry);
d81a8ef59802d (Al Viro           2013-05-16 14:14:48 -0400 39) extern int gfs2_dir_read(struct inode *inode, struct dir_context *ctx,
d81a8ef59802d (Al Viro           2013-05-16 14:14:48 -0400 40) 			 struct file_ra_state *f_ra);
8d1235852b462 (Steven Whitehouse 2010-09-17 12:30:23 +0100 41) extern int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
8d1235852b462 (Steven Whitehouse 2010-09-17 12:30:23 +0100 42) 			  const struct gfs2_inode *nip, unsigned int new_type);
b3b94faa5fe59 (David Teigland    2006-01-16 16:50:04 +0000 43) 
8d1235852b462 (Steven Whitehouse 2010-09-17 12:30:23 +0100 44) extern int gfs2_dir_exhash_dealloc(struct gfs2_inode *dip);
b3b94faa5fe59 (David Teigland    2006-01-16 16:50:04 +0000 45) 
8d1235852b462 (Steven Whitehouse 2010-09-17 12:30:23 +0100 46) extern int gfs2_diradd_alloc_required(struct inode *dir,
3c1c0ae1db74b (Steven Whitehouse 2014-01-06 11:28:41 +0000 47) 				      const struct qstr *filename,
3c1c0ae1db74b (Steven Whitehouse 2014-01-06 11:28:41 +0000 48) 				      struct gfs2_diradd *da);
8d1235852b462 (Steven Whitehouse 2010-09-17 12:30:23 +0100 49) extern int gfs2_dir_get_new_buffer(struct gfs2_inode *ip, u64 block,
8d1235852b462 (Steven Whitehouse 2010-09-17 12:30:23 +0100 50) 				   struct buffer_head **bhp);
17d539f0499fa (Steven Whitehouse 2011-06-15 10:29:37 +0100 51) extern void gfs2_dir_hash_inval(struct gfs2_inode *ip);
c752666c17f87 (Steven Whitehouse 2006-03-20 12:30:04 -0500 52) 
cd915493fce91 (Steven Whitehouse 2006-09-04 12:49:07 -0400 53) static inline u32 gfs2_disk_hash(const char *data, int len)
71b86f562b5eb (Steven Whitehouse 2006-03-28 14:14:04 -0500 54) {
2bdbc5d73961c (Steven Whitehouse 2006-09-05 09:34:20 -0400 55)         return crc32_le((u32)~0, data, len) ^ (u32)~0;
71b86f562b5eb (Steven Whitehouse 2006-03-28 14:14:04 -0500 56) }
71b86f562b5eb (Steven Whitehouse 2006-03-28 14:14:04 -0500 57) 
71b86f562b5eb (Steven Whitehouse 2006-03-28 14:14:04 -0500 58) 
71b86f562b5eb (Steven Whitehouse 2006-03-28 14:14:04 -0500 59) static inline void gfs2_str2qstr(struct qstr *name, const char *fname)
71b86f562b5eb (Steven Whitehouse 2006-03-28 14:14:04 -0500 60) {
71b86f562b5eb (Steven Whitehouse 2006-03-28 14:14:04 -0500 61) 	name->name = fname;
71b86f562b5eb (Steven Whitehouse 2006-03-28 14:14:04 -0500 62) 	name->len = strlen(fname);
71b86f562b5eb (Steven Whitehouse 2006-03-28 14:14:04 -0500 63) 	name->hash = gfs2_disk_hash(name->name, name->len);
71b86f562b5eb (Steven Whitehouse 2006-03-28 14:14:04 -0500 64) }
71b86f562b5eb (Steven Whitehouse 2006-03-28 14:14:04 -0500 65) 
c752666c17f87 (Steven Whitehouse 2006-03-20 12:30:04 -0500 66) /* N.B. This probably ought to take inum & type as args as well */
c752666c17f87 (Steven Whitehouse 2006-03-20 12:30:04 -0500 67) static inline void gfs2_qstr2dirent(const struct qstr *name, u16 reclen, struct gfs2_dirent *dent)
c752666c17f87 (Steven Whitehouse 2006-03-20 12:30:04 -0500 68) {
c752666c17f87 (Steven Whitehouse 2006-03-20 12:30:04 -0500 69) 	dent->de_inum.no_addr = cpu_to_be64(0);
c752666c17f87 (Steven Whitehouse 2006-03-20 12:30:04 -0500 70) 	dent->de_inum.no_formal_ino = cpu_to_be64(0);
c752666c17f87 (Steven Whitehouse 2006-03-20 12:30:04 -0500 71) 	dent->de_hash = cpu_to_be32(name->hash);
c752666c17f87 (Steven Whitehouse 2006-03-20 12:30:04 -0500 72) 	dent->de_rec_len = cpu_to_be16(reclen);
c752666c17f87 (Steven Whitehouse 2006-03-20 12:30:04 -0500 73) 	dent->de_name_len = cpu_to_be16(name->len);
c752666c17f87 (Steven Whitehouse 2006-03-20 12:30:04 -0500 74) 	dent->de_type = cpu_to_be16(0);
c752666c17f87 (Steven Whitehouse 2006-03-20 12:30:04 -0500 75) 	memset(dent->__pad, 0, sizeof(dent->__pad));
2bdbc5d73961c (Steven Whitehouse 2006-09-05 09:34:20 -0400 76) 	memcpy(dent + 1, name->name, name->len);
c752666c17f87 (Steven Whitehouse 2006-03-20 12:30:04 -0500 77) }
b3b94faa5fe59 (David Teigland    2006-01-16 16:50:04 +0000 78) 
8d1235852b462 (Steven Whitehouse 2010-09-17 12:30:23 +0100 79) extern struct qstr gfs2_qdot;
8d1235852b462 (Steven Whitehouse 2010-09-17 12:30:23 +0100 80) extern struct qstr gfs2_qdotdot;
8d1235852b462 (Steven Whitehouse 2010-09-17 12:30:23 +0100 81) 
b3b94faa5fe59 (David Teigland    2006-01-16 16:50:04 +0000 82) #endif /* __DIR_DOT_H__ */