mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 02:44:41 +03:00
Initial pass at a file API getf/releasef hooks
git-svn-id: https://outreach.scidac.gov/svn/spl/trunk@50 7e1ea52c-4ff2-0310-8f11-9dd32ca42a1c
This commit is contained in:
@@ -23,6 +23,7 @@ splat-objs += splat-rwlock.o
|
||||
splat-objs += splat-time.o
|
||||
splat-objs += splat-vnode.o
|
||||
splat-objs += splat-kobj.o
|
||||
splat-objs += splat-file.o
|
||||
|
||||
splatmodule := splat.ko
|
||||
splatmoduledir := @kmoduledir@/kernel/lib/
|
||||
|
||||
@@ -593,6 +593,7 @@ splat_init(void)
|
||||
SPLAT_SUBSYSTEM_INIT(time);
|
||||
SPLAT_SUBSYSTEM_INIT(vnode);
|
||||
SPLAT_SUBSYSTEM_INIT(kobj);
|
||||
SPLAT_SUBSYSTEM_INIT(file);
|
||||
|
||||
dev = MKDEV(SPLAT_MAJOR, 0);
|
||||
if ((rc = register_chrdev_region(dev, SPLAT_MINORS, "splatctl")))
|
||||
@@ -654,6 +655,7 @@ splat_fini(void)
|
||||
cdev_del(&splat_cdev);
|
||||
unregister_chrdev_region(dev, SPLAT_MINORS);
|
||||
|
||||
SPLAT_SUBSYSTEM_FINI(file);
|
||||
SPLAT_SUBSYSTEM_FINI(kobj);
|
||||
SPLAT_SUBSYSTEM_FINI(vnode);
|
||||
SPLAT_SUBSYSTEM_FINI(time);
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
#include "splat-internal.h"
|
||||
|
||||
#define SPLAT_SUBSYSTEM_FILE 0x0b00
|
||||
#define SPLAT_FILE_NAME "file"
|
||||
#define SPLAT_FILE_DESC "Kernel File Tests"
|
||||
|
||||
#define SPLAT_FILE_TEST1_ID 0x0b01
|
||||
#define SPLAT_FILE_TEST1_NAME "getf"
|
||||
#define SPLAT_FILE_TEST1_DESC "File getf/releasef Test"
|
||||
|
||||
static int
|
||||
splat_file_test1(struct file *file, void *arg)
|
||||
{
|
||||
splat_vprint(file, SPLAT_FILE_TEST1_NAME, "WRITE A TEST, %d\n", 0);
|
||||
|
||||
return 0;
|
||||
} /* splat_file_test1() */
|
||||
|
||||
|
||||
splat_subsystem_t *
|
||||
splat_file_init(void)
|
||||
{
|
||||
splat_subsystem_t *sub;
|
||||
|
||||
sub = kmalloc(sizeof(*sub), GFP_KERNEL);
|
||||
if (sub == NULL)
|
||||
return NULL;
|
||||
|
||||
memset(sub, 0, sizeof(*sub));
|
||||
strncpy(sub->desc.name, SPLAT_FILE_NAME, SPLAT_NAME_SIZE);
|
||||
strncpy(sub->desc.desc, SPLAT_FILE_DESC, SPLAT_DESC_SIZE);
|
||||
INIT_LIST_HEAD(&sub->subsystem_list);
|
||||
INIT_LIST_HEAD(&sub->test_list);
|
||||
spin_lock_init(&sub->test_lock);
|
||||
sub->desc.id = SPLAT_SUBSYSTEM_FILE;
|
||||
|
||||
SPLAT_TEST_INIT(sub, SPLAT_FILE_TEST1_NAME, SPLAT_FILE_TEST1_DESC,
|
||||
SPLAT_FILE_TEST1_ID, splat_file_test1);
|
||||
|
||||
return sub;
|
||||
} /* splat_file_init() */
|
||||
|
||||
void
|
||||
splat_file_fini(splat_subsystem_t *sub)
|
||||
{
|
||||
ASSERT(sub);
|
||||
|
||||
SPLAT_TEST_FINI(sub, SPLAT_FILE_TEST1_ID);
|
||||
|
||||
kfree(sub);
|
||||
} /* splat_file_fini() */
|
||||
|
||||
int
|
||||
splat_file_id(void)
|
||||
{
|
||||
return SPLAT_SUBSYSTEM_FILE;
|
||||
} /* splat_file_id() */
|
||||
@@ -172,6 +172,7 @@ splat_subsystem_t * splat_thread_init(void);
|
||||
splat_subsystem_t * splat_time_init(void);
|
||||
splat_subsystem_t * splat_vnode_init(void);
|
||||
splat_subsystem_t * splat_kobj_init(void);
|
||||
splat_subsystem_t * splat_file_init(void);
|
||||
|
||||
void splat_condvar_fini(splat_subsystem_t *);
|
||||
void splat_kmem_fini(splat_subsystem_t *);
|
||||
@@ -183,6 +184,7 @@ void splat_thread_fini(splat_subsystem_t *);
|
||||
void splat_time_fini(splat_subsystem_t *);
|
||||
void splat_vnode_fini(splat_subsystem_t *);
|
||||
void splat_kobj_fini(splat_subsystem_t *);
|
||||
void splat_file_fini(splat_subsystem_t *);
|
||||
|
||||
int splat_condvar_id(void);
|
||||
int splat_kmem_id(void);
|
||||
@@ -194,5 +196,6 @@ int splat_thread_id(void);
|
||||
int splat_time_id(void);
|
||||
int splat_vnode_id(void);
|
||||
int splat_kobj_id(void);
|
||||
int splat_file_id(void);
|
||||
|
||||
#endif /* _SPLAT_INTERNAL_H */
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
|
||||
#define SPLAT_SUBSYSTEM_KOBJ 0x0a00
|
||||
#define SPLAT_KOBJ_NAME "kobj"
|
||||
#define SPLAT_KOBJ_DESC "Kernel File Tests"
|
||||
#define SPLAT_KOBJ_DESC "Kernel Kobj Tests"
|
||||
|
||||
#define SPLAT_KOBJ_TEST1_ID 0x0a01
|
||||
#define SPLAT_KOBJ_TEST1_NAME "open"
|
||||
#define SPLAT_KOBJ_TEST1_DESC "File Open/Close Test"
|
||||
#define SPLAT_KOBJ_TEST1_DESC "Kobj Open/Close Test"
|
||||
|
||||
#define SPLAT_KOBJ_TEST2_ID 0x0a02
|
||||
#define SPLAT_KOBJ_TEST2_NAME "size/read"
|
||||
#define SPLAT_KOBJ_TEST2_DESC "File Size/Read Test"
|
||||
#define SPLAT_KOBJ_TEST2_DESC "Kobj Size/Read Test"
|
||||
|
||||
#define SPLAT_KOBJ_TEST_FILE "/etc/fstab"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user