*** ./gptfdisk-1.0.1/Makefile	Mon Oct 19 04:05:18 2015
--- ./gptfdisk-1.0.1_OS9/Makefile	Thu Jan  5 21:51:04 2017
***************
*** 1,10 ****
  CC=gcc
  CXX=g++
! CFLAGS+=-D_FILE_OFFSET_BITS=64
  #CXXFLAGS+=-Wall -D_FILE_OFFSET_BITS=64 -D USE_UTF16
! CXXFLAGS+=-Wall -D_FILE_OFFSET_BITS=64
  LDFLAGS+=
  LIB_NAMES=crc32 support guid gptpart mbrpart basicmbr mbr gpt bsd parttypes attributes diskio diskio-unix
  MBR_LIBS=support diskio diskio-unix basicmbr mbrpart
  LIB_OBJS=$(LIB_NAMES:=.o)
  MBR_LIB_OBJS=$(MBR_LIBS:=.o)
--- 1,10 ----
  CC=gcc
  CXX=g++
! CFLAGS+=-D_FILE_OFFSET_BITS=64 -D__FreeBSD__ -DFORCE10_SSD -DSSD_SECTOR_SIZE=$(SECTOR_SIZE) -DSSD_NUM_HEADS=$(NUM_HEADS) -DSSD_NUM_SECTORS_PER_TRACK=$(NUM_SECTORS_PER_TRACK) -DSSD_TOTAL_SECTORS=$(TOTAL_SECTORS)
  #CXXFLAGS+=-Wall -D_FILE_OFFSET_BITS=64 -D USE_UTF16
! CXXFLAGS+=-Wall -D_FILE_OFFSET_BITS=64 -I .. -I ../popt
  LDFLAGS+=
  LIB_NAMES=crc32 support guid gptpart mbrpart basicmbr mbr gpt bsd parttypes attributes diskio diskio-unix
  MBR_LIBS=support diskio diskio-unix basicmbr mbrpart
  LIB_OBJS=$(LIB_NAMES:=.o)
  MBR_LIB_OBJS=$(MBR_LIBS:=.o)
***************
*** 20,30 ****
  cgdisk: $(LIB_OBJS) cgdisk.o gptcurses.o
  	$(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -luuid -lncursesw -o cgdisk
  #	$(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -licuio -licuuc -luuid -lncurses -o cgdisk
  
  sgdisk: $(LIB_OBJS) sgdisk.o gptcl.o
! 	$(CXX) $(LIB_OBJS) sgdisk.o gptcl.o $(LDFLAGS) -luuid -lpopt -o sgdisk
  #	$(CXX) $(LIB_OBJS) sgdisk.o gptcl.o $(LDFLAGS) -licuio -licuuc -luuid -lpopt -o sgdisk
  
  fixparts: $(MBR_LIB_OBJS) fixparts.o
  	$(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) -o fixparts
  
--- 20,30 ----
  cgdisk: $(LIB_OBJS) cgdisk.o gptcurses.o
  	$(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -luuid -lncursesw -o cgdisk
  #	$(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -licuio -licuuc -luuid -lncurses -o cgdisk
  
  sgdisk: $(LIB_OBJS) sgdisk.o gptcl.o
! 	$(CXX) $(LIB_OBJS) sgdisk.o gptcl.o -L../uuid/.libs -L../popt/.libs $(LDFLAGS) -static -luuid -lpopt -lc -o sgdisk
  #	$(CXX) $(LIB_OBJS) sgdisk.o gptcl.o $(LDFLAGS) -licuio -licuuc -luuid -lpopt -o sgdisk
  
  fixparts: $(MBR_LIB_OBJS) fixparts.o
  	$(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) -o fixparts
  
*** ./gptfdisk-1.0.1/diskio-unix.cc	Mon Oct 19 04:05:18 2015
--- ./gptfdisk-1.0.1_OS9/diskio-unix.cc	Thu Jan  5 21:51:04 2017
***************
*** 152,162 ****
--- 152,167 ----
        err = ioctl(fd, DKIOCGMEDIAINFO, &minfo);
        if (err == 0)
            blockSize = minfo.dki_lbsize;
  #endif
  #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
+ #ifdef FORCE10_SSD
+       blockSize=SSD_SECTOR_SIZE;
+       err=0;
+ #else
        err = ioctl(fd, DIOCGSECTORSIZE, &blockSize);
+ #endif //FORCE10_SSD
  #endif
  #ifdef __linux__
        err = ioctl(fd, BLKSSZGET, &blockSize);
  #endif
  
***************
*** 180,217 ****
--- 185,230 ----
  // Returns the number of heads, according to the kernel, or 255 if the
  // correct value can't be determined.
  uint32_t DiskIO::GetNumHeads(void) {
     uint32_t numHeads = 255;
  
+ #ifdef FORCE10_SSD
+    numHeads = SSD_NUM_HEADS;
+ #else
  #ifdef HDIO_GETGEO
     struct hd_geometry geometry;
  
     // If disk isn't open, try to open it....
     if (!isOpen)
        OpenForRead();
  
     if (!ioctl(fd, HDIO_GETGEO, &geometry))
        numHeads = (uint32_t) geometry.heads;
  #endif
+ #endif //FORCE10_SSD
     return numHeads;
  } // DiskIO::GetNumHeads();
  
  // Returns the number of sectors per track, according to the kernel, or 63
  // if the correct value can't be determined.
  uint32_t DiskIO::GetNumSecsPerTrack(void) {
     uint32_t numSecs = 63;
  
+ #ifdef FORCE10_SSD
+    numSecs = SSD_NUM_SECTORS_PER_TRACK;
+ #else
     #ifdef HDIO_GETGEO
     struct hd_geometry geometry;
  
     // If disk isn't open, try to open it....
     if (!isOpen)
        OpenForRead();
  
     if (!ioctl(fd, HDIO_GETGEO, &geometry))
        numSecs = (uint32_t) geometry.sectors;
     #endif
+ #endif //FORCE10_SSD
     return numSecs;
  } // DiskIO::GetNumSecsPerTrack()
  
  // Resync disk caches so the OS uses the new partition table. This code varies
  // a lot from one OS to another.
***************
*** 239,255 ****
--- 252,274 ----
  #else
        i = ioctl(fd, DKIOCSYNCHRONIZECACHE);
  #endif
        platformFound++;
  #endif
+ 
  #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
+ #ifdef FORCE10_SSD
+    // Let Kernel use the old table for now..
+ 	 return retval;
+ #else
        sleep(2);
        i = ioctl(fd, DIOCGFLUSH);
        cout << "Warning: The kernel may continue to use old or deleted partitions.\n"
             << "You should reboot or remove the drive.\n";
        platformFound++;
  #endif
+ #endif //FORCE10_SSD
  #ifdef __linux__
        sleep(1); // Theoretically unnecessary, but ioctl() fails sometimes if omitted....
        fsync(fd);
        i = ioctl(fd, BLKRRPART);
        if (i) {
***************
*** 417,431 ****
--- 436,457 ----
        if (*err == 0)
            sectors = minfo.dki_capacity;
        platformFound++;
  #endif
  #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
+ #ifdef FORCE10_SSD
+       sectors = SSD_TOTAL_SECTORS;
+       *err = 0;
+       platformFound++;
+ #else
+ 
        *err = ioctl(fd, DIOCGMEDIASIZE, &bytes);
        long long b = GetBlockSize();
        sectors = bytes / b;
        platformFound++;
  #endif
+ #endif //FORCE10_SSD
  #ifdef __linux__
        long sz;
        long long b;
        *err = ioctl(fd, BLKGETSIZE, &sz);
        if (*err) {
