Cody Wong | b29df91 | 2024-04-19 18:42:22 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2024, Google Inc. All rights reserved. |
| 3 | * Author: codycswong@google.com (Cody Wong) |
| 4 | * |
| 5 | * Permission is hereby granted, free of charge, to any person obtaining |
| 6 | * a copy of this software and associated documentation files |
| 7 | * (the "Software"), to deal in the Software without restriction, |
| 8 | * including without limitation the rights to use, copy, modify, merge, |
| 9 | * publish, distribute, sublicense, and/or sell copies of the Software, |
| 10 | * and to permit persons to whom the Software is furnished to do so, |
| 11 | * subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be |
| 14 | * included in all copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 19 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 20 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 21 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 22 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 23 | */ |
| 24 | #include <dev/virtio/9p.h> |
| 25 | #include <lib/fs.h> |
| 26 | #include <lk/list.h> |
| 27 | #include <kernel/mutex.h> |
| 28 | |
| 29 | typedef struct v9fs { |
| 30 | struct virtio_device *dev; |
| 31 | bdev_t *bdev; |
| 32 | |
| 33 | uint32_t unused_fid; |
| 34 | v9fs_fid_t root; |
| 35 | mutex_t lock; |
| 36 | |
| 37 | struct list_node files; |
| 38 | struct list_node dirs; |
| 39 | } v9fs_t; |
| 40 | |
| 41 | status_t v9fs_mount(bdev_t *dev, fscookie **cookie); |
| 42 | status_t v9fs_unmount(fscookie *cookie); |