示例#1
0
static int
beos_refresh_close (PedDevice* dev)
{
	if (dev->dirty)
		_flush_cache (dev);

	return 1;
}
示例#2
0
static int
beos_close (PedDevice* dev)
{
	BEOSSpecific* arch_specific = BEOS_SPECIFIC(dev);

	if (dev->dirty)
		_flush_cache (dev);

	close (arch_specific->fd);

	return 1;
}
示例#3
0
static int
beos_open (PedDevice* dev)
{
	BEOSSpecific* arch_specific = BEOS_SPECIFIC(dev);

retry:
	arch_specific->fd = open(dev->path, O_RDWR);
	if (arch_specific->fd == -1) {
		char* rw_error_msg = strerror(errno);

		arch_specific->fd = open (dev->path, O_RDONLY);
		if (arch_specific->fd == -1) {
			if (ped_exception_throw (
					PED_EXCEPTION_ERROR,
					PED_EXCEPTION_RETRY_CANCEL,
					_("Error opening %s: %s"),
					dev->path, strerror (errno))
					!= PED_EXCEPTION_RETRY) {
						return 0;
					} else {
						goto retry;
					}
		} else {
			ped_exception_throw (
				PED_EXCEPTION_WARNING,
				PED_EXCEPTION_OK,
				_("Unable to open %s read-write (%s).  %s has "
					"been opened read-only."),
				dev->path, rw_error_msg, dev->path);
			dev->read_only = 1;
		}
	} else {
		dev->read_only = 0;
	}

	_flush_cache (dev);

	return 1;
}
示例#4
0
void
grub_arch_sync_caches (void *address, grub_size_t len)
{
  return _flush_cache (address, len, 0);
}