Changeset View
Changeset View
Standalone View
Standalone View
head/sys/fs/ext2fs/ext2_hash.c
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
* These notices must be retained in any copies of any part of this | * These notices must be retained in any copies of any part of this | ||||
* documentation and/or software. | * documentation and/or software. | ||||
*/ | */ | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/conf.h> | #include <sys/conf.h> | ||||
#include <sys/vnode.h> | #include <sys/vnode.h> | ||||
#include <sys/sdt.h> | |||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
#include <sys/mount.h> | #include <sys/mount.h> | ||||
#include <fs/ext2fs/ext2fs.h> | #include <fs/ext2fs/ext2fs.h> | ||||
#include <fs/ext2fs/fs.h> | #include <fs/ext2fs/fs.h> | ||||
#include <fs/ext2fs/htree.h> | #include <fs/ext2fs/htree.h> | ||||
#include <fs/ext2fs/inode.h> | #include <fs/ext2fs/inode.h> | ||||
#include <fs/ext2fs/ext2_mount.h> | #include <fs/ext2fs/ext2_mount.h> | ||||
#include <fs/ext2fs/ext2_extern.h> | #include <fs/ext2fs/ext2_extern.h> | ||||
SDT_PROVIDER_DECLARE(ext2fs); | |||||
/* | |||||
* ext2fs trace probe: | |||||
* arg0: verbosity. Higher numbers give more verbose messages | |||||
* arg1: Textual message | |||||
*/ | |||||
SDT_PROBE_DEFINE2(ext2fs, , trace, hash, "int", "char*"); | |||||
/* F, G, and H are MD4 functions */ | /* F, G, and H are MD4 functions */ | ||||
#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) | #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) | ||||
#define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) | #define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) | ||||
#define H(x, y, z) ((x) ^ (y) ^ (z)) | #define H(x, y, z) ((x) ^ (y) ^ (z)) | ||||
/* ROTATE_LEFT rotates x left n bits */ | /* ROTATE_LEFT rotates x left n bits */ | ||||
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) | #define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) | ||||
▲ Show 20 Lines • Show All 217 Lines • ▼ Show 20 Lines | while (len > 0) { | ||||
ext2_half_md4(hash, data); | ext2_half_md4(hash, data); | ||||
len -= 32; | len -= 32; | ||||
name += 32; | name += 32; | ||||
} | } | ||||
major = hash[1]; | major = hash[1]; | ||||
minor = hash[2]; | minor = hash[2]; | ||||
break; | break; | ||||
default: | default: | ||||
SDT_PROBE2(ext2fs, , trace, hash, 1, "unexpected hash version"); | |||||
goto error; | goto error; | ||||
} | } | ||||
major &= ~1; | major &= ~1; | ||||
if (major == (EXT2_HTREE_EOF << 1)) | if (major == (EXT2_HTREE_EOF << 1)) | ||||
major = (EXT2_HTREE_EOF - 1) << 1; | major = (EXT2_HTREE_EOF - 1) << 1; | ||||
*hash_major = major; | *hash_major = major; | ||||
if (hash_minor) | if (hash_minor) | ||||
Show All 10 Lines |