forsyth20110820-1401047deed15 years agoHistory
26 lines · 470 B · C
RawDownload
#include "devfs-posix.c" #include	<linux/hdreg.h>#include	<linux/fs.h>#include	<sys/ioctl.h> static vlongosdisksize(int fd){	uvlong u64;	long l;	struct hd_geometry geo;		memset(&geo, 0, sizeof geo);	l = 0;	u64 = 0;#ifdef BLKGETSIZE64	if(ioctl(fd, BLKGETSIZE64, &u64) >= 0)		return u64;#endif	if(ioctl(fd, BLKGETSIZE, &l) >= 0)		return l*512;	if(ioctl(fd, HDIO_GETGEO, &geo) >= 0)		return (vlong)geo.heads*geo.sectors*geo.cylinders*512;	return 0;}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t