1 /* Copyright 2005 by Hans Reiser, licensing governed by
4 #include "../../inode.h"
6 /* this is implementation of build_entry_key method of dir
7 plugin for SEEKABLE_HASHED_DIR_PLUGIN_ID
8 This is for directories where we want repeatable and restartable readdir()
9 even in case 32bit user level struct dirent (readdir(3)).
12 build_entry_key_seekable(const struct inode
*dir
, const struct qstr
*name
,
17 assert("nikita-2283", dir
!= NULL
);
18 assert("nikita-2284", name
!= NULL
);
19 assert("nikita-2285", name
->name
!= NULL
);
20 assert("nikita-2286", result
!= NULL
);
22 reiser4_key_init(result
);
23 /* locality of directory entry's key is objectid of parent
25 set_key_locality(result
, get_inode_oid(dir
));
26 /* minor packing locality is constant */
27 set_key_type(result
, KEY_FILE_NAME_MINOR
);
28 /* dot is special case---we always want it to be first entry in
29 a directory. Actually, we just want to have smallest
32 if ((name
->len
== 1) && (name
->name
[0] == '.'))
35 /* objectid of key is 31 lowest bits of hash. */
37 inode_hash_plugin(dir
)->hash(name
->name
,
38 (int)name
->len
) & 0x7fffffff;
40 assert("nikita-2303", !(objectid
& ~KEY_OBJECTID_MASK
));
41 set_key_objectid(result
, objectid
);
43 /* offset is always 0. */
44 set_key_offset(result
, (__u64
) 0);