+static int pre_create_hook(void)
+{
+ int ret, fds[3] = {0, 0, 0};
+
+ assert(snapshot_creation_status == HS_READY);
+ if (!conf.pre_create_hook_given) {
+ snapshot_creation_status = HS_PRE_SUCCESS;
+ return 0;
+ }
+ DSS_DEBUG_LOG("executing %s\n", conf.pre_create_hook_arg);
+ ret = dss_exec_cmdline_pid(&create_pid,
+ conf.pre_create_hook_arg, fds);
+ if (ret < 0)
+ return ret;
+ snapshot_creation_status = HS_PRE_RUNNING;
+ return ret;
+}
+
+static int pre_remove_hook(struct snapshot *s, char *why)
+{
+ int ret, fds[3] = {0, 0, 0};
+ char *cmd;
+
+ DSS_DEBUG_LOG("%s snapshot %s\n", why, s->name);
+ assert(snapshot_removal_status == HS_READY);
+ assert(remove_pid == 0);
+ assert(!snapshot_currently_being_removed);
+
+ snapshot_currently_being_removed = dss_malloc(sizeof(struct snapshot));
+ *snapshot_currently_being_removed = *s;
+ snapshot_currently_being_removed->name = dss_strdup(s->name);