# FS_RegisterEventHook

## Syntax

    #include <nitro/fs.h>

    typedef u32 FSEvent;
    #define FS_EVENT_MEDIA_INSERTED 0x00000001
    #define FS_EVENT_MEDIA_REMOVED  0x00000002

    typedef void (*FSEventFunction)(void *userdata, FSEvent event, void *argument);

    void FS_RegisterEventHook(const char *arcname, FSEventHook *hook, FSEventFunction callback, void *userdata);

## Arguments

arcname | Name of archive to register.
hook | Pointer to the hook structure to use for registration.
callback | Callback that should be called when the event occurs.
userdata | Optional user-defined data that can be passed to the callback arguments (NULL if not required).

## Return Values

None.

## Description

Registers a hook in response to an event notification for the specified archive. This function is mostly used to monitor events in so-called "removable media" like DS Game Cards or SD Memory Cards. The events that trigger notification are as follows:

event | Description | arg
FS_EVENT_MEDIA_INSERTED | Indicates that media related to the archive was inserted. | Always NULL.
FS_EVENT_MEDIA_REMOVED | Indicates that media related to the archive was removed. | Always NULL.

## Note

- Registered callback functions will be called from the interrupt handler.

## See Also

`FS_UnregisterEventHook`

## Revision History

2007/12/06 Initial version.

CONFIDENTIAL