agendafs

A filesystem for your calendar.

git clone git://mccd.space/agendafs
commit 981df508b4df3b3f3bf5af7a60d85a3d424cd501
parent 59617e552c4a74111109da4f10b2305e38990bcf
Author: Marc Coquand <marc@coquand.email>
Date:   Tue, 29 Jul 2025 00:00:34 +0200

Docs and wording

Diffstat:
Magendafs.8.scd | 2+-
Mmain.c | 34+++++++++++++++++-----------------
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/agendafs.8.scd b/agendafs.8.scd
@@ -40,7 +40,7 @@ usage. Built-in extended attributes are:
 	*private* or *confidential*.
 
 Arbitrary user-provided attributes are also supported. Limits are set
-to 255 bytes and 64 kilobytes respectively.
+to 255 bytes and 64 kilobytes for namespace and value respectively.
 
 # EXAMPLES
 
diff --git a/main.c b/main.c
@@ -366,14 +366,14 @@ cleanup_return:
 }
 
 static int
-fuse_removexattr(const char *path, const char *header)
+fuse_removexattr(const char *path, const char *attribute)
 {
 	LOG("REMOVEXATTR '%s' '%s'", path, header);
 	memory_region *mreg = create_region();
 	int status = -EINVAL;
 	pthread_mutex_lock(&entries_mutex);
 
-	if (strcmp(header, "user.categories") == 0) {
+	if (strcmp(attribute, "user.categories") == 0) {
 		struct tree_node *node = get_node_by_path(mreg, path);
 		if (!node) {
 			status = -ENONET;
@@ -383,7 +383,7 @@ fuse_removexattr(const char *path, const char *header)
 		status = set_node_categories(mreg, node, "", 0);
 		goto cleanup_return;
 	}
-	else if (strcmp(header, "user.class") == 0) {
+	else if (strcmp(attribute, "user.class") == 0) {
 		struct tree_node *node = get_node_by_path(mreg, path);
 		if (!node) {
 			status = -ENONET;
@@ -393,7 +393,7 @@ fuse_removexattr(const char *path, const char *header)
 		status = delete_node_class(mreg, node);
 		goto cleanup_return;
 	}
-	else if (starts_with_str(header, "user.")) {
+	else if (starts_with_str(attribute, "user.")) {
 		struct tree_node *node = get_node_by_path(mreg, path);
 		if (!node) {
 			status = -ENONET;
@@ -402,7 +402,7 @@ fuse_removexattr(const char *path, const char *header)
 
 		icalcomponent *ic = get_icalcomponent_from_node(mreg, node);
 
-		const char *key = header + 5;
+		const char *key = attribute + 5;
 		icalcomponent_remove_custom_prop(mreg, ic, key);
 		status = write_ical_file(mreg, node, ic);
 		goto cleanup_return;
@@ -415,8 +415,8 @@ cleanup_return:
 }
 
 static int
-fuse_setxattr(const char *path, const char *key, const char *value, size_t s,
-	      int flags)
+fuse_setxattr(const char *path, const char *attribute, const char *value,
+	      size_t s, int flags)
 {
 	LOG("SETXATTR '%s' '%s' '%zu' '%s' '%d'", path, header, s,
 	    new_attributes, flags);
@@ -425,14 +425,14 @@ fuse_setxattr(const char *path, const char *key, const char *value, size_t s,
 	int status = 0;
 
 	// Limit imposed in xattr(7)
-	if (strlen(key) < 256) {
+	if (strlen(attribute) < 256) {
 		status = -EMSGSIZE;
 	}
 
 	if (strlen(value) < 64 * 1024) {
 		status = -EMSGSIZE;
 	}
-	if (strcmp(key, "user.categories") == 0) {
+	if (strcmp(attribute, "user.categories") == 0) {
 		struct tree_node *node = get_node_by_path(mreg, path);
 		if (!node) {
 			status = -ENONET;
@@ -442,7 +442,7 @@ fuse_setxattr(const char *path, const char *key, const char *value, size_t s,
 		status = set_node_categories(mreg, node, value, s);
 		goto cleanup_return;
 	}
-	else if (strcmp(key, "user.class") == 0) {
+	else if (strcmp(attribute, "user.class") == 0) {
 		struct tree_node *node = get_node_by_path(mreg, path);
 		if (!node) {
 			status = -ENONET;
@@ -459,7 +459,7 @@ fuse_setxattr(const char *path, const char *key, const char *value, size_t s,
 		status = set_node_class(mreg, node, iclass);
 		goto cleanup_return;
 	}
-	else if (starts_with_str(key, "user.")) {
+	else if (starts_with_str(attribute, "user.")) {
 		struct tree_node *node = get_node_by_path(mreg, path);
 		if (!node) {
 			status = -ENONET;
@@ -468,7 +468,7 @@ fuse_setxattr(const char *path, const char *key, const char *value, size_t s,
 
 		icalcomponent *ic = get_icalcomponent_from_node(mreg, node);
 
-		const char *rkey = key + 5;
+		const char *rkey = attribute + 5;
 		icalcomponent_set_custom_x_value(mreg, ic, rkey, value);
 		status = write_ical_file(mreg, node, ic);
 		goto cleanup_return;
@@ -554,14 +554,14 @@ cleanup_return:
 }
 
 static int
-fuse_getxattr(const char *path, const char *header, char *buf, size_t s)
+fuse_getxattr(const char *path, const char *attribute, char *buf, size_t s)
 {
 	LOG("GETXATTR '%s' '%s' '%zu'\n", path, header, s);
 	pthread_mutex_lock(&entries_mutex);
 	memory_region *mreg = create_region();
 	int status = -ENODATA;
 
-	if (strcmp(header, "user.categories") == 0) {
+	if (strcmp(attribute, "user.categories") == 0) {
 		struct tree_node *node = get_node_by_path(mreg, path);
 		if (!node) {
 			status = -ENONET;
@@ -585,7 +585,7 @@ fuse_getxattr(const char *path, const char *header, char *buf, size_t s)
 		status = string_len;
 		goto cleanup_return;
 	}
-	else if (strcmp(header, "user.class") == 0) {
+	else if (strcmp(attribute, "user.class") == 0) {
 		struct tree_node *node = get_node_by_path(mreg, path);
 		if (!node) {
 			status = -ENONET;
@@ -607,7 +607,7 @@ fuse_getxattr(const char *path, const char *header, char *buf, size_t s)
 		status = string_len;
 		goto cleanup_return;
 	}
-	else if (starts_with_str(header, "user.")) {
+	else if (starts_with_str(attribute, "user.")) {
 		struct tree_node *node = get_node_by_path(mreg, path);
 		if (!node) {
 			status = -ENONET;
@@ -616,7 +616,7 @@ fuse_getxattr(const char *path, const char *header, char *buf, size_t s)
 
 		icalcomponent *ic = get_icalcomponent_from_node(mreg, node);
 
-		const char *key = header + 5;
+		const char *key = attribute + 5;
 		const char *value =
 		    icalcomponent_get_custom_x_value(mreg, ic, key);
 		if (!value) {