Python stat.S_IFBLK Examples
The following are 30
code examples of stat.S_IFBLK().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
stat
, or try the search function
.
Example #1
Source File: tarfile.py From recruit with Apache License 2.0 | 6 votes |
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))
Example #2
Source File: files.py From conary with Apache License 2.0 | 6 votes |
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
Example #3
Source File: tarfile.py From syntheticmass with Apache License 2.0 | 5 votes |
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))
Example #4
Source File: buildroot.py From mock with GNU General Public License v2.0 | 5 votes |
def _setup_nspawn_loop_devices(self): if not util.USE_NSPAWN or self.is_bootstrap: return self.config['nspawn_args'].append('--bind=/dev/loop-control') # for nspawn we create the loop devices directly on host for i in range(self.config['dev_loop_count']): loop_file = '/dev/loop{}'.format(i) try: os.mknod(loop_file, stat.S_IFBLK | 0o666, os.makedev(7, i)) except OSError as e: if e.errno != errno.EEXIST: raise self.config['nspawn_args'].append('--bind={0}'.format(loop_file))
Example #5
Source File: tarfile.py From coffeegrindsize with MIT License | 5 votes |
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))
Example #6
Source File: tarfile.py From CogAlg with MIT License | 5 votes |
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))
Example #7
Source File: rpm.py From crypto-detector with Apache License 2.0 | 5 votes |
def makedev(self, cpioinfo, cpiogetpath): """Make a character or block device called cpiogetpath. """ if not hasattr(os, "mknod") or not hasattr(os, "makedev"): raise ExtractError("special devices not supported by system") mode = cpioinfo.mode if cpioinfo.isblk(): mode |= stat.S_IFBLK else: mode |= stat.S_IFCHR os.mknod(cpiogetpath, mode, os.makedev(cpioinfo.devmajor, cpioinfo.devminor))
Example #8
Source File: tarfile.py From RevitBatchProcessor with GNU General Public License v3.0 | 5 votes |
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))
Example #9
Source File: tarfile.py From Carnets with BSD 3-Clause "New" or "Revised" License | 5 votes |
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))
Example #10
Source File: tarfile.py From V1EngineeringInc-Docs with Creative Commons Attribution Share Alike 4.0 International | 5 votes |
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))
Example #11
Source File: tarfile.py From Hands-On-Deep-Learning-for-Games with MIT License | 5 votes |
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))
Example #12
Source File: tarfile.py From jawfish with MIT License | 5 votes |
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))
Example #13
Source File: pid1.py From furnace with GNU Lesser General Public License v2.1 | 5 votes |
def create_device_node(self, name, major, minor, mode, *, is_block_device=False): if is_block_device: device_type = stat.S_IFBLK else: device_type = stat.S_IFCHR nodepath = Path("/dev", name) os.mknod(str(nodepath), mode=device_type, device=os.makedev(major, minor)) # A separate chmod is necessary, because mknod (undocumentedly) takes umask into account when creating nodepath.chmod(mode=mode)
Example #14
Source File: tarfile.py From PhonePi_SampleServer with MIT License | 5 votes |
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))
Example #15
Source File: tarfile.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
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))
Example #16
Source File: tarfile.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
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))
Example #17
Source File: loop.py From osbuild with Apache License 2.0 | 5 votes |
def mknod(self, dir_fd, mode=0o600): """Create a secondary device node Create a device node with the correct name, mode, minor and major number in the provided directory. Note that the device node will survive even if a device is unbound and rebound, so anyone with access to the device node will have access to any future devices with the same minor number. The intended use of this is to first bind a file descriptor to a loopback device, then mknod it where it should be accessed from, and only after the destination directory is ensured to have been destroyed/made inaccessible should the the loopback device be unbound. Note that the provided directory should not be devtmpfs, as the device node is guaranteed to already exist there, and the call would hence fail. Parameters ---------- dir_fd : int Target directory file descriptor mode : int, optional Access mode on the created device node (0o600 is default) """ os.mknod(self.devname, mode=(stat.S_IMODE(mode) | stat.S_IFBLK), device=os.makedev(self.LOOP_MAJOR, self.minor), dir_fd=dir_fd)
Example #18
Source File: tarfile.py From datafari with Apache License 2.0 | 5 votes |
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))
Example #19
Source File: tarfile.py From Ansible with MIT License | 5 votes |
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))
Example #20
Source File: tarfile.py From python2017 with MIT License | 5 votes |
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))
Example #21
Source File: tarfile.py From ImageFusion with MIT License | 5 votes |
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))
Example #22
Source File: tarfile.py From ImageFusion with MIT License | 5 votes |
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))
Example #23
Source File: tarfile.py From rules_pip with MIT License | 5 votes |
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))
Example #24
Source File: paxtarfile.py From quay with Apache License 2.0 | 5 votes |
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))
Example #25
Source File: tarfile.py From planespotter with MIT License | 5 votes |
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))
Example #26
Source File: tarfile.py From Weapon-Detection-And-Classification with MIT License | 5 votes |
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))
Example #27
Source File: tarfile.py From Flask-P2P with MIT License | 5 votes |
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))
Example #28
Source File: tarfile.py From python with Apache License 2.0 | 5 votes |
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))
Example #29
Source File: tarfile.py From Financial-Portfolio-Flask with MIT License | 5 votes |
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))
Example #30
Source File: tarfile.py From PokemonGo-DesktopMap with MIT License | 5 votes |
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))