agendafs

A filesystem for your calendar.

git clone git://mccd.space/agendafs

fuse_node.h (3347B)

      1 #ifndef fuse_node_h_INCLUDED
      2 #define fuse_node_h_INCLUDED
      3 
      4 #include "agenda_entry.h"
      5 #include "fuse_node_store.h"
      6 #include "hashmap.h"
      7 #include "ical_extra.h"
      8 #include "arena.h"
      9 #include "path.h"
     10 #include "tree.h"
     11 #include "util.h"
     12 #include <dirent.h>
     13 #include <libical/ical.h>
     14 #include <pthread.h>
     15 #include <regex.h>
     16 #include <stdbool.h>
     17 #include <stdio.h>
     18 #include <stdlib.h>
     19 #include <string.h>
     20 #include <sys/inotify.h>
     21 #include <sys/stat.h>
     22 #include <time.h>
     23 #include <unistd.h>
     24 #include <uuid/uuid.h>
     25 #include <wordexp.h>
     26 
     27 struct tree_node *
     28 get_node_by_uuid(arena *ar, const char *target_uuid);
     29 
     30 struct tree_node *
     31 get_node_by_path(arena *ar, const char *path);
     32 
     33 bool
     34 node_is_directory(arena *ar, const struct tree_node *node,
     35 		  icalcomponent *node_ics);
     36 
     37 size_t
     38 write_ical_file(arena *ar, const struct tree_node *node,
     39 		icalcomponent *ic);
     40 
     41 // Owner: ctx
     42 icalcomponent *
     43 get_icalcomponent_from_node(arena *ar, const struct tree_node *n);
     44 
     45 int
     46 write_parent_child_components(arena *ar,
     47 			      const struct tree_node *parent,
     48 			      icalcomponent *iparent,
     49 			      const struct tree_node *child,
     50 			      icalcomponent *ichild);
     51 
     52 // Writes ics component summary to the filename of the tree_node
     53 int
     54 update_summary(arena *ar, icalcomponent *ics,
     55 	       const struct tree_node *node);
     56 
     57 struct agenda_entry *
     58 parse_ics_to_agenda_entry(arena *ar, const char *vdir_filepath);
     59 
     60 // agenda_entry is automatically cleaned up by ar, use copy_agenda_entry
     61 // to take ownership!
     62 struct agenda_entry *
     63 load_agenda_entry_from_ics_file(arena *ar, const char *filename);
     64 
     65 void
     66 load_root_node_tree();
     67 
     68 // Returns comma separated list of categories for a file
     69 char *
     70 get_node_categories(arena *ar, const struct tree_node *node);
     71 
     72 int
     73 delete_node_categories(arena *ar, const struct tree_node *node);
     74 
     75 int
     76 set_node_categories(arena *ar, const struct tree_node *node,
     77 		    const char *new_categories, size_t s);
     78 
     79 const char *
     80 get_node_class(arena *ar, const struct tree_node *node);
     81 
     82 const char *
     83 get_node_status(arena *ar, const struct tree_node *node);
     84 
     85 int
     86 delete_node_class(arena *ar, const struct tree_node *node);
     87 
     88 int
     89 set_node_class(arena *ar, const struct tree_node *node,
     90 	       const icalproperty_class new_class);
     91 
     92 int
     93 set_node_status(arena *ar, const struct tree_node *node,
     94 		const icalproperty_status new_status);
     95 
     96 struct stat
     97 get_node_stat(arena *ar, const struct tree_node *node,
     98 	      icalcomponent *node_component);
     99 
    100 int
    101 insert_fuse_node_to_path(arena *ar, const char *fuse_path,
    102 			 struct tree_node *child_node,
    103 			 icalcomponent *child_ics);
    104 
    105 enum ENTRY_TYPE { ENTRY_DIRECTORY, ENTRY_FILE };
    106 
    107 int
    108 create_entry_from_fuse(arena *ar, const char *fuse_path,
    109 		       enum ENTRY_TYPE etype);
    110 
    111 const char *
    112 get_dtstart(arena *ar, struct tree_node *n);
    113 
    114 int
    115 set_dtstart(arena *ar, const char *dtstart_c,
    116 	    const struct tree_node *node);
    117 
    118 int
    119 clear_dtstart(arena *ar, struct tree_node *node);
    120 int
    121 create_directory_from_fuse_path(arena *ar, const char *fuse_path);
    122 
    123 void
    124 update_or_create_fuse_entry_from_vdir(arena *ar,
    125 				      const char *filepath_vdir);
    126 
    127 int
    128 delete_dir_from_fuse_path(arena *ar, const char *filepath);
    129 
    130 int
    131 do_agenda_rename(arena *ar, const char *, const char *);
    132 
    133 int
    134 delete_vdir_entry(arena *ar, struct tree_node *node);
    135 
    136 int
    137 delete_from_vdir_path(arena *ar, const char *filepath);
    138 
    139 #endif // fuse_node_h_INCLUDED