Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal support for Darwin (OSX) #56

Open
ghost opened this issue Aug 23, 2016 · 10 comments
Open

Minimal support for Darwin (OSX) #56

ghost opened this issue Aug 23, 2016 · 10 comments

Comments

@ghost
Copy link

ghost commented Aug 23, 2016

Hi, I tried compiling and porting DiskPatch to OSX, apart from errors in CMAKE and time compatibility with the standard library it appears that under /arch the correct file for this architecture has not been developed. It would be nice to have something like a start. I would really like to help if you know where I can get a good documentation/example. (No clue from developer.apple.com)

@baruch
Copy link
Owner

baruch commented Aug 23, 2016

I'm currently away and we'll be able to look at it later on but initially
you may want to utilize the POSIX interface that is available. I believe
that there SCSI interfaces are not supported in Mac OS.

Baruch

On Tue, Aug 23, 2016, 17:21 Mc128k [email protected] wrote:

Hi, I tried compiling and porting DiskPatch to OSX, apart from errors in
CMAKE and time compatibility with the standard library it appears that
under /arch the correct file for this architecture has not been developed.
It would be nice to have something like a start. I would really like to
help if you know where I can get a good documentation/example. (No clue
from developer.apple.com)


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#56, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAIHShxjHX-XxdA4jXH939XIremh053Tks5qix4WgaJpZM4JrHg1
.

@baruch
Copy link
Owner

baruch commented Aug 24, 2016

Did you try to utilize the posix interface for Darwin?

@ghost
Copy link
Author

ghost commented Aug 31, 2016

OSX is a bit different, and yes, I tried a bit and that didn't work well. One thing I saw for example is that for direct access you have to use /dev/rdisk instead of /dev/disk. This is a diagnostic tool, and having caching between the disk and the program is not quite good

@ghost
Copy link
Author

ghost commented Aug 25, 2017

One thing, can you please include this in CMakeLists.txt:

include(CheckFunctionExists)

Otherwise cmake complains about the missing function

@ghost
Copy link
Author

ghost commented Aug 25, 2017

Also I notice there are some function calls that seem linux-specific:

  "_disk_dev_mount_state", referenced from:
      _disk_mount_allowed in libdiskscanlib.a(diskscan.c.o)
  "_sched_setscheduler", referenced from:
      _set_realtime in libdiskscanlib.a(diskscan.c.o)
  "_verbose", referenced from:
      _diskscan_cli in cli.c.o
      _print_header in cli.c.o
      _disk_scan in libdiskscanlib.a(diskscan.c.o)
      _latency_bucket_prepare in libdiskscanlib.a(diskscan.c.o)
      _disk_scan_latency_stride in libdiskscanlib.a(diskscan.c.o)
      _latency_bucket_finish in libdiskscanlib.a(diskscan.c.o)
      _conclusion_calc in libdiskscanlib.a(diskscan.c.o)
      ...

setscheduler looks like a GNU Library function, I don't know about verbose.
disk_dev_mount_state is not declared in the 'generic' architecture, and the compiler complains about it

@baruch
Copy link
Owner

baruch commented Aug 25, 2017

I can try to add the cmake bit, no problem.

The rest will actually require some work with Mac OS X to resolve properly. Do you know if there is any method to get a remote shell on a mac for such development? Once upon a time sourceforge would provide different unix boxes to access remotely for porting but I never saw such a thing for Macs.

@ghost
Copy link
Author

ghost commented Aug 25, 2017

You can virtualize OSX with VirtualBox. It's a bit complicated to get a good image, but it works. VMware player too. There's a patch around.

Anyway maybe I think I can try to fix them. About direct access there's only to change the device name from /dev/disk3 to /dev/rdisk3 (I'll check the docs), the disk mount state can be asked by invoking a shell command (or maybe there's an API for that), but I'm clueless about the scheduler. What is it for exactly? Is the GNU library really needed?

@baruch
Copy link
Owner

baruch commented Aug 25, 2017

You can probably skip the scheduler, I dont recall right now what it was for but I doubt it is critical.

@ghost
Copy link
Author

ghost commented Aug 25, 2017

I corrected some stuff and created a header for the darwin architecture (a copy of the generic one). The program compiles, but it complains about an invalid number of sectors. I'll try to figure that out and come back to you if I get stuck. Hopefully the source will get documented some time

@ghost
Copy link
Author

ghost commented Aug 25, 2017

I think I made it work, the progress bar stays silent, but I can see the activity on the hard disk. Also if I interrupt it the graph works fine.

The code I edited is a mess, still I created a darwin architecture like the others and fixed some issues, if you'd like I can share them as .diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant