api updates
[tridge/hacksm.git] / store.h
1 /*
2   header for HSM store backends
3  */
4
5 /*
6   initialise the link to the HSM store
7  */
8 struct hsm_store_context *hsm_store_init(void);
9
10 /* 
11    open a file handle in the HSM store
12  */
13 struct hsm_store_handle *hsm_store_open(struct hsm_store_context *,
14                                         dev_t device, ino_t inode, bool readonly);
15
16 /*
17   return an error message for the last failed operation
18  */
19 const char *hsm_store_errmsg(struct hsm_store_context *ctx);
20
21
22 /*
23   connect to the store
24  */
25 int hsm_store_connect(struct hsm_store_context *ctx, const char *fsname);
26
27 /*
28   read from an open handle
29  */
30 size_t hsm_store_read(struct hsm_store_handle *, uint8_t *buf, size_t n);
31
32 /* 
33    write to an open handle
34  */
35 int hsm_store_write(struct hsm_store_handle *, uint8_t *buf, size_t n);
36
37 /* 
38    close a handle
39  */
40 int hsm_store_close(struct hsm_store_handle *);
41
42 /* 
43    shutdown the link to the store
44  */
45 void hsm_store_shutdown(struct hsm_store_context *);
46
47 /*
48   remove a file from the store
49  */
50 int hsm_store_remove(struct hsm_store_context *ctx,
51                      dev_t device, ino_t inode);