Computer Science, asked by mishrarajnish5617, 1 year ago

How to compose a raw device number from the major and minor device numbers?

Answers

Answered by jinalmarkana
1

import os, sys

path = "/var/www/html/foo.txt"

# Get the stat tuple

info = os.lstat(path)

# Get major and minor device number

major_dnum = os.major(info.st_dev)

minor_dnum = os.minor(info.st_dev)

dev_num = os.makedev(major_dnum, minor_dnum)

print "Device Number :", dev_num

This will give the output:


jinalmarkana: hi
jinalmarkana: ok
jinalmarkana: hi
jinalmarkana: plzzzzzzzzzzz
jinalmarkana: hllo
jinalmarkana: hii
Similar questions