ref: cda9ba6f76bfe31f24670280f0feea69b3804507
parent: f529dbef4f57fed64da41bc08e4464a88d433f58
author: Noam Preil <noam@pixelhero.dev>
date: Fri Jun 28 15:58:29 EDT 2024
fuck it, drop all of the first pass
--- a/venti/dat.h
+++ /dev/null
@@ -1,27 +1,0 @@
-enum{
- ABlockLog = 9, /* log2(512), the quantum for reading arenas */
- ANameSize = 64,
- MaxDiskBlock = 64*1024, /* max. allowed size for a disk block */
- MaxIoSize = 64*1024, /* max. allowed size for a disk io operation */
- PartBlank = 256*1024, /* untouched section at beginning of partition */
- HeadSize = 512, /* size of a header after PartBlank */
- MinArenaSize = 1*1024*1024, /* smallest reasonable arena size */
- MaxConfig = 8 * 1024, /* Maximum size of the configuration file */
- IndexBase = 1024*1024, /* initial address to use in an index */
- MaxIo = 64*1024, /* max size of a single read or write operation */
- ICacheBits = 16, /* default bits for indexing icache */
- MaxAMap = 31*1024, /* max. allowed arenas in an address mapping; must be < 32*1024 */
-};
-
-typedef struct {
- uint32_t version;
-} arenapart;
-
-typedef struct{
- char *index;
- /* Amount of memory to use for the cache */
- uint64_t mem;
- uint32_t naparts;
- arenapart **parts;
-} config;
-
--- a/venti/fns.h
+++ /dev/null
@@ -1,3 +1,0 @@
-config loadconfig(char *path);
-int nameok(char *name);
-
--- a/venti/main.c
+++ /dev/null
@@ -1,43 +1,0 @@
-#include "platform.h"
-#include "dat.h"
-#include "fns.h"
-
-struct {
- char *file;
-} params;
-
-static inline char*
-next(int argc, char **argv, int *i)
-{
- if (*i + 1 == argc)
- sysfatal("Expected argument to '%s'!", argv[*i]);
- *i += 1;
- return argv[*i];
-}
-
-static void
-initargs(void)
-{
- params.file = "venti.conf";
-}
-
-static void
-parseargs(int argc, char **argv)
-{
- for(int i = 1; i < argc; i += 1){
- if(streql("-c", argv[i]))
- params.file = next(argc, argv, &i);
- else
- sysfatal("Unrecognized argument: '%s'", argv[i]);
- }
-}
-
-int
-main(int argc, char **argv)
-{
- initargs();
- parseargs(argc, argv);
- loadconfig(params.file);
- sysfatal("TODO: launch server");
- return 0;
-}
--- a/venti/utils.c
+++ /dev/null
@@ -1,15 +1,0 @@
-#include "platform.h"
-#include "dat.h"
-#include "fns.h"
-
-int
-nameok(char *name)
-{
- if(name == NULL || strlen(name) >= ANameSize)
- return 0;
- for(size_t i = 0; i < strlen(name); i += 1)
- if(name[i] < 0x20 || name[i] >= 0x80)
- return 0;
- return 1;
-}
-
--
⑨