本文整理匯總了Python中stat.S_IFBLK屬性的典型用法代碼示例。如果您正苦於以下問題:Python stat.S_IFBLK屬性的具體用法?Python stat.S_IFBLK怎麽用?Python stat.S_IFBLK使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類stat
的用法示例。
在下文中一共展示了stat.S_IFBLK屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: restore
# 需要導入模塊: import stat [as 別名]
# 或者: from stat import S_IFBLK [as 別名]
def restore(self, fileContents, root, target, journal=None, nameLookup=True,
**kwargs):
util.removeIfExists(target)
if not journal and os.getuid(): return target
util.mkdirChain(os.path.dirname(target))
if journal:
journal.mknod(root, target, self.lsTag, self.devt.major(),
self.devt.minor(), self.inode.perms(),
self.inode.owner(), self.inode.group())
else:
if self.lsTag == 'c':
flags = stat.S_IFCHR
else:
flags = stat.S_IFBLK
os.mknod(target, flags, os.makedev(self.devt.major(),
self.devt.minor()))
return File.restore(self, root, target, journal=journal,
nameLookup=nameLookup, **kwargs)
return target
示例2: makedev
# 需要導入模塊: import stat [as 別名]
# 或者: from stat import S_IFBLK [as 別名]
def makedev(self, tarinfo, targetpath):
"""Make a character or block device called targetpath.
"""
if not hasattr(os, "mknod") or not hasattr(os, "makedev"):
raise ExtractError("special devices not supported by system")
mode = tarinfo.mode
if tarinfo.isblk():
mode |= stat.S_IFBLK
else:
mode |= stat.S_IFCHR
os.mknod(targetpath, mode,
os.makedev(tarinfo.devmajor, tarinfo.devminor))
示例3: get_block
# 需要導入模塊: import stat [as 別名]
# 或者: from stat import S_IFBLK [as 別名]
def get_block(self, major, minor):
return self.get(S_IFBLK, self._rdev(major, minor))