def mknod(self, path, mode, dev):
# File can't exist already or upper levels of VFS reject the call.
if mode & stat.S_IFBLK != stat.S_IFBLK:
raise TmfsOSError(errno.ENOTBLK)
rsp = self.librarian(self.lcp('get_shelf', path=path),
errorOK=True)
if 'errmsg' not in rsp:
raise TmfsOSError(errno.EEXIST)
nbooks = dev & 0xFF # minor
if not nbooks:
raise TmfsOSError(errno.EINVAL)
mode &= 0o777
fh = self.create(path, 0, supermode=stat.S_IFBLK + mode) # w/shadow
self.setxattr(path, 'user.LFS.AllocationPolicy',
'LocalNode'.encode(), 0)
self.truncate(path, nbooks * self.bsize, fh)
self.release(path, fh)
# mknod(1m) immediately does a stat looking for S_IFBLK.
# Not sure what else to do about shadow mode...
return 0
评论列表
文章目录