Compare commits

..

No commits in common. "ce02798aeb0f8f4de7b9a8cab4908e180845fee6" and "b9216ff85b6f1dd18ea4864b41127e78fdd642c9" have entirely different histories.

4 changed files with 7 additions and 16 deletions

View File

@ -1,4 +1,3 @@
local component = require "component"
local partition = {} local partition = {}
local eformat = "c20c4>I4>I4" local eformat = "c20c4>I4>I4"

View File

@ -1,4 +1,3 @@
local component = require "component"
local tA = {...} local tA = {...}
local fdisk = {} local fdisk = {}
local addr = component.get(table.remove(tA, 1)) local addr = component.get(table.remove(tA, 1))
@ -16,18 +15,15 @@ function fdisk.show()
end end
function fdisk.del(i) function fdisk.del(i)
local pt = require("diskpart").getPartitions(addr) local pt = require("diskpart").getPartitions(addr)
table.remove(pt, tonumber(i)) table.remove(pt, i)
require("diskpart").setPartitions(addr, pt)
fdisk.show()
end
function fdisk.set(id, name, ftype, start, len)
local pt = require("diskpart").getPartitions(addr)
pt[tonumber(id)] = {name, ftype, tonumber(start), tonumber(len)}
require("diskpart").setPartitions(addr, pt) require("diskpart").setPartitions(addr, pt)
fdisk.show() fdisk.show()
end end
function fdisk.add(name, ftype, start, len) function fdisk.add(name, ftype, start, len)
fdisk.set(#require("diskpart").getPartitions(addr)+1, name, ftype, start, len) local pt = require("diskpart").getPartitions(addr)
pt[#pt+1] = {name, ftype, start, len}
require("diskpart").setPartitions(addr, pt)
fdisk.show()
end end
assert(fdisk[cmd], "unknown command") assert(fdisk[cmd], "unknown command")

View File

@ -1,6 +1,3 @@
local fs = fs or require "filesystem"
local component = require "component"
local computer = require "computer"
local cache = (package.loaded["fs.rtfs"] or {}).cache or {hitsR=0, hitsW=0, missesR=0, missesW=0} local cache = (package.loaded["fs.rtfs"] or {}).cache or {hitsR=0, hitsW=0, missesR=0, missesW=0}
local proxy = {} local proxy = {}
local rtfs = {proxy=proxy, cache=cache} local rtfs = {proxy=proxy, cache=cache}

View File

@ -1,4 +1,3 @@
local fs = fs or require "filesystem"
local common = require "fs.rtfs" local common = require "fs.rtfs"
local rtfs, proxy = {}, setmetatable({},{__index=common.proxy}) local rtfs, proxy = {}, setmetatable({},{__index=common.proxy})
local ieformat = ">I2I8I8c46" -- type (4 bits) and index (12 bits), start sector (32 bits), lenth in bytes (32 bits), name/path (46 bytes) local ieformat = ">I2I8I8c46" -- type (4 bits) and index (12 bits), start sector (32 bits), lenth in bytes (32 bits), name/path (46 bytes)
@ -374,7 +373,7 @@ function proxy:compactIndex(ti)
return ri return ri
end end
function rtfs.mount(p,ro) function rtfs.mount(p)
local d = common.getProxy(p) local d = common.getProxy(p)
local p = setmetatable({}, {__index=proxy}) local p = setmetatable({}, {__index=proxy})
p.d = d p.d = d
@ -421,7 +420,7 @@ function rtfs.mount(p,ro)
function p.spaceTotal() function p.spaceTotal()
return p.capacity - (math.ceil(p.isize / (p.blockSize / iesize))*p.blockSize) - p.blockSize return p.capacity - (math.ceil(p.isize / (p.blockSize / iesize))*p.blockSize) - p.blockSize
end end
p.isReadOnly = p.d.isReadOnly or function() return ro or false end p.isReadOnly = p.d.isReadOnly
function p.list(name) function p.list(name)
name = fnormalize(name) name = fnormalize(name)