src/dbfs/dbfs.h
changeset 33 c71f3053c714
parent 31 7804cd7b5cd5
child 36 56427f22e969
equal deleted inserted replaced
32:90e14e0df133 33:c71f3053c714
    12 
    12 
    13 /*
    13 /*
    14  * Structs and functions shared between all dbfs components
    14  * Structs and functions shared between all dbfs components
    15  */
    15  */
    16 
    16 
    17 #define SERROR(val) do { (val); goto error; } while(0)
       
    18 
       
    19 struct dbfs {
    17 struct dbfs {
    20     struct event_base *ev_base;
    18     struct event_base *ev_base;
    21     
    19     
    22     const char *db_conninfo;
    20     const char *db_conninfo;
    23     struct evsql *db;
    21     struct evsql *db;
    27 
    25 
    28 // XXX: not sure how this should work
    26 // XXX: not sure how this should work
    29 #define CACHE_TIMEOUT 1.0
    27 #define CACHE_TIMEOUT 1.0
    30 
    28 
    31 // columns used for stat_info
    29 // columns used for stat_info
    32 #define DBFS_STAT_COLS " inodes.type, inodes.mode, lo_size(data), count(*) "
    30 #define DBFS_STAT_COLS " inodes.type, inodes.mode, dbfs_size(inodes.type, inodes.data, inodes.link_path), (SELECT COUNT(*) FROM inodes i LEFT JOIN file_tree ft ON (i.ino = ft.ino) WHERE i.ino = inodes.ino) AS nlink"
    33 #define DBFS_STAT_COLS_NOAGGREGATE " inodes.type, inodes.mode, lo_size(data), NULL "
       
    34 
    31 
    35 /*
    32 /*
    36  * Convert the CHAR(4) inodes.type from SQL into a mode_t.
    33  * Convert the CHAR(4) inodes.type from SQL into a mode_t.
    37  *
    34  *
    38  * Returns zero for unknown types.
    35  * Returns zero for unknown types.