aruu

[MIRROR] Actual replacement for Busybox | suckless
git clone https://git.daat.foo/aruu.git
Log | Files | Refs | README | LICENSE

diskutil_nbsd.c (1013B)


      1 /* see LICENSE file for copyright and license details */
      2 #include "../diskutil.h"
      3 
      4 #if defined(__NetBSD__) && !defined(ARUU_FORCE_POSIX)
      5 #include <errno.h>
      6 #include <sys/types.h>
      7 #include <sys/disklabel.h>
      8 #include <sys/dkio.h>
      9 #include <sys/ioctl.h>
     10 
     11 void
     12 blockdev_sys_size(struct BlockDev *dev)
     13 {
     14   struct disklabel dl;
     15 
     16   if (ioctl(dev->fd, DIOCGDINFO, &dl) >= 0) {
     17     dev->size     = (uint64_t)dl.d_secsize * DL_GETDSIZE(&dl);
     18     dev->sec_size = dl.d_secsize;
     19   }
     20 }
     21 
     22 void
     23 blockdev_sys_reread(struct BlockDev *dev)
     24 {
     25   (void)dev;
     26 }
     27 
     28 struct BlockDevInfo *
     29 blockdev_get_list(void)
     30 {
     31   return blockdev_probe_list();
     32 }
     33 
     34 int
     35 blockdev_mount(const char *dev, const char *dir, const char *fstype, int flags, const char *data)
     36 {
     37   (void)dev;
     38   (void)dir;
     39   (void)fstype;
     40   (void)flags;
     41   (void)data;
     42   errno = ENOSYS;
     43   return -1;
     44 }
     45 
     46 int
     47 blockdev_unmount(const char *dir)
     48 {
     49   (void)dir;
     50   errno = ENOSYS;
     51   return -1;
     52 }
     53 
     54 int
     55 blockdev_poweroff(const char *disk)
     56 {
     57   (void)disk;
     58   errno = ENOSYS;
     59   return -1;
     60 }
     61 #endif