summaryrefslogtreecommitdiff
path: root/include/linux/fcblist.h
blob: 85be93ae40fd3dd4eed9d1288e84c763c2a30eaa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 *  include/linux/fcblist.h ( File event callbacks handling )
 *  Copyright (C) 2001,...,2002  Davide Libenzi
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  Davide Libenzi <davidel@xmailserver.org>
 *
 */

#ifndef __LINUX_FCBLIST_H
#define __LINUX_FCBLIST_H

#include <linux/config.h>
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/fs.h>
#include <linux/file.h>



/* file callback notification events */
#define ION_IN		1
#define ION_OUT		2
#define ION_HUP		3
#define ION_ERR		4

#define FCB_LOCAL_SIZE	4


struct fcb_struct {
	struct list_head llink;
	void (*cbproc)(struct file *, void *, unsigned long *, long *);
	void *data;
	unsigned long local[FCB_LOCAL_SIZE];
};


extern long ion_band_table[];
extern long poll_band_table[];


void file_notify_event(struct file *filep, long *event);

int file_notify_addcb(struct file *filep,
		      void (*cbproc)(struct file *, void *, unsigned long *, long *),
		      void *data);

int file_notify_delcb(struct file *filep,
		      void (*cbproc)(struct file *, void *, unsigned long *, long *));

void file_notify_cleanup(struct file *filep);


static inline void file_notify_init(struct file *filep)
{
	rwlock_init(&filep->f_cblock);
	INIT_LIST_HEAD(&filep->f_cblist);
}

static inline void file_send_notify(struct file *filep, long ioevt, long plevt)
{
	long event[] = { ioevt, plevt, -1 };

	file_notify_event(filep, event);
}

#endif