For ease of management it would be nice for users to specify that the device node for a nbd device is destroyed once it is disconnected and there are no more users. Add a client flag and enable this operation to happen.
Showing the changes to include/uapi/linux (1 of 2 files). Show all
Unified · Split
| @@ -37,7 +37,7 @@ enum { · 36 unmodified lines | ||
| 37 | 37 | NBD_CMD_TRIM = 4 |
| 38 | 38 | }; |
| 39 | 39 | |
| 40 | −/* values for flags field */ | |
| 40 | +/* values for flags field, these are server interaction specific. */ | |
| 41 | 41 | #define NBD_FLAG_HAS_FLAGS (1 << 0) /* nbd-server supports flags */ |
| 42 | 42 | #define NBD_FLAG_READ_ONLY (1 << 1) /* device is read-only */ |
| 43 | 43 | #define NBD_FLAG_SEND_FLUSH (1 << 2) /* can flush writeback cache */ |
| @@ -45,6 +45,10 @@ enum { · 1 unmodified line | ||
| 45 | 45 | #define NBD_FLAG_SEND_TRIM (1 << 5) /* send trim/discard */ |
| 46 | 46 | #define NBD_FLAG_CAN_MULTI_CONN (1 << 8) /* Server supports multiple connections per export. */ |
| 47 | 47 | |
| 48 | +/* These are client behavior specific flags. */ | |
| 49 | +#define NBD_CFLAG_DESTROY_ON_DISCONNECT (1 << 0) /* delete the nbd device on | |
| 50 | + disconnect. */ | |
| 51 | + | |
| 48 | 52 | /* userspace doesn't need the nbd_device structure */ |
| 49 | 53 | |
| 50 | 54 | /* These are sent over the network in the request/reply magic fields */ |