From 92d1795dee54fb36966910d448d6dc3cf60b5032 Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Sat, 18 Jul 2009 13:00:47 +0200 Subject: - Import mfs_notify subroutines for registering for events on system files. The intent is to be able to detect when a musicfs folder or file is changed or modified in order to update filesystem data. --- include/mfs_notify.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 include/mfs_notify.h (limited to 'include/mfs_notify.h') diff --git a/include/mfs_notify.h b/include/mfs_notify.h new file mode 100644 index 0000000..b9c72ac --- /dev/null +++ b/include/mfs_notify.h @@ -0,0 +1,58 @@ +/* + * Musicfs is a FUSE module implementing a media filesystem in userland. + * Copyright (C) 2008 Ulf Lilleengen, Kjetil Ørbekk + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version + * 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * A copy of the license can typically be found in COPYING + */ + +#ifndef _MFS_NOTIFY_H_ +#define _MFS_NOTIFY_H_ + +#include + +#define EVENT_DELETE 0x01 +#define EVENT_WRITE 0x02 +#define EVENT_EXTEND 0x04 +#define EVENT_ATTRIB 0x08 +#define EVENT_LINK 0x10 +#define EVENT_RENAME 0x20 +#define EVENT_REVOKE 0x40 + +/* + * An notification event that signals something happened. + */ +struct mfs_notify_event { + uint8_t ev_type; /* Event type. */ + struct mfs_notify_entry *ev_data; /* Affected entry. */ +}; + +/* Callback function for handling events. */ +typedef void mfs_callback_fn_t(struct mfs_notify_event *); + +/* Get affected path. */ +const char *mfs_notify_path(struct mfs_notify_entry *); + +/* Initialize notification system. */ +int mfs_notify_init(mfs_callback_fn_t *); + +/* Register a file for events. */ +int mfs_notify_register(const char *); + +/* Unregister notifiaction via file or entry. */ +int mfs_notify_unregister_file(const char *); +int mfs_notify_unregister_entry(struct mfs_notify_entry *); + +#endif /* !_MFS_NOTIFY_H_ */ -- cgit v1.2.3