1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2013 Damian Bogel. All rights reserved.
  14  */
  15 
  16 #ifndef _LIBFSD_H
  17 #define _LIBFSD_H
  18 
  19 #include <sys/fsd.h>
  20 
  21 #ifdef __cplusplus
  22 extern "C" {
  23 #endif
  24 
  25 typedef struct fsd_handle {
  26         int fd;
  27         int fsd_errno;
  28         int errno;
  29 } fsd_handle_t;
  30 
  31 #define EFSD_NOERROR                    0
  32 #define EFSD_BAD_PARAM                  1
  33 #define EFSD_CANT_OPEN_DRIVER           2
  34 #define EFSD_CANT_OPEN_MOUNTPOINT       3
  35 #define EFSD_ENTRY_NOT_FOUND            4
  36 #define EFSD_FAULT                      5
  37 #define EFSD_NOT_ENABLED                6
  38 #define EFSD_TOO_MANY_HOOKS             7
  39 #define EFSD_INTERNAL                   8
  40 #define EFSD_UNKNOWN_ERROR              9
  41 
  42 extern const char *fsd_strerr(int e);
  43 
  44 extern int fsd_open(fsd_handle_t *handle);
  45 extern void fsd_close(fsd_handle_t *handle);
  46 
  47 extern int fsd_enable(fsd_handle_t *handle);
  48 extern int fsd_disable(fsd_handle_t *handle);
  49 
  50 extern int fsd_get_param(fsd_handle_t *handle, const char *mnt_path,
  51                 fsd_t *param);
  52 extern int fsd_disturb(fsd_handle_t *handle, const char *mnt_path,
  53                 fsd_t *param);
  54 extern int fsd_disturb_off(fsd_handle_t *handle, const char *mnt_path);
  55 
  56 extern int fsd_disturb_omni(fsd_handle_t *handle, fsd_t *param);
  57 extern int fsd_disturb_omni_off(fsd_handle_t *handle);
  58 
  59 
  60 extern int fsd_get_info(fsd_handle_t *handle, fsd_info_t *info);
  61 extern int fsd_get_list(fsd_handle_t *handle, fsd_fs_t *fslist, int *count);
  62 
  63 #ifdef __cplusplus
  64 }
  65 #endif
  66 
  67 #endif /* _LIBFSD_H */