X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fllite%2Fllite_internal.h;h=4905090d781d8e792f6354a399e5ccc9158979e8;hp=b3157fc52970dc7c6c62d912d896dd5415532f37;hb=e4deafd378448a0ef27ec4c2d1c191cc55bf691c;hpb=9dc49744935d4709ab9bc8122635fd6c8e43ae1d diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index b3157fc..4905090 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -783,4 +783,51 @@ void ll_truncate_free_capa(struct obd_capa *ocapa); void ll_clear_inode_capas(struct inode *inode); void ll_print_capa_stat(struct ll_sb_info *sbi); +/* llite ioctl register support rountine */ +#ifdef __KERNEL__ +enum llioc_iter { + LLIOC_CONT = 0, + LLIOC_STOP +}; + +#define LLIOC_MAX_CMD 256 + +/* + * Rules to write a callback function: + * + * Parameters: + * @magic: Dynamic ioctl call routine will feed this vaule with the pointer + * returned to ll_iocontrol_register. Callback functions should use this + * data to check the potential collasion of ioctl cmd. If collasion is + * found, callback function should return LLIOC_CONT. + * @rcp: The result of ioctl command. + * + * Return values: + * If @magic matches the pointer returned by ll_iocontrol_data, the + * callback should return LLIOC_STOP; return LLIOC_STOP otherwise. + */ +typedef enum llioc_iter (*llioc_callback_t)(struct inode *inode, + struct file *file, unsigned int cmd, unsigned long arg, + void *magic, int *rcp); + +enum llioc_iter ll_iocontrol_call(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg, int *rcp); + +/* export functions */ +/* Register ioctl block dynamatically for a regular file. + * + * @cmd: the array of ioctl command set + * @count: number of commands in the @cmd + * @cb: callback function, it will be called if an ioctl command is found to + * belong to the command list @cmd. + * + * Return vaule: + * A magic pointer will be returned if success; + * otherwise, NULL will be returned. + * */ +void *ll_iocontrol_register(llioc_callback_t cb, int count, unsigned int *cmd); +void ll_iocontrol_unregister(void *magic); + +#endif + #endif /* LLITE_INTERNAL_H */