Go to the source code of this file.
◆ fsutil_cat()
| void fsutil_cat |
( |
char ** |
argv | ) |
|
32 {
33 const char *file_name = argv[1];
34
37
38 printf (
"Printing '%s' to the console...\n", file_name);
41 PANIC (
"%s: open failed", file_name);
43 for (;;) {
46 if (n == 0)
47 break;
48
50 }
53}
#define PANIC(...)
Definition: debug.h:14
void file_close(struct file *file)
Definition: file.c:53
off_t file_read(struct file *file, void *buffer, off_t size)
Definition: file.c:73
off_t file_tell(struct file *file)
Definition: file.c:158
struct file * filesys_open(const char *name)
Definition: filesys.c:81
int32_t off_t
Definition: off_t.h:9
@ PAL_ASSERT
Definition: palloc.h:9
void * palloc_get_page(enum palloc_flags)
Definition: palloc.c:301
void palloc_free_page(void *)
Definition: palloc.c:333
#define NULL
Definition: stddef.h:4
void hex_dump(uintptr_t ofs, const void *, size_t size, bool ascii)
Definition: stdio.c:553
int printf(const char *,...) PRINTF_FORMAT(1
off_t pos
Definition: file.c:9
#define PGSIZE
Definition: vaddr.h:20
◆ fsutil_get()
| void fsutil_get |
( |
char ** |
argv | ) |
|
141 {
143
144 const char *file_name = argv[1];
149
150 printf (
"Getting '%s' from the file system...\n", file_name);
151
152
155 PANIC (
"couldn't allocate buffer");
156
157
160 PANIC (
"%s: open failed", file_name);
162
163
166 PANIC (
"couldn't open target disk (hdc or hd1:0)");
167
168
173
174
178 PANIC (
"%s: out of space on scratch disk", file_name);
180 PANIC (
"%s: read failed with %"PROTd" bytes unread", file_name,
size);
184 }
185
186
189}
disk_sector_t disk_size(struct disk *d)
Definition: disk.c:200
void disk_write(struct disk *d, disk_sector_t sec_no, const void *buffer)
Definition: disk.c:235
struct disk * disk_get(int chan_no, int dev_no)
Definition: disk.c:186
#define DISK_SECTOR_SIZE
Definition: disk.h:8
uint32_t disk_sector_t
Definition: disk.h:12
off_t file_length(struct file *file)
Definition: file.c:141
void * malloc(size_t) __attribute__((malloc))
Definition: malloc.c:85
void free(void *)
Definition: malloc.c:202
uint16_t size
Definition: mmu.h:0
#define PROTd
Definition: off_t.h:13
signed int int32_t
Definition: stdint.h:12
void * memcpy(void *, const void *, size_t)
Definition: string.c:7
void * memset(void *, int, size_t)
Definition: string.c:258
◆ fsutil_ls()
| void fsutil_ls |
( |
char ** |
argv | ) |
|
◆ fsutil_put()
| void fsutil_put |
( |
char ** |
argv | ) |
|
78 {
80
81 const char *file_name = argv[1];
86
87 printf (
"Putting '%s' into the file system...\n", file_name);
88
89
92 PANIC (
"couldn't allocate buffer");
93
94
97 PANIC (
"couldn't open source disk (hdc or hd1:0)");
98
99
102 PANIC (
"%s: missing PUT signature on scratch disk", file_name);
105 PANIC (
"%s: invalid file size %d", file_name,
size);
106
107
109 PANIC (
"%s: create failed", file_name);
112 PANIC (
"%s: open failed", file_name);
113
114
119 PANIC (
"%s: write failed with %"PROTd" bytes unwritten",
122 }
123
124
127}
void disk_read(struct disk *d, disk_sector_t sec_no, void *buffer)
Definition: disk.c:211
off_t file_write(struct file *file, const void *buffer, off_t size)
Definition: file.c:97
bool filesys_create(const char *name, off_t initial_size)
Definition: filesys.c:61
int memcmp(const void *, const void *, size_t)
Definition: string.c:48
◆ fsutil_rm()
| void fsutil_rm |
( |
char ** |
argv | ) |
|
57 {
58 const char *file_name = argv[1];
59
60 printf (
"Deleting '%s'...\n", file_name);
62 PANIC (
"%s: delete failed\n", file_name);
63}
bool filesys_remove(const char *name)
Definition: filesys.c:97