From 96febd483c3af967f4686472c0a8f3cdba903496 Mon Sep 17 00:00:00 2001 From: "Robert D. French" Date: Wed, 22 Jun 2022 21:07:08 -0400 Subject: [PATCH] Move mermaid diagrams inline Since GitHub supports that now. Fixes #20. --- 10_filesystem_background/README.md | 8 +- 10_filesystem_background/open.svg | 360 ----------------------------- 20_create_a_door/README.md | 18 +- 20_create_a_door/create-door.svg | 360 ----------------------------- 40_knock_knock/README.md | 34 ++- 40_knock_knock/door-call.svg | 360 ----------------------------- 80_hello_world/README.md | 26 ++- 80_hello_world/hello-yourself.svg | 360 ----------------------------- README.md | 16 +- overview.svg | 360 ----------------------------- 10 files changed, 97 insertions(+), 1805 deletions(-) delete mode 100644 10_filesystem_background/open.svg delete mode 100644 20_create_a_door/create-door.svg delete mode 100644 40_knock_knock/door-call.svg delete mode 100644 80_hello_world/hello-yourself.svg delete mode 100644 overview.svg diff --git a/10_filesystem_background/README.md b/10_filesystem_background/README.md index 580b878..7a344f5 100644 --- a/10_filesystem_background/README.md +++ b/10_filesystem_background/README.md @@ -13,7 +13,13 @@ already exist. This is where the `O_CREAT|O_EXCL` flags come in handy: they tell That is, we don't want some crufty old path that has already been used. If it does, `open` will fail. -![open](open.svg) +```mermaid +sequenceDiagram + participant server.door + participant server + + server ->> server.door: open() // try to create file +``` ## Check for Understanding 1. Why call `open` with `0400` permissions insted of `0600` or `0444`? diff --git a/10_filesystem_background/open.svg b/10_filesystem_background/open.svg deleted file mode 100644 index be0a18d..0000000 --- a/10_filesystem_background/open.svg +++ /dev/null @@ -1,360 +0,0 @@ -server.doorserveropen() // try to create fileserver.doorserver \ No newline at end of file diff --git a/20_create_a_door/README.md b/20_create_a_door/README.md index 087978d..1cdcb9d 100644 --- a/20_create_a_door/README.md +++ b/20_create_a_door/README.md @@ -10,7 +10,23 @@ call referenced below. If that succeeds, we can attach this file descriptor to the filesystem using the `fattach` call. -![create-door](create-door.svg) +```mermaid +sequenceDiagram + participant server.door + participant server + participant void answer() + + server ->> server.door: open() + note left of server: try to create file + + server ->> void answer(): door_create() + note right of server: turn func into door + + server ->> server.door: fattach(answer) + note left of server: connect file to door + + server.door --> void answer(): connected +``` Run `make test` to build and launch this version of the door server in the background. Now run `ls -AhlF server.door` and take a close look at the output. diff --git a/20_create_a_door/create-door.svg b/20_create_a_door/create-door.svg deleted file mode 100644 index 3c34c70..0000000 --- a/20_create_a_door/create-door.svg +++ /dev/null @@ -1,360 +0,0 @@ -server.doorservervoid answer()open()try to create filedoor_create()turn func into doorfattach(answer)connect file to doorconnectedserver.doorservervoid answer() \ No newline at end of file diff --git a/40_knock_knock/README.md b/40_knock_knock/README.md index 6f190c5..4e6d6c6 100644 --- a/40_knock_knock/README.md +++ b/40_knock_knock/README.md @@ -7,7 +7,39 @@ In this lesson, we introduce a client program defined in [client.c](client.c). Its job is to open `server.door` and call the `answer` function inside a running `server` process. -![door-call](door-call.svg) +```mermaid +sequenceDiagram + participant client + participant server.door + participant server + participant void answer() + + server ->> server.door: open() + note left of server: try to create file + + server ->> void answer(): door_create() + note right of server: turn func into door + + server ->> server.door: fattach(answer) + note left of server: connect file to door + + server.door --> void answer(): connected + + note over client: ./client + activate client + client ->> server.door: open() + client ->> void answer(): door_call() + deactivate client + + activate void answer() + note over void answer(): printf("Someone...") + void answer() ->> client: door_return + deactivate void answer() + + activate client + note over client: exit() + deactivate client +``` Opening a door is not (on the whole) different from opening other filesystem resources in UNIX. Perhaps you are more accustomed to using `fopen` to deal with diff --git a/40_knock_knock/door-call.svg b/40_knock_knock/door-call.svg deleted file mode 100644 index be8b609..0000000 --- a/40_knock_knock/door-call.svg +++ /dev/null @@ -1,360 +0,0 @@ -clientserver.doorservervoid answer()open()try to create filedoor_create()turn func into doorfattach(answer)connect file to doorconnected./clientopendoor_call()printf("Someone...")door_return()exitclientserver.doorservervoid answer() \ No newline at end of file diff --git a/80_hello_world/README.md b/80_hello_world/README.md index 7cf6a53..2f3b847 100644 --- a/80_hello_world/README.md +++ b/80_hello_world/README.md @@ -11,7 +11,31 @@ programs, they will exchange pleasantries: > server: "Well hello yourself!" -![hello-yourself](hello-yourself.svg) +```mermaid +sequenceDiagram + participant client + participant server.door + participant server + participant void answer() + + server ->> server.door: open() + + server ->> void answer(): door_create() + + server ->> server.door: fattach(answer) + + server.door --> void answer(): connected + + note over client: ./client + activate client + client ->> server.door: open() + client ->> void answer(): door_call("Hello World!") + deactivate client + + activate void answer() + void answer() ->> client: door_return("Well hello, yourself!") + deactivate void answer() +``` What we provide to the doors library is not this data, but rather the addresses and lengths of these two strings. For the client, the structure that diff --git a/80_hello_world/hello-yourself.svg b/80_hello_world/hello-yourself.svg deleted file mode 100644 index fff2760..0000000 --- a/80_hello_world/hello-yourself.svg +++ /dev/null @@ -1,360 +0,0 @@ -clientserver.doorservervoid answer()open()door_create()fattach()connected./clientopen()door_call("Hello, World!")door_return("Well hello, yourself!")clientserver.doorservervoid answer() \ No newline at end of file diff --git a/README.md b/README.md index 29ce9e7..a313f83 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,21 @@ illumos Doors are a novel form of inter-process communication. They allow a thread in a client process to call a function in a server process, automatically spawning a handler thread in the server process if needed. -![overview](overview.svg) +```mermaid +sequenceDiagram + participant client + participant /tmp/door + participant server + + server ->> /tmp/door: door_create + client ->> /tmp/door: open + + client ->>+ server: door_call(arguments) + note over server: execute in server + server ->>- client: door_return(results) + + client ->> /tmp/door: close +``` This repository includes a set of annotated code examples of increasing complexity, each of which discusses a different aspect of the doors API. Though diff --git a/overview.svg b/overview.svg deleted file mode 100644 index 9ac70fa..0000000 --- a/overview.svg +++ /dev/null @@ -1,360 +0,0 @@ -client/tmp/doorserverdoor_createopendoor_call(arguments)execute in serverdoor_return(results)closeclient/tmp/doorserver \ No newline at end of file