Skip to content

Commit be8566e

Browse files
Fix the code-style problem mentioned by reviewer
As the title says, and I will clean up the commit history later.
1 parent fd24f55 commit be8566e

File tree

6 files changed

+1100
-1001
lines changed

6 files changed

+1100
-1001
lines changed

fuse.h

Lines changed: 54 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ struct fuse_out_header {
2222
uint64_t unique;
2323
};
2424

25-
2625
struct vfs_req_header {
2726
struct fuse_in_header in;
2827
};
@@ -32,68 +31,67 @@ struct vfs_resp_header {
3231
};
3332

3433
struct fuse_init_in {
35-
uint32_t major; // FUSE major version supported by the guest (typically 7)
36-
uint32_t minor; // FUSE minor version supported by the guest (e.g., 31, 26)
37-
uint32_t max_readahead; // Maximum readahead size supported by the guest
38-
// (e.g., 0x10000)
39-
uint32_t flags; // Flags requested by the guest (e.g., support for
40-
// writeback cache)
34+
/* FUSE major version supported by the guest (typically 7) */
35+
uint32_t major;
36+
/* FUSE minor version supported by the guest (e.g., 31, 26) */
37+
uint32_t minor;
38+
uint32_t max_readahead; /* Maximum readahead size supported by the guest */
39+
uint32_t flags; /* Flags requested by the guest */
4140
};
4241

4342
struct fuse_init_out {
44-
uint32_t major; // FUSE major version supported by the device
45-
uint32_t minor; // FUSE minor version supported by the device
46-
uint32_t max_readahead; // Maximum readahead size accepted by the device
47-
uint32_t
48-
flags; // Flags supported by the device (negotiated with the guest)
49-
uint16_t max_background; // Maximum number of background requests
50-
uint16_t
51-
congestion_threshold; // Threshold for marking the connection congested
52-
uint32_t max_write; // Maximum write size the device can handle
53-
uint32_t time_gran; // Time granularity (in nanoseconds)
54-
uint32_t unused[11]; // Reserved
43+
uint32_t major; /* FUSE major version supported by the device */
44+
uint32_t minor; /* FUSE minor version supported by the device */
45+
uint32_t max_readahead; /* Maximum readahead size accepted by the device */
46+
/* Flags supported by the device (negotiated with the guest) */
47+
uint32_t flags;
48+
uint16_t max_background; /* Maximum number of background requests */
49+
uint16_t congestion_threshold;
50+
uint32_t max_write; /* Maximum write size the device can handle */
51+
uint32_t time_gran; /* Time granularity (in nanoseconds) */
52+
uint32_t unused[11]; /* Reserved */
5553
};
5654

5755
struct fuse_getattr_in {
58-
uint32_t getattr_flags; // bitmask for valid fields (e.g. FUSE_GETATTR_FH)
59-
uint32_t padding; // unused, reserved for alignment
60-
uint64_t fh; // optional: file handle (used when getattr_flags has
61-
// FUSE_GETATTR_FH)
56+
/* bitmask for valid fields (e.g. FUSE_GETATTR_FH) */
57+
uint32_t getattr_flags;
58+
uint32_t padding; /* unused, reserved for alignment */
59+
uint64_t fh; /* optional: file handle (used when getattr_flags has */
6260
};
6361

6462
struct fuse_attr {
65-
uint64_t ino; // inode number
66-
uint64_t size; // file size in bytes
67-
uint64_t blocks; // number of 512B blocks allocated
68-
uint64_t atime; // last access time (UNIX time)
69-
uint64_t mtime; // last modification time
70-
uint64_t ctime; // last status change time
71-
uint32_t atimensec; // nanoseconds part
63+
uint64_t ino; /* inode number */
64+
uint64_t size; /* file size in bytes */
65+
uint64_t blocks; /* number of 512B blocks allocated */
66+
uint64_t atime; /* last access time (UNIX time) */
67+
uint64_t mtime; /* last modification time */
68+
uint64_t ctime; /* last status change time */
69+
uint32_t atimensec; /* nanoseconds part */
7270
uint32_t mtimensec;
7371
uint32_t ctimensec;
74-
uint32_t mode; // file mode (e.g. S_IFDIR | 0755)
75-
uint32_t nlink; // number of hard links
76-
uint32_t uid; // owner uid
77-
uint32_t gid; // owner gid
78-
uint32_t rdev; // device ID (if special file)
79-
uint32_t blksize; // block size
80-
uint32_t flags; // reserved
72+
uint32_t mode; /* file mode (e.g. S_IFDIR | 0755) */
73+
uint32_t nlink; /* number of hard links */
74+
uint32_t uid; /* owner uid */
75+
uint32_t gid; /* owner gid */
76+
uint32_t rdev; /* device ID (if special file) */
77+
uint32_t blksize; /* block size */
78+
uint32_t flags; /* reserved */
8179
};
8280

8381
struct fuse_attr_out {
84-
uint64_t attr_valid; // seconds the attributes are valid
85-
uint32_t attr_valid_nsec; // nanoseconds part of attr_valid
86-
uint32_t dummy; // padding for alignment
87-
struct fuse_attr attr; // actual attributes
82+
uint64_t attr_valid; /* seconds the attributes are valid */
83+
uint32_t attr_valid_nsec; /* nanoseconds part of attr_valid */
84+
uint32_t dummy; /* padding for alignment */
85+
struct fuse_attr attr; /* actual attributes */
8886
};
8987

9088
struct fuse_open_in {
9189
uint32_t flags;
92-
uint32_t open_flags; /* FUSE_OPEN_... */
90+
uint32_t open_flags;
9391
};
9492

9593
struct fuse_open_out {
96-
uint64_t fh; // file handle
94+
uint64_t fh;
9795
uint32_t open_flags;
9896
int32_t backing_id;
9997
};
@@ -109,21 +107,21 @@ struct fuse_read_in {
109107
};
110108

111109
struct fuse_entry_out {
112-
uint64_t nodeid; // inode number
113-
uint64_t generation; // inode generation
114-
uint64_t entry_valid; // cache timeout (sec)
115-
uint64_t attr_valid; // attr cache timeout (sec)
116-
uint32_t entry_valid_nsec; // cache timeout (nsec)
117-
uint32_t attr_valid_nsec; // attr cache timeout (nsec)
118-
struct fuse_attr attr; // file attributes
110+
uint64_t nodeid; /* inode number */
111+
uint64_t generation; /* inode generation */
112+
uint64_t entry_valid; /* cache timeout (sec) */
113+
uint64_t attr_valid; /* attr cache timeout (sec) */
114+
uint32_t entry_valid_nsec; /* cache timeout (nsec) */
115+
uint32_t attr_valid_nsec; /* attr cache timeout (nsec) */
116+
struct fuse_attr attr; /* file attributes */
119117
};
120118

121119
struct fuse_dirent {
122-
uint64_t ino; // inode number
123-
uint64_t off; // offset to next entry
124-
uint32_t namelen; // length of the entry name
125-
uint32_t type; // file type (DT_REG, DT_DIR, etc.)
126-
char name[]; // name (not null-terminated)
120+
uint64_t ino; /* inode number */
121+
uint64_t off; /* offset to next entry */
122+
uint32_t namelen; /* length of the entry name */
123+
uint32_t type; /* file type (DT_REG, DT_DIR, etc.) */
124+
char name[]; /* name (not null-terminated) */
127125
};
128126

129127
struct fuse_direntplus {
@@ -132,8 +130,7 @@ struct fuse_direntplus {
132130
};
133131

134132
struct fuse_lookup_in {
135-
uint64_t parent; // inode of parent dir
136-
// char name[]; // followed by name (not null-terminated!)
133+
uint64_t parent; /* inode of parent dir */
137134
};
138135

139136
struct fuse_forget_in {
@@ -144,7 +141,7 @@ struct fuse_create_in {
144141
uint32_t flags;
145142
uint32_t mode;
146143
uint32_t umask;
147-
uint32_t open_flags; /* FUSE_OPEN_... */
144+
uint32_t open_flags;
148145
};
149146

150147
struct fuse_release_in {

main.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ static void mem_store(hart_t *hart,
266266

267267
#if SEMU_HAS(VIRTIOFS)
268268
case 0x48: /* virtio-fs */
269-
// printf("width:%d\n",width);
270269
virtio_fs_write(hart, &data->vfs, addr & 0xFFFFF, width, value);
271270
emu_update_vfs_interrupts(hart->vm);
272271
return;

minimal.dts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
compatible = "virtio,mmio";
8686
reg = <0x4800000 0x1000>;
8787
interrupts = <6>;
88-
tag = "myfs";
8988
};
9089
#endif
9190
};

0 commit comments

Comments
 (0)