File: setblocksz.c

package info (click to toggle)
acorn-fdisk 3.0.6-13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,068 kB
  • sloc: ansic: 5,422; makefile: 99
file content (41 lines) | stat: -rw-r--r-- 965 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * blkio/setblocksz.c
 *
 * Copyright (C) 1998 Russell King
 *
 * The block I/O interface allows an OS-independent method to access devices
 *
 * Close a device on RiscOS architecture
 */
#include <assert.h>
#include <stdlib.h>

#include "util/debug.h"

#include "blkio.h"

#include "filecore.h"

/* Function: u_int blkio_setblocksize (blkio_t *blkio, u_int blocksize)
 * Purpose : Set the block size for all subsequent block IO routines
 * Params  : blkio     - structure returned by blkio_open
 *         : blocksize - new block size to use
 * Returns : block size that will be used
 */
u_int blkio_setblocksize (blkio_t *blkio, u_int blocksize)
{
  assert (blkio != NULL);

  dbg_printf ("blkio_setblocksize(%d)", blocksize);

#ifdef RISCOS
  if (blocksize < (1 << blkio->disc_record->d.log2secsize))
    blocksize = (1 << blkio->disc_record->d.log2secsize);
#endif

  blkio->blocksize = blocksize;

  dbg_printf ("ret=%d", blocksize);

  return blocksize;
}